From 671560f497f3413c48470d3b66642f806e4c08f0 Mon Sep 17 00:00:00 2001 From: Sergey Yershov Date: Thu, 24 Dec 2015 13:31:48 +0300 Subject: [PATCH 1/2] Remove duplicated types --- indexer/feature_data.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp index 872468bfe8..786878fb40 100644 --- a/indexer/feature_data.cpp +++ b/indexer/feature_data.cpp @@ -360,6 +360,11 @@ bool FeatureParams::FinishAddingTypes() newTypes.push_back(candidate); } + // Remove duplicated types. + sort(newTypes.begin(), newTypes.end()); + auto last = unique(newTypes.begin(), newTypes.end()); + newTypes.erase(last, newTypes.end()); + m_Types.swap(newTypes); if (m_Types.size() > max_types_count) From d8d41215c563f231eb97428bed6a30716ca7a04c Mon Sep 17 00:00:00 2001 From: Sergey Yershov Date: Thu, 24 Dec 2015 15:11:52 +0300 Subject: [PATCH 2/2] Review fix --- indexer/feature_data.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp index 786878fb40..ffaf297270 100644 --- a/indexer/feature_data.cpp +++ b/indexer/feature_data.cpp @@ -362,8 +362,7 @@ bool FeatureParams::FinishAddingTypes() // Remove duplicated types. sort(newTypes.begin(), newTypes.end()); - auto last = unique(newTypes.begin(), newTypes.end()); - newTypes.erase(last, newTypes.end()); + newTypes.erase(unique(newTypes.begin(), newTypes.end()), newTypes.end()); m_Types.swap(newTypes);