diff options
author | Maxim Pimenov <m@maps.me> | 2018-09-12 14:22:15 +0300 |
---|---|---|
committer | Vlad Mihaylenko <vxmihaylenko@gmail.com> | 2018-09-14 15:14:36 +0300 |
commit | c7e09657fa5cc6fd5600252b41e9774b83c0a45d (patch) | |
tree | 0c1636a81a6afba6ae87b3040096bb86bf862c81 /search | |
parent | 4a44e1d009cf30dbb9fe759260aeef221a7be561 (diff) |
[base] Unified stl_add and stl_helpers.
Diffstat (limited to 'search')
39 files changed, 78 insertions, 83 deletions
diff --git a/search/base/mem_search_index.hpp b/search/base/mem_search_index.hpp index a92e05b162..f152474505 100644 --- a/search/base/mem_search_index.hpp +++ b/search/base/mem_search_index.hpp @@ -6,7 +6,6 @@ #include "base/assert.hpp" #include "base/mem_trie.hpp" -#include "base/stl_add.hpp" #include "base/stl_helpers.hpp" #include "base/string_utils.hpp" @@ -92,7 +91,7 @@ private: { std::vector<Id> ids; fn(ids); - my::SortUnique(ids); + ::base::SortUnique(ids); return ids; } diff --git a/search/base/text_index/mem.cpp b/search/base/text_index/mem.cpp index 4c18f3b90f..f192f91a31 100644 --- a/search/base/text_index/mem.cpp +++ b/search/base/text_index/mem.cpp @@ -21,7 +21,7 @@ void MemTextIndex::SortPostings() // so we remove duplicates for the docid index. // If the count is needed for ranking it may be stored // separately. - my::SortUnique(entry.second); + ::base::SortUnique(entry.second); } } diff --git a/search/base/text_index/merger.cpp b/search/base/text_index/merger.cpp index 50f8af1d9a..931c583660 100644 --- a/search/base/text_index/merger.cpp +++ b/search/base/text_index/merger.cpp @@ -10,7 +10,6 @@ #include "base/assert.hpp" #include "base/logging.hpp" -#include "base/stl_add.hpp" #include "base/stl_helpers.hpp" #include <algorithm> @@ -70,9 +69,9 @@ private: return; auto const & tokens = m_dict.GetTokens(); - m_index1.ForEachPosting(tokens[m_tokenId], MakeBackInsertFunctor(m_postings)); - m_index2.ForEachPosting(tokens[m_tokenId], MakeBackInsertFunctor(m_postings)); - my::SortUnique(m_postings); + m_index1.ForEachPosting(tokens[m_tokenId], ::base::MakeBackInsertFunctor(m_postings)); + m_index2.ForEachPosting(tokens[m_tokenId], ::base::MakeBackInsertFunctor(m_postings)); + ::base::SortUnique(m_postings); } TextIndexDictionary const & m_dict; diff --git a/search/bookmarks/processor.cpp b/search/bookmarks/processor.cpp index d44b2fa66f..4083016247 100644 --- a/search/bookmarks/processor.cpp +++ b/search/bookmarks/processor.cpp @@ -103,7 +103,7 @@ void Processor::Erase(Id const & id) void Processor::Search(QueryParams const & params) const { set<Id> ids; - auto insertId = MakeInsertFunctor(ids); + auto insertId = ::base::MakeInsertFunctor(ids); for (size_t i = 0; i < params.GetNumTokens(); ++i) { diff --git a/search/engine.cpp b/search/engine.cpp index 7fac0f5da5..1ae71962f0 100644 --- a/search/engine.cpp +++ b/search/engine.cpp @@ -18,7 +18,7 @@ #include "base/logging.hpp" #include "base/scope_guard.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include <algorithm> #include <cstdint> diff --git a/search/feature_offset_match.hpp b/search/feature_offset_match.hpp index 862db56327..3bfc9653f6 100644 --- a/search/feature_offset_match.hpp +++ b/search/feature_offset_match.hpp @@ -11,7 +11,7 @@ #include "base/assert.hpp" #include "base/dfa_helpers.hpp" #include "base/levenshtein_dfa.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include "base/string_utils.hpp" #include "base/uni_string_dfa.hpp" diff --git a/search/features_layer_path_finder.cpp b/search/features_layer_path_finder.cpp index f19af9058d..35bf95fae8 100644 --- a/search/features_layer_path_finder.cpp +++ b/search/features_layer_path_finder.cpp @@ -138,7 +138,7 @@ void FeaturesLayerPathFinder::FindReachableVerticesTopDown( parentGraph.emplace_back(); FeaturesLayer parent(*layers[i]); if (i != layers.size() - 1) - my::SortUnique(reachable); + ::base::SortUnique(reachable); parent.m_sortedFeatures = &reachable; // The first condition is an optimization: it is enough to extract @@ -202,7 +202,7 @@ void FeaturesLayerPathFinder::FindReachableVerticesBottomUp( parentGraph.emplace_front(); FeaturesLayer child(*layers[i]); if (i != 0) - my::SortUnique(reachable); + ::base::SortUnique(reachable); child.m_sortedFeatures = &reachable; child.m_hasDelayedFeatures = (i == 0 && MayHaveDelayedFeatures(child)); @@ -216,7 +216,7 @@ void FeaturesLayerPathFinder::FindReachableVerticesBottomUp( first = false; } - my::SortUnique(lowestLevel); + ::base::SortUnique(lowestLevel); IntersectionResult result; for (auto const & id : lowestLevel) diff --git a/search/geocoder.cpp b/search/geocoder.cpp index ec3fd5f77b..a49cb927c6 100644 --- a/search/geocoder.cpp +++ b/search/geocoder.cpp @@ -428,7 +428,7 @@ void Geocoder::GoInViewport() vector<shared_ptr<MwmInfo>> infos; m_dataSource.GetMwmsInfo(infos); - my::EraseIf(infos, [this](shared_ptr<MwmInfo> const & info) { + ::base::EraseIf(infos, [this](shared_ptr<MwmInfo> const & info) { return !m_params.m_pivot.IsIntersect(info->m_bordersRect); }); @@ -1169,7 +1169,7 @@ void Geocoder::MatchPOIsAndBuildings(BaseContext & ctx, size_t curToken) return !filtered.HasBit(bit); }; for (auto & cluster : clusters) - my::EraseIf(cluster, noFeature); + ::base::EraseIf(cluster, noFeature); size_t curs[kNumClusters] = {}; size_t ends[kNumClusters]; @@ -1275,7 +1275,7 @@ void Geocoder::FindPaths(BaseContext & ctx) sortedLayers.reserve(layers.size()); for (auto const & layer : layers) sortedLayers.push_back(&layer); - sort(sortedLayers.begin(), sortedLayers.end(), my::LessBy(&FeaturesLayer::m_type)); + sort(sortedLayers.begin(), sortedLayers.end(), ::base::LessBy(&FeaturesLayer::m_type)); auto const & innermostLayer = *sortedLayers.front(); diff --git a/search/geocoder_context.cpp b/search/geocoder_context.cpp index 21e42e235e..efca03df32 100644 --- a/search/geocoder_context.cpp +++ b/search/geocoder_context.cpp @@ -3,7 +3,7 @@ #include "search/token_range.hpp" #include "base/assert.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" using namespace std; diff --git a/search/house_detector.cpp b/search/house_detector.cpp index 7c46461971..d98be7eec2 100644 --- a/search/house_detector.cpp +++ b/search/house_detector.cpp @@ -851,7 +851,7 @@ int HouseDetector::LoadStreets(vector<FeatureID> const & ids) { // LOG(LDEBUG, ("IDs = ", ids)); - ASSERT(IsSortedAndUnique(ids.begin(), ids.end()), ()); + ASSERT(base::IsSortedAndUnique(ids.begin(), ids.end()), ()); // Check if the cache is obsolete and need to be cleared. if (!m_id2st.empty()) @@ -1191,7 +1191,7 @@ void HouseDetector::ClearUnusedStreets(vector<FeatureID> const & ids) m_streets.erase(remove_if(m_streets.begin(), m_streets.end(), HasStreet(streets)), m_streets.end()); - for_each(streets.begin(), streets.end(), DeleteFunctor()); + for_each(streets.begin(), streets.end(), base::DeleteFunctor()); } template <typename T> diff --git a/search/keyword_lang_matcher.cpp b/search/keyword_lang_matcher.cpp index 993e737403..840dac7e40 100644 --- a/search/keyword_lang_matcher.cpp +++ b/search/keyword_lang_matcher.cpp @@ -4,7 +4,7 @@ #include "indexer/search_string_utils.hpp" #include "base/assert.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include <algorithm> #include <limits> diff --git a/search/keyword_matcher.cpp b/search/keyword_matcher.cpp index 4ebdb53ea6..e0efafb243 100644 --- a/search/keyword_matcher.cpp +++ b/search/keyword_matcher.cpp @@ -5,7 +5,7 @@ #include "base/assert.hpp" #include "base/buffer_vector.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include <algorithm> #include <sstream> @@ -40,7 +40,7 @@ KeywordMatcher::Score KeywordMatcher::CalcScore(string const & name) const KeywordMatcher::Score KeywordMatcher::CalcScore(strings::UniString const & name) const { buffer_vector<strings::UniString, kMaxNumTokens> tokens; - SplitUniString(name, MakeBackInsertFunctor(tokens), Delimiters()); + SplitUniString(name, ::base::MakeBackInsertFunctor(tokens), Delimiters()); return CalcScore(tokens.data(), tokens.size()); } diff --git a/search/locality_scorer.cpp b/search/locality_scorer.cpp index cb4c45d262..5f042be0c2 100644 --- a/search/locality_scorer.cpp +++ b/search/locality_scorer.cpp @@ -178,7 +178,7 @@ void LocalityScorer::LeaveTopByNormAndRank(size_t limitUniqueIds, vector<ExLocal seen.insert(els[i].GetId()); ASSERT_LESS_OR_EQUAL(seen.size(), limitUniqueIds, ()); - my::EraseIf(els, [&](ExLocality const & el) { return seen.find(el.GetId()) == seen.cend(); }); + ::base::EraseIf(els, [&](ExLocality const & el) { return seen.find(el.GetId()) == seen.cend(); }); } void LocalityScorer::LeaveTopBySimilarityAndRank(size_t limit, vector<ExLocality> & els) const diff --git a/search/model.cpp b/search/model.cpp index c532549af5..6387b001d2 100644 --- a/search/model.cpp +++ b/search/model.cpp @@ -4,7 +4,7 @@ #include "indexer/feature.hpp" #include "base/macros.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" using namespace ftypes; @@ -13,14 +13,14 @@ namespace search TwoLevelPOIChecker::TwoLevelPOIChecker() : ftypes::BaseChecker(2 /* level */) { Classificator const & c = classif(); - my::StringIL arr[] = {{"highway", "bus_stop"}, - {"highway", "speed_camera"}, - {"waterway", "waterfall"}, - {"natural", "volcano"}, - {"natural", "cave_entrance"}, - {"natural", "beach"}, - {"emergency", "defibrillator"}, - {"emergency", "fire_hydrant"}}; + base::StringIL arr[] = {{"highway", "bus_stop"}, + {"highway", "speed_camera"}, + {"waterway", "waterfall"}, + {"natural", "volcano"}, + {"natural", "cave_entrance"}, + {"natural", "beach"}, + {"emergency", "defibrillator"}, + {"emergency", "fire_hydrant"}}; for (size_t i = 0; i < ARRAY_SIZE(arr); ++i) m_types.push_back(c.GetTypeByPath(arr[i])); diff --git a/search/nested_rects_cache.cpp b/search/nested_rects_cache.cpp index 6e5b87fe5a..bb8e64edc0 100644 --- a/search/nested_rects_cache.cpp +++ b/search/nested_rects_cache.cpp @@ -8,7 +8,7 @@ #include "geometry/rect2d.hpp" #include "base/assert.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include "std/algorithm.hpp" diff --git a/search/pre_ranker.cpp b/search/pre_ranker.cpp index f914574f7b..adc51d6ac4 100644 --- a/search/pre_ranker.cpp +++ b/search/pre_ranker.cpp @@ -141,7 +141,7 @@ void PreRanker::Filter(bool viewportSearch) }; sort(m_results.begin(), m_results.end(), comparePreRankerResults); - m_results.erase(unique(m_results.begin(), m_results.end(), my::EqualsBy(&PreRankerResult::GetId)), + m_results.erase(unique(m_results.begin(), m_results.end(), base::EqualsBy(&PreRankerResult::GetId)), m_results.end()); bool const centersLoaded = @@ -243,7 +243,7 @@ void PreRanker::FilterForViewportSearch() { auto const & viewport = m_params.m_viewport; - my::EraseIf(m_results, [&viewport](PreRankerResult const & result) { + ::base::EraseIf(m_results, [&viewport](PreRankerResult const & result) { auto const & info = result.GetInfo(); return !viewport.IsPointInside(info.m_center); }); diff --git a/search/processor.cpp b/search/processor.cpp index 1c7acf2dbb..0a75ea6b89 100644 --- a/search/processor.cpp +++ b/search/processor.cpp @@ -44,7 +44,6 @@ #include "base/logging.hpp" #include "base/macros.hpp" #include "base/scope_guard.hpp" -#include "base/stl_add.hpp" #include "base/stl_helpers.hpp" #include "base/string_utils.hpp" @@ -223,7 +222,7 @@ void Processor::SetQuery(string const & query) vector<strings::UniString> tokens; { search::DelimitersWithExceptions delims(vector<strings::UniChar>{'#'}); - SplitUniString(NormalizeAndSimplifyString(query), MakeBackInsertFunctor(tokens), delims); + SplitUniString(NormalizeAndSimplifyString(query), ::base::MakeBackInsertFunctor(tokens), delims); } search::Delimiters delims; @@ -238,7 +237,7 @@ void Processor::SetQuery(string const & query) // Splits |token| by hashtags, because all other delimiters are // already removed. subTokens.clear(); - SplitUniString(token, MakeBackInsertFunctor(subTokens), delims); + SplitUniString(token, ::base::MakeBackInsertFunctor(subTokens), delims); if (subTokens.empty()) continue; @@ -281,7 +280,7 @@ void Processor::SetQuery(string const & query) if (!m_isCategorialRequest) ForEachCategoryType(tokenSlice, [&](size_t, uint32_t t) { m_preferredTypes.push_back(t); }); - my::SortUnique(m_preferredTypes); + ::base::SortUnique(m_preferredTypes); } m2::PointD Processor::GetPivotPoint(bool viewportSearch) const @@ -531,7 +530,7 @@ void Processor::InitParams(QueryParams & params) const } for (size_t i = 0; i < params.GetNumTokens(); ++i) - my::SortUnique(params.GetTypeIndices(i)); + ::base::SortUnique(params.GetTypeIndices(i)); m_keywordsScorer.ForEachLanguage( [&](int8_t lang) { params.GetLangs().Insert(static_cast<uint64_t>(lang)); }); diff --git a/search/ranker.cpp b/search/ranker.cpp index 55c2e4a8ec..150538137f 100644 --- a/search/ranker.cpp +++ b/search/ranker.cpp @@ -478,7 +478,7 @@ void Ranker::UpdateResults(bool lastUpdate) if (m_params.m_viewportSearch) { sort(m_tentativeResults.begin(), m_tentativeResults.end(), - my::LessBy(&RankerResult::GetDistanceToPivot)); + ::base::LessBy(&RankerResult::GetDistanceToPivot)); } else { @@ -486,7 +486,7 @@ void Ranker::UpdateResults(bool lastUpdate) // but the model is lightweight enough and the slowdown // is negligible. sort(m_tentativeResults.rbegin(), m_tentativeResults.rend(), - my::LessBy(&RankerResult::GetLinearModelRank)); + ::base::LessBy(&RankerResult::GetLinearModelRank)); ProcessSuggestions(m_tentativeResults); } diff --git a/search/ranking_utils.hpp b/search/ranking_utils.hpp index b81aeae15a..c4077e7d01 100644 --- a/search/ranking_utils.hpp +++ b/search/ranking_utils.hpp @@ -8,7 +8,7 @@ #include "indexer/search_string_utils.hpp" #include "base/levenshtein_dfa.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include "base/string_utils.hpp" #include <algorithm> @@ -133,7 +133,7 @@ NameScore GetNameScore(std::string const & name, Slice const & slice) return NAME_SCORE_ZERO; std::vector<strings::UniString> tokens; - SplitUniString(NormalizeAndSimplifyString(name), MakeBackInsertFunctor(tokens), Delimiters()); + SplitUniString(NormalizeAndSimplifyString(name), ::base::MakeBackInsertFunctor(tokens), Delimiters()); return GetNameScore(tokens, slice); } diff --git a/search/region_info_getter.cpp b/search/region_info_getter.cpp index 37a7e980d5..7626f98a0c 100644 --- a/search/region_info_getter.cpp +++ b/search/region_info_getter.cpp @@ -64,7 +64,7 @@ string RegionInfoGetter::GetLocalizedFullName(storage::TCountryId const & id) co if (parts.size() > kMaxNumParts) parts.erase(parts.begin(), parts.end() - kMaxNumParts); - my::EraseIf(parts, [&](string const & s) { return s.empty(); }); + ::base::EraseIf(parts, [&](string const & s) { return s.empty(); }); if (!parts.empty()) return strings::JoinStrings(parts, ", "); diff --git a/search/retrieval.cpp b/search/retrieval.cpp index fd56851ff3..2e4a1a6b25 100644 --- a/search/retrieval.cpp +++ b/search/retrieval.cpp @@ -107,7 +107,7 @@ private: unique_ptr<coding::CompressedBitVector> SortFeaturesAndBuildCBV(vector<uint64_t> && features) { - my::SortUnique(features); + ::base::SortUnique(features); return coding::CompressedBitVectorBuilder::FromBitPositions(move(features)); } diff --git a/search/reverse_geocoder.cpp b/search/reverse_geocoder.cpp index b82b367b01..1d79158684 100644 --- a/search/reverse_geocoder.cpp +++ b/search/reverse_geocoder.cpp @@ -64,7 +64,7 @@ void GetNearbyStreetsImpl(DataSource const & source, MwmSet::MwmId const & id, fillStreets(move(mwmHandle), rect, addStreet); - sort(streets.begin(), streets.end(), my::LessBy(&ReverseGeocoder::Street::m_distanceMeters)); + sort(streets.begin(), streets.end(), ::base::LessBy(&ReverseGeocoder::Street::m_distanceMeters)); } } // namespace @@ -79,7 +79,7 @@ void ReverseGeocoder::GetNearbyStreets(search::MwmContext & context, m2::PointD auto const addStreet = [¢er, &streets](FeatureType & ft) { AddStreet(ft, center, streets); }; context.ForEachFeature(rect, addStreet); - sort(streets.begin(), streets.end(), my::LessBy(&Street::m_distanceMeters)); + sort(streets.begin(), streets.end(), ::base::LessBy(&Street::m_distanceMeters)); } void ReverseGeocoder::GetNearbyStreets(MwmSet::MwmId const & id, m2::PointD const & center, @@ -240,7 +240,7 @@ void ReverseGeocoder::GetNearbyBuildings(m2::PointD const & center, vector<Build }; m_dataSource.ForEachInRect(addBuilding, rect, kQueryScale); - sort(buildings.begin(), buildings.end(), my::LessBy(&Building::m_distanceMeters)); + sort(buildings.begin(), buildings.end(), ::base::LessBy(&Building::m_distanceMeters)); } // static diff --git a/search/search_integration_tests/generate_tests.cpp b/search/search_integration_tests/generate_tests.cpp index c90aa143e3..485a064457 100644 --- a/search/search_integration_tests/generate_tests.cpp +++ b/search/search_integration_tests/generate_tests.cpp @@ -14,7 +14,7 @@ #include "platform/local_country_file.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include <cstdint> #include <set> @@ -69,7 +69,7 @@ UNIT_CLASS_TEST(GenerateTest, GenerateDeprecatedTypes) TEST_EQUAL(dataSource.Register(file).second, MwmSet::RegResult::Success, ()); // New types. - my::StringIL arr[] = {{"shop"}, {"office"}}; + base::StringIL arr[] = {{"shop"}, {"office"}}; Classificator const & cl = classif(); set<uint32_t> types; diff --git a/search/search_integration_tests/pre_ranker_test.cpp b/search/search_integration_tests/pre_ranker_test.cpp index 8a17f866ee..4e1479f76b 100644 --- a/search/search_integration_tests/pre_ranker_test.cpp +++ b/search/search_integration_tests/pre_ranker_test.cpp @@ -29,7 +29,7 @@ #include "base/cancellable.hpp" #include "base/limited_priority_queue.hpp" #include "base/math.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include "std/algorithm.hpp" #include "std/iterator.hpp" @@ -153,7 +153,7 @@ UNIT_CLASS_TEST(PreRankerTest, Smoke) preRanker.UpdateResults(true /* lastUpdate */); - TEST(all_of(emit.begin(), emit.end(), IdFunctor()), (emit)); + TEST(all_of(emit.begin(), emit.end(), ::base::IdFunctor()), (emit)); TEST(ranker.Finished(), ()); TEST_EQUAL(results.size(), kBatchSize, ()); diff --git a/search/search_quality/matcher.cpp b/search/search_quality/matcher.cpp index 467ba078fa..3a4221232f 100644 --- a/search/search_quality/matcher.cpp +++ b/search/search_quality/matcher.cpp @@ -11,7 +11,7 @@ #include "geometry/mercator.hpp" #include "base/control_flow.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" namespace search { diff --git a/search/search_quality/search_quality_tool/search_quality_tool.cpp b/search/search_quality/search_quality_tool/search_quality_tool.cpp index 3f43841275..4b08a69260 100644 --- a/search/search_quality/search_quality_tool/search_quality_tool.cpp +++ b/search/search_quality/search_quality_tool/search_quality_tool.cpp @@ -28,7 +28,7 @@ #include "base/logging.hpp" #include "base/scope_guard.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include "base/string_utils.hpp" #include "base/timer.hpp" diff --git a/search/search_tests/house_detector_tests.cpp b/search/search_tests/house_detector_tests.cpp index 6391d87985..375921f675 100644 --- a/search/search_tests/house_detector_tests.cpp +++ b/search/search_tests/house_detector_tests.cpp @@ -406,7 +406,7 @@ UNIT_TEST(HS_MWMSearch) continue; vector<string> v; - strings::Tokenize(line, "|", MakeBackInsertFunctor(v)); + strings::Tokenize(line, "|", ::base::MakeBackInsertFunctor(v)); string key = GetStreetKey(v[0]); if (key.empty()) diff --git a/search/search_tests/keyword_matcher_test.cpp b/search/search_tests/keyword_matcher_test.cpp index 3112fec91b..0132f1f4ac 100644 --- a/search/search_tests/keyword_matcher_test.cpp +++ b/search/search_tests/keyword_matcher_test.cpp @@ -7,7 +7,7 @@ #include "indexer/search_string_utils.hpp" #include "base/buffer_vector.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include "std/sstream.hpp" #include "std/vector.hpp" diff --git a/search/search_tests/locality_scorer_test.cpp b/search/search_tests/locality_scorer_test.cpp index aa655212d4..e942f2b631 100644 --- a/search/search_tests/locality_scorer_test.cpp +++ b/search/search_tests/locality_scorer_test.cpp @@ -11,7 +11,6 @@ #include "base/assert.hpp" #include "base/mem_trie.hpp" -#include "base/stl_add.hpp" #include "base/stl_helpers.hpp" #include "base/string_utils.hpp" @@ -39,7 +38,7 @@ public: vector<UniString> tokens; Delimiters delims; - SplitUniString(NormalizeAndSimplifyString(query), MakeBackInsertFunctor(tokens), delims); + SplitUniString(NormalizeAndSimplifyString(query), ::base::MakeBackInsertFunctor(tokens), delims); if (lastTokenIsPrefix) { @@ -56,7 +55,7 @@ public: { set<UniString> tokens; Delimiters delims; - SplitUniString(NormalizeAndSimplifyString(name), MakeInsertFunctor(tokens), delims); + SplitUniString(NormalizeAndSimplifyString(name), base::MakeInsertFunctor(tokens), delims); for (auto const & token : tokens) m_searchIndex.Add(token, featureId); @@ -91,7 +90,7 @@ public: } }); - my::SortUnique(ids); + ::base::SortUnique(ids); ctx.m_features.emplace_back(coding::CompressedBitVectorBuilder::FromBitPositions(ids)); } @@ -100,7 +99,7 @@ public: vector<Locality> localities; m_scorer.GetTopLocalities(MwmSet::MwmId(), ctx, filter, limit, localities); - sort(localities.begin(), localities.end(), my::LessBy(&Locality::m_featureId)); + sort(localities.begin(), localities.end(), ::base::LessBy(&Locality::m_featureId)); Ids ids; for (auto const & locality : localities) @@ -136,7 +135,7 @@ public: m_searchIndex.ForEachInNode(token, [&ids](uint32_t id) { ids.push_back(id); }); } - my::SortUnique(ids); + ::base::SortUnique(ids); return CBV{coding::CompressedBitVectorBuilder::FromBitPositions(move(ids))}; } diff --git a/search/search_tests/mem_search_index_tests.cpp b/search/search_tests/mem_search_index_tests.cpp index 1e0cd99139..94eb8ca6e9 100644 --- a/search/search_tests/mem_search_index_tests.cpp +++ b/search/search_tests/mem_search_index_tests.cpp @@ -7,7 +7,6 @@ #include "coding/multilang_utf8_string.hpp" -#include "base/stl_add.hpp" #include "base/stl_helpers.hpp" #include "base/string_utils.hpp" #include "base/uni_string_dfa.hpp" @@ -59,7 +58,7 @@ public: vector<Id> StrictQuery(string const & query, string const & lang) const { auto prev = m_index.GetAllIds(); - TEST(IsSortedAndUnique(prev.cbegin(), prev.cend()), ()); + TEST(::base::IsSortedAndUnique(prev.cbegin(), prev.cend()), ()); vector<UniString> tokens; NormalizeAndTokenizeString(query, tokens); @@ -73,7 +72,7 @@ public: MatchFeaturesInTrie(request, m_index.GetRootIterator(), [](Id const & /* id */) { return true; } /* filter */, [&curr](Id const & id) { curr.push_back(id); } /* toDo */); - my::SortUnique(curr); + ::base::SortUnique(curr); vector<Id> intersection; set_intersection(prev.begin(), prev.end(), curr.begin(), curr.end(), diff --git a/search/search_tests/ranking_tests.cpp b/search/search_tests/ranking_tests.cpp index 2b10b73d51..a870b94ae7 100644 --- a/search/search_tests/ranking_tests.cpp +++ b/search/search_tests/ranking_tests.cpp @@ -8,7 +8,7 @@ #include "indexer/search_delimiters.hpp" #include "indexer/search_string_utils.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include "base/string_utils.hpp" #include "std/cstdint.hpp" @@ -25,7 +25,7 @@ NameScore GetScore(string const & name, string const & query, TokenRange const & QueryParams params; vector<UniString> tokens; - SplitUniString(NormalizeAndSimplifyString(query), MakeBackInsertFunctor(tokens), delims); + SplitUniString(NormalizeAndSimplifyString(query), ::base::MakeBackInsertFunctor(tokens), delims); if (!query.empty() && !delims(strings::LastUniChar(query))) { diff --git a/search/search_tests/string_match_test.cpp b/search/search_tests/string_match_test.cpp index 961e0fd9be..97b0ac2cd6 100644 --- a/search/search_tests/string_match_test.cpp +++ b/search/search_tests/string_match_test.cpp @@ -4,7 +4,7 @@ #include "indexer/search_delimiters.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include "base/string_utils.hpp" #include <cstdint> @@ -111,7 +111,7 @@ UNIT_TEST(StringSplit_Smoke) TEST_EQUAL(ToUtf8(s1), s, ()); char const * arr[] = { "1", "2" }; - SplitUniString(s1, MakeBackInsertFunctor(tokens), Delimiters()); + SplitUniString(s1, ::base::MakeBackInsertFunctor(tokens), Delimiters()); TestEqual(tokens, arr); } } diff --git a/search/search_tests/text_index_tests.cpp b/search/search_tests/text_index_tests.cpp index b161007f14..7119e89286 100644 --- a/search/search_tests/text_index_tests.cpp +++ b/search/search_tests/text_index_tests.cpp @@ -14,7 +14,7 @@ #include "coding/write_to_sink.hpp" #include "coding/writer.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include "base/string_utils.hpp" #include "std/transform_iterator.hpp" @@ -72,7 +72,7 @@ template <typename Index, typename Token> void TestForEach(Index const & index, Token const & token, vector<uint32_t> const & expected) { vector<uint32_t> actual; - index.ForEachPosting(token, MakeBackInsertFunctor(actual)); + index.ForEachPosting(token, ::base::MakeBackInsertFunctor(actual)); TEST_EQUAL(actual, expected, (token)); }; } // namespace diff --git a/search/street_vicinity_loader.cpp b/search/street_vicinity_loader.cpp index ed5b9812b4..a10c8f0549 100644 --- a/search/street_vicinity_loader.cpp +++ b/search/street_vicinity_loader.cpp @@ -8,7 +8,7 @@ #include "geometry/point2d.hpp" #include "base/math.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" namespace search { @@ -50,7 +50,7 @@ void StreetVicinityLoader::LoadStreet(uint32_t featureId, Street & street) return; vector<m2::PointD> points; - feature.ForEachPoint(MakeBackInsertFunctor(points), FeatureType::BEST_GEOMETRY); + feature.ForEachPoint(::base::MakeBackInsertFunctor(points), FeatureType::BEST_GEOMETRY); ASSERT(!points.empty(), ()); for (auto const & point : points) @@ -58,7 +58,7 @@ void StreetVicinityLoader::LoadStreet(uint32_t featureId, Street & street) covering::CoveringGetter coveringGetter(street.m_rect, covering::ViewportWithLowLevels); auto const & intervals = coveringGetter.Get<RectId::DEPTH_LEVELS>(m_scale); - m_context->ForEachIndex(intervals, m_scale, MakeBackInsertFunctor(street.m_features)); + m_context->ForEachIndex(intervals, m_scale, ::base::MakeBackInsertFunctor(street.m_features)); street.m_calculator = make_unique<ProjectionOnStreetCalculator>(points); } diff --git a/search/streets_matcher.cpp b/search/streets_matcher.cpp index f852b1c742..7b71990501 100644 --- a/search/streets_matcher.cpp +++ b/search/streets_matcher.cpp @@ -42,10 +42,10 @@ void StreetsMatcher::Go(BaseContext const & ctx, FeaturesFilter const & filter, sort(predictions.begin(), predictions.end(), &LessByHash); predictions.erase( - unique(predictions.begin(), predictions.end(), my::EqualsBy(&Prediction::m_hash)), + unique(predictions.begin(), predictions.end(), base::EqualsBy(&Prediction::m_hash)), predictions.end()); - sort(predictions.rbegin(), predictions.rend(), my::LessBy(&Prediction::m_prob)); + sort(predictions.rbegin(), predictions.rend(), ::base::LessBy(&Prediction::m_prob)); while (predictions.size() > kMaxNumOfImprobablePredictions && predictions.back().m_prob < kTailProbability) { diff --git a/search/suggest.cpp b/search/suggest.cpp index 5272337d66..f6c6888e15 100644 --- a/search/suggest.cpp +++ b/search/suggest.cpp @@ -5,7 +5,7 @@ #include "search/common.hpp" -#include "base/stl_add.hpp" +#include "base/stl_helpers.hpp" #include <vector> @@ -19,7 +19,7 @@ void GetSuggestion(RankerResult const & res, string const & query, QueryTokens c // Splits result's name. search::Delimiters delims; vector<strings::UniString> tokens; - SplitUniString(NormalizeAndSimplifyString(res.GetName()), MakeBackInsertFunctor(tokens), delims); + SplitUniString(NormalizeAndSimplifyString(res.GetName()), ::base::MakeBackInsertFunctor(tokens), delims); // Finds tokens that are already present in the input query. vector<bool> tokensMatched(tokens.size()); diff --git a/search/tracer.cpp b/search/tracer.cpp index f767d89440..0f2c5b4fa4 100644 --- a/search/tracer.cpp +++ b/search/tracer.cpp @@ -63,7 +63,7 @@ string DebugPrint(Tracer::Parse const & parse) vector<Tracer::Parse> Tracer::GetUniqueParses() const { auto parses = m_parses; - my::SortUnique(parses); + ::base::SortUnique(parses); return parses; } } // namespace search diff --git a/search/utils.cpp b/search/utils.cpp index ff8d2d0587..3cabefa58d 100644 --- a/search/utils.cpp +++ b/search/utils.cpp @@ -60,13 +60,13 @@ vector<uint32_t> GetCategoryTypes(string const & name, string const & locale, locales.Insert(static_cast<uint64_t>(code)); vector<strings::UniString> tokens; - SplitUniString(search::NormalizeAndSimplifyString(name), MakeBackInsertFunctor(tokens), + SplitUniString(search::NormalizeAndSimplifyString(name), ::base::MakeBackInsertFunctor(tokens), search::Delimiters()); FillCategories(QuerySliceOnRawStrings<vector<strings::UniString>>(tokens, {} /* prefix */), locales, categories, types); - my::SortUnique(types); + ::base::SortUnique(types); return types; } diff --git a/search/utils.hpp b/search/utils.hpp index 0942ade6fc..c9c8739f13 100644 --- a/search/utils.hpp +++ b/search/utils.hpp @@ -100,7 +100,7 @@ bool FillCategories(QuerySliceOnRawStrings<T> const & slice, Locales const & loc std::vector<QueryParams::String> categoryTokens; SplitUniString(search::NormalizeAndSimplifyString(categorySynonym.m_name), - MakeBackInsertFunctor(categoryTokens), search::Delimiters()); + ::base::MakeBackInsertFunctor(categoryTokens), search::Delimiters()); if (slice.Size() != categoryTokens.size()) return; |