diff options
90 files changed, 439 insertions, 367 deletions
diff --git a/feature_list/feature_list.cpp b/feature_list/feature_list.cpp index f36a15bb5c..b477cc37ae 100644 --- a/feature_list/feature_list.cpp +++ b/feature_list/feature_list.cpp @@ -32,6 +32,7 @@ #include "std/algorithm.hpp" #include "std/iostream.hpp" +#include "std/sstream.hpp" class ClosestPoint { diff --git a/map/framework.cpp b/map/framework.cpp index b064bfebb9..54977cb166 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -104,6 +104,7 @@ #include "std/algorithm.hpp" #include "std/bind.hpp" #include "std/map.hpp" +#include "std/sstream.hpp" #include "std/target_os.hpp" #include "api/internal/c/api-client-internals.h" diff --git a/map/map_tests/mwm_url_tests.cpp b/map/map_tests/mwm_url_tests.cpp index 965beec614..bc1d1ee68a 100644 --- a/map/map_tests/mwm_url_tests.cpp +++ b/map/map_tests/mwm_url_tests.cpp @@ -12,6 +12,7 @@ #include "base/string_format.hpp" #include "std/random.hpp" +#include "std/sstream.hpp" using namespace url_scheme; diff --git a/search/algos.hpp b/search/algos.hpp index bb5c5d89cd..bfb4b2cc98 100644 --- a/search/algos.hpp +++ b/search/algos.hpp @@ -1,13 +1,13 @@ #pragma once -#include "base/base.hpp" -#include "std/algorithm.hpp" -#include "std/vector.hpp" +#include "base/base.hpp" +#include <algorithm> +#include <cstddef> +#include <vector> namespace search { - namespace impl { struct LS @@ -23,15 +23,15 @@ namespace impl increaseValue = 1; } }; -} +} // namespace impl -template <class T, class OutIterT, class CompT> -void LongestSubsequence(vector<T> const & in, OutIterT out, CompT cmp) +template <typename T, typename OutIterT, typename CompT> +void LongestSubsequence(std::vector<T> const & in, OutIterT out, CompT cmp) { if (in.empty()) return; - vector<impl::LS> v; + std::vector<impl::LS> v; v.reserve(in.size()); for (size_t i = 0; i < in.size(); ++i) v.push_back(impl::LS(i)); @@ -54,7 +54,7 @@ void LongestSubsequence(vector<T> const & in, OutIterT out, CompT cmp) v[j].prevDecreasePos = i; } - size_t const m = max(v[j].increaseValue, v[j].decreaseValue); + size_t const m = std::max(v[j].increaseValue, v[j].decreaseValue); if (m > res) { res = m; @@ -77,5 +77,4 @@ void LongestSubsequence(vector<T> const & in, OutIterT out, CompT cmp) pos = v[pos].prevDecreasePos; } } - -} +} // namespace search diff --git a/search/approximate_string_match.cpp b/search/approximate_string_match.cpp index 5bda6a2c7d..e1bbba536a 100644 --- a/search/approximate_string_match.cpp +++ b/search/approximate_string_match.cpp @@ -7,7 +7,6 @@ namespace search { - using strings::UniChar; uint32_t DefaultMatchCost::Cost10(UniChar) const @@ -44,5 +43,4 @@ uint32_t DefaultMatchCost::SwapCost(UniChar, UniChar) const { return 256; } - } // namespace search diff --git a/search/approximate_string_match.hpp b/search/approximate_string_match.hpp index 6c8cf23002..4c5aef4166 100644 --- a/search/approximate_string_match.hpp +++ b/search/approximate_string_match.hpp @@ -1,17 +1,17 @@ #pragma once + #include "indexer/search_string_utils.hpp" #include "base/base.hpp" #include "base/buffer_vector.hpp" -#include "std/queue.hpp" +#include <cstdint> +#include <queue> namespace search { - namespace impl { - struct MatchCostData { uint32_t m_A, m_B; @@ -32,8 +32,7 @@ void PushMatchCost(PriorityQueyeT & q, uint32_t maxCost, uint32_t a, uint32_t b, if (cost <= maxCost) q.push(MatchCostData(a, b, cost)); } - -} // namespace search::impl +} // namespace impl class DefaultMatchCost { @@ -53,7 +52,7 @@ uint32_t StringMatchCost(CharT const * sA, size_t sizeA, CostF const & costF, uint32_t maxCost, bool bPrefixMatch = false) { - priority_queue<impl::MatchCostData, buffer_vector<impl::MatchCostData, 256> > q; + std::priority_queue<impl::MatchCostData, buffer_vector<impl::MatchCostData, 256> > q; q.push(impl::MatchCostData(0, 0, 0)); while (!q.empty()) { @@ -89,5 +88,4 @@ uint32_t StringMatchCost(CharT const * sA, size_t sizeA, } return maxCost + 1; } - } // namespace search diff --git a/search/cancel_exception.hpp b/search/cancel_exception.hpp index dd45a8c8b5..6907b4cc57 100644 --- a/search/cancel_exception.hpp +++ b/search/cancel_exception.hpp @@ -3,8 +3,6 @@ #include "base/cancellable.hpp" #include "base/exception.hpp" -#include "std/string.hpp" - namespace search { // This exception can be thrown from the deep darkness of search and diff --git a/search/dummy_rank_table.cpp b/search/dummy_rank_table.cpp index 173d5802b3..9d54b9f220 100644 --- a/search/dummy_rank_table.cpp +++ b/search/dummy_rank_table.cpp @@ -2,7 +2,7 @@ #include "base/macros.hpp" -#include "std/limits.hpp" +#include <limits> namespace search { @@ -11,7 +11,7 @@ uint8_t DummyRankTable::Get(uint64_t /* i */) const { return 0; } uint64_t DummyRankTable::Size() const { NOTIMPLEMENTED(); - return numeric_limits<uint64_t>::max(); + return std::numeric_limits<uint64_t>::max(); } RankTable::Version DummyRankTable::GetVersion() const diff --git a/search/dummy_rank_table.hpp b/search/dummy_rank_table.hpp index 212a991a87..7065a7b875 100644 --- a/search/dummy_rank_table.hpp +++ b/search/dummy_rank_table.hpp @@ -2,6 +2,8 @@ #include "indexer/rank_table.hpp" +#include <cstdint> + namespace search { // This dummy rank table is used instead of a normal rank table when diff --git a/search/editor_delegate.cpp b/search/editor_delegate.cpp index ace89a9ca4..d90a6111ab 100644 --- a/search/editor_delegate.cpp +++ b/search/editor_delegate.cpp @@ -7,6 +7,8 @@ #include "indexer/data_source_helpers.hpp" #include "indexer/feature_decl.hpp" +using namespace std; + namespace search { EditorDelegate::EditorDelegate(DataSource const & dataSource) : m_dataSource(dataSource) {} diff --git a/search/editor_delegate.hpp b/search/editor_delegate.hpp index 76ba3562b5..8a653a7e12 100644 --- a/search/editor_delegate.hpp +++ b/search/editor_delegate.hpp @@ -2,6 +2,9 @@ #include "editor/osm_editor.hpp" +#include <memory> +#include <string> + class DataSource; namespace search @@ -12,9 +15,9 @@ public: EditorDelegate(DataSource const & dataSource); // osm::Editor::Delegate overrides: - MwmSet::MwmId GetMwmIdByMapName(string const & name) const override; - unique_ptr<FeatureType> GetOriginalFeature(FeatureID const & fid) const override; - string GetOriginalFeatureStreet(FeatureType & ft) const override; + MwmSet::MwmId GetMwmIdByMapName(std::string const & name) const override; + std::unique_ptr<FeatureType> GetOriginalFeature(FeatureID const & fid) const override; + std::string GetOriginalFeatureStreet(FeatureType & ft) const override; void ForEachFeatureAtPoint(osm::Editor::FeatureTypeFn && fn, m2::PointD const & point) const override; diff --git a/search/emitter.hpp b/search/emitter.hpp index baffc8ca03..9b7474be13 100644 --- a/search/emitter.hpp +++ b/search/emitter.hpp @@ -5,6 +5,8 @@ #include "base/logging.hpp" +#include <utility> + namespace search { namespace bookmarks @@ -21,8 +23,8 @@ public: m_results.Clear(); } - bool AddResult(Result && res) { return m_results.AddResult(move(res)); } - void AddResultNoChecks(Result && res) { m_results.AddResultNoChecks(move(res)); } + bool AddResult(Result && res) { return m_results.AddResult(std::move(res)); } + void AddResultNoChecks(Result && res) { m_results.AddResultNoChecks(std::move(res)); } void AddBookmarkResult(bookmarks::Result const & result) { m_results.AddBookmarkResult(result); } diff --git a/search/engine.hpp b/search/engine.hpp index 813b918591..02b29ef998 100644 --- a/search/engine.hpp +++ b/search/engine.hpp @@ -10,7 +10,6 @@ #include "coding/reader.hpp" #include "base/macros.hpp" -#include "base/mutex.hpp" #include "base/thread.hpp" #include <condition_variable> diff --git a/search/feature_loader.cpp b/search/feature_loader.cpp index f8bef30368..0529f246f3 100644 --- a/search/feature_loader.cpp +++ b/search/feature_loader.cpp @@ -4,8 +4,6 @@ #include "indexer/feature_decl.hpp" -#include <memory> - namespace search { FeatureLoader::FeatureLoader(DataSource const & dataSource) : m_dataSource(dataSource) {} diff --git a/search/features_filter.cpp b/search/features_filter.cpp index 0065e8dcd4..b5444db6d0 100644 --- a/search/features_filter.cpp +++ b/search/features_filter.cpp @@ -2,9 +2,6 @@ #include "search/cbv.hpp" -#include "std/algorithm.hpp" -#include "std/vector.hpp" - namespace search { // FeaturesFilter ---------------------------------------------------------------------------------- diff --git a/search/features_filter.hpp b/search/features_filter.hpp index 02c76d1db4..1972ce2b1a 100644 --- a/search/features_filter.hpp +++ b/search/features_filter.hpp @@ -1,6 +1,7 @@ #pragma once -#include "std/unique_ptr.hpp" +#include <cstdint> +#include <memory> namespace search { @@ -49,5 +50,4 @@ public: // FeaturesFilter overrides: CBV Filter(CBV const & cbv) const override; }; - } // namespace search diff --git a/search/features_layer.hpp b/search/features_layer.hpp index fa695f956f..5610278d07 100644 --- a/search/features_layer.hpp +++ b/search/features_layer.hpp @@ -5,7 +5,8 @@ #include "base/string_utils.hpp" -#include "std/vector.hpp" +#include <cstdint> +#include <vector> namespace search { @@ -19,7 +20,7 @@ struct FeaturesLayer void Clear(); // Non-owning ptr to a sorted vector of features. - vector<uint32_t> const * m_sortedFeatures; + std::vector<uint32_t> const * m_sortedFeatures; strings::UniString m_subQuery; diff --git a/search/features_layer_matcher.cpp b/search/features_layer_matcher.cpp index d5704ea769..97f9f1c4b8 100644 --- a/search/features_layer_matcher.cpp +++ b/search/features_layer_matcher.cpp @@ -7,6 +7,8 @@ #include "base/assert.hpp" +#include <string> + namespace search { /// Max distance from house to street where we do search matching @@ -91,7 +93,7 @@ FeaturesLayerMatcher::TStreets const & FeaturesLayerMatcher::GetNearbyStreetsImp uint32_t FeaturesLayerMatcher::GetMatchingStreetImpl(uint32_t houseId, FeatureType & houseFeature) { // Check if this feature is modified - the logic will be different. - string streetName; + std::string streetName; bool const edited = osm::Editor::Instance().GetEditedFeatureStreet(houseFeature.GetID(), streetName); diff --git a/search/features_layer_matcher.hpp b/search/features_layer_matcher.hpp index 325450622d..ea2601f557 100644 --- a/search/features_layer_matcher.hpp +++ b/search/features_layer_matcher.hpp @@ -29,12 +29,14 @@ #include "base/stl_helpers.hpp" #include "base/string_utils.hpp" -#include "std/algorithm.hpp" -#include "std/bind.hpp" -#include "std/limits.hpp" -#include "std/unordered_map.hpp" -#include "std/utility.hpp" -#include "std/vector.hpp" +#include <algorithm> +#include <cstddef> +#include <cstdint> +#include <functional> +#include <limits> +#include <unordered_map> +#include <utility> +#include <vector> class DataSource; @@ -58,7 +60,7 @@ namespace search class FeaturesLayerMatcher { public: - static uint32_t const kInvalidId = numeric_limits<uint32_t>::max(); + static uint32_t const kInvalidId = std::numeric_limits<uint32_t>::max(); static int constexpr kBuildingRadiusMeters = 50; static int constexpr kStreetRadiusMeters = 100; @@ -84,15 +86,15 @@ public: break; case Model::TYPE_BUILDING: ASSERT_EQUAL(child.m_type, Model::TYPE_POI, ()); - MatchPOIsWithBuildings(child, parent, forward<TFn>(fn)); + MatchPOIsWithBuildings(child, parent, std::forward<TFn>(fn)); break; case Model::TYPE_STREET: ASSERT(child.m_type == Model::TYPE_POI || child.m_type == Model::TYPE_BUILDING, ("Invalid child layer type:", child.m_type)); if (child.m_type == Model::TYPE_POI) - MatchPOIsWithStreets(child, parent, forward<TFn>(fn)); + MatchPOIsWithStreets(child, parent, std::forward<TFn>(fn)); else - MatchBuildingsWithStreets(child, parent, forward<TFn>(fn)); + MatchBuildingsWithStreets(child, parent, std::forward<TFn>(fn)); break; } } @@ -115,7 +117,7 @@ private: BailIfCancelled(m_cancellable); - vector<PointRectMatcher::PointIdPair> poiCenters; + std::vector<PointRectMatcher::PointIdPair> poiCenters; poiCenters.reserve(pois.size()); for (size_t i = 0; i < pois.size(); ++i) @@ -125,7 +127,7 @@ private: poiCenters.emplace_back(feature::GetCenter(poiFt, FeatureType::WORST_GEOMETRY), i /* id */); } - vector<PointRectMatcher::RectIdPair> buildingRects; + std::vector<PointRectMatcher::RectIdPair> buildingRects; buildingRects.reserve(buildings.size()); for (size_t i = 0; i < buildings.size(); ++i) { @@ -160,7 +162,7 @@ private: // |buildings| doesn't contain buildings matching by house number, // so following code reads buildings in POIs vicinities and checks // house numbers. - vector<house_numbers::Token> queryParse; + std::vector<house_numbers::Token> queryParse; ParseQuery(parent.m_subQuery, parent.m_lastTokenIsPrefix, queryParse); if (queryParse.empty()) return; @@ -195,7 +197,7 @@ private: auto const & pois = *child.m_sortedFeatures; auto const & streets = *parent.m_sortedFeatures; - vector<PointRectMatcher::PointIdPair> poiCenters; + std::vector<PointRectMatcher::PointIdPair> poiCenters; poiCenters.reserve(pois.size()); for (size_t i = 0; i < pois.size(); ++i) @@ -205,10 +207,10 @@ private: poiCenters.emplace_back(feature::GetCenter(poiFt, FeatureType::WORST_GEOMETRY), i /* id */); } - vector<PointRectMatcher::RectIdPair> streetRects; + std::vector<PointRectMatcher::RectIdPair> streetRects; streetRects.reserve(streets.size()); - vector<ProjectionOnStreetCalculator> streetProjectors; + std::vector<ProjectionOnStreetCalculator> streetProjectors; streetProjectors.reserve(streets.size()); for (size_t i = 0; i < streets.size(); ++i) @@ -277,13 +279,13 @@ private: for (uint32_t const houseId : buildings) { uint32_t const streetId = GetMatchingStreet(houseId); - if (binary_search(streets.begin(), streets.end(), streetId)) + if (std::binary_search(streets.begin(), streets.end(), streetId)) fn(houseId, streetId); } return; } - vector<house_numbers::Token> queryParse; + std::vector<house_numbers::Token> queryParse; ParseQuery(child.m_subQuery, child.m_lastTokenIsPrefix, queryParse); uint32_t numFilterInvocations = 0; @@ -311,7 +313,7 @@ private: return house_numbers::HouseNumbersMatch(houseNumber, queryParse); }; - unordered_map<uint32_t, bool> cache; + std::unordered_map<uint32_t, bool> cache; auto cachingHouseNumberFilter = [&](uint32_t id, FeatureType & feature, bool & loaded) -> bool { auto const it = cache.find(id); if (it != cache.cend()) @@ -352,7 +354,7 @@ private: uint32_t GetMatchingStreetImpl(uint32_t houseId, FeatureType & houseFeature); using TStreet = ReverseGeocoder::Street; - using TStreets = vector<TStreet>; + using TStreets = std::vector<TStreet>; TStreets const & GetNearbyStreets(uint32_t featureId); TStreets const & GetNearbyStreets(uint32_t featureId, FeatureType & feature); diff --git a/search/geocoder.cpp b/search/geocoder.cpp index 5eb5ab1d8e..6777fb26c3 100644 --- a/search/geocoder.cpp +++ b/search/geocoder.cpp @@ -40,13 +40,12 @@ #include "base/scope_guard.hpp" #include "base/stl_helpers.hpp" -#include "std/algorithm.hpp" -#include "std/bind.hpp" -#include "std/iterator.hpp" -#include "std/random.hpp" -#include "std/sstream.hpp" -#include "std/transform_iterator.hpp" -#include "std/unique_ptr.hpp" +#include <algorithm> +#include <functional> +#include <iterator> +#include <memory> +#include <random> +#include <sstream> #include "defines.hpp" @@ -54,8 +53,7 @@ #include "base/timer.hpp" #endif -#include <memory> - +using namespace std; using namespace strings; namespace search diff --git a/search/geocoder.hpp b/search/geocoder.hpp index d87d1d3f6b..cfd2057f1f 100644 --- a/search/geocoder.hpp +++ b/search/geocoder.hpp @@ -37,12 +37,13 @@ #include "base/macros.hpp" #include "base/string_utils.hpp" -#include "std/limits.hpp" -#include "std/shared_ptr.hpp" -#include "std/string.hpp" -#include "std/unique_ptr.hpp" -#include "std/unordered_map.hpp" -#include "std/vector.hpp" +#include <cstddef> +#include <cstdint> +#include <limits> +#include <memory> +#include <string> +#include <unordered_map> +#include <vector> #include <boost/optional.hpp> @@ -87,10 +88,10 @@ public: m2::RectD m_pivot; boost::optional<m2::PointD> m_position; Locales m_categoryLocales; - shared_ptr<hotels_filter::Rule> m_hotelsFilter; - vector<uint32_t> m_cuisineTypes; - vector<uint32_t> m_preferredTypes; - shared_ptr<Tracer> m_tracer; + std::shared_ptr<hotels_filter::Rule> m_hotelsFilter; + std::vector<uint32_t> m_cuisineTypes; + std::vector<uint32_t> m_preferredTypes; + std::shared_ptr<Tracer> m_tracer; }; Geocoder(DataSource const & dataSource, storage::CountryInfoGetter const & infoGetter, @@ -145,10 +146,10 @@ private: // Sets search query params for categorial search. void SetParamsForCategorialSearch(Params const & params); - void GoImpl(vector<shared_ptr<MwmInfo>> & infos, bool inViewport); + void GoImpl(std::vector<std::shared_ptr<MwmInfo>> & infos, bool inViewport); template <typename Locality> - using TokenToLocalities = map<TokenRange, vector<Locality>>; + using TokenToLocalities = std::map<TokenRange, vector<Locality>>; QueryParams::Token const & GetTokens(size_t i) const; @@ -160,14 +161,14 @@ private: void FillLocalityCandidates(BaseContext const & ctx, CBV const & filter, size_t const maxNumLocalities, - vector<Locality> & preLocalities); + std::vector<Locality> & preLocalities); void FillLocalitiesTable(BaseContext const & ctx); void FillVillageLocalities(BaseContext const & ctx); template <typename TFn> - void ForEachCountry(vector<shared_ptr<MwmInfo>> const & infos, TFn && fn); + void ForEachCountry(std::vector<std::shared_ptr<MwmInfo>> const & infos, TFn && fn); // Throws CancelException if cancelled. inline void BailIfCancelled() { ::search::BailIfCancelled(m_cancellable); } @@ -212,7 +213,7 @@ private: // Returns true if current path in the search tree (see comment for // MatchPOIsAndBuildings()) looks sane. This method is used as a fast // pre-check to cut off unnecessary work. - bool IsLayerSequenceSane(vector<FeaturesLayer> const & layers) const; + bool IsLayerSequenceSane(std::vector<FeaturesLayer> const & layers) const; // Finds all paths through layers and emits reachable features from // the lowest layer. @@ -273,7 +274,7 @@ private: MwmSet::MwmId m_worldId; // Context of the currently processed mwm. - unique_ptr<MwmContext> m_context; + std::unique_ptr<MwmContext> m_context; // m_cities stores both big cities that are visible at World.mwm // and small villages and hamlets that are not. @@ -294,14 +295,14 @@ private: FeaturesFilter const * m_filter; // Features matcher for layers intersection. - map<MwmSet::MwmId, unique_ptr<FeaturesLayerMatcher>> m_matchersCache; + std::map<MwmSet::MwmId, unique_ptr<FeaturesLayerMatcher>> m_matchersCache; FeaturesLayerMatcher * m_matcher; // Path finder for interpretations. FeaturesLayerPathFinder m_finder; // Search query params prepared for retrieval. - vector<SearchTrieRequest<strings::LevenshteinDFA>> m_tokenRequests; + std::vector<SearchTrieRequest<strings::LevenshteinDFA>> m_tokenRequests; SearchTrieRequest<strings::PrefixDFAModifier<strings::LevenshteinDFA>> m_prefixTokenRequest; PreRanker & m_preRanker; diff --git a/search/geometry_cache.cpp b/search/geometry_cache.cpp index c8b5814d37..27e1d06026 100644 --- a/search/geometry_cache.cpp +++ b/search/geometry_cache.cpp @@ -73,5 +73,4 @@ CBV LocalityRectsCache::Get(MwmContext const & context, m2::RectD const & rect, InitEntry(context, rect, scale, entry); return entry.m_cbv; } - } // namespace search diff --git a/search/geometry_cache.hpp b/search/geometry_cache.hpp index 2455930c02..b19a8efa95 100644 --- a/search/geometry_cache.hpp +++ b/search/geometry_cache.hpp @@ -8,12 +8,12 @@ #include "base/assert.hpp" -#include "std/algorithm.hpp" -#include "std/cstdint.hpp" -#include "std/deque.hpp" -#include "std/map.hpp" -#include "std/unique_ptr.hpp" -#include "std/utility.hpp" +#include <algorithm> +#include <cstdint> +#include <deque> +#include <map> +#include <memory> +#include <utility> namespace base { @@ -52,15 +52,15 @@ protected: GeometryCache(size_t maxNumEntries, base::Cancellable const & cancellable); template <typename TPred> - pair<Entry &, bool> FindOrCreateEntry(MwmSet::MwmId const & id, TPred && pred) + std::pair<Entry &, bool> FindOrCreateEntry(MwmSet::MwmId const & id, TPred && pred) { auto & entries = m_entries[id]; - auto it = find_if(entries.begin(), entries.end(), forward<TPred>(pred)); + auto it = find_if(entries.begin(), entries.end(), std::forward<TPred>(pred)); if (it != entries.end()) { if (it != entries.begin()) iter_swap(entries.begin(), it); - return pair<Entry &, bool>(entries.front(), false); + return std::pair<Entry &, bool>(entries.front(), false); } entries.emplace_front(); @@ -69,12 +69,12 @@ protected: ASSERT_LESS_OR_EQUAL(entries.size(), m_maxNumEntries, ()); ASSERT(!entries.empty(), ()); - return pair<Entry &, bool>(entries.front(), true); + return std::pair<Entry &, bool>(entries.front(), true); } void InitEntry(MwmContext const & context, m2::RectD const & rect, int scale, Entry & entry); - map<MwmSet::MwmId, deque<Entry>> m_entries; + std::map<MwmSet::MwmId, std::deque<Entry>> m_entries; size_t const m_maxNumEntries; base::Cancellable const & m_cancellable; }; @@ -100,5 +100,4 @@ public: // GeometryCache overrides: CBV Get(MwmContext const & context, m2::RectD const & rect, int scale) override; }; - } // namespace search diff --git a/search/highlighting.hpp b/search/highlighting.hpp index 6580cdcf6b..0b16c0fb03 100644 --- a/search/highlighting.hpp +++ b/search/highlighting.hpp @@ -7,6 +7,7 @@ #include "base/string_utils.hpp" +#include <cstdint> #include <string> #include <utility> diff --git a/search/hotels_classifier.cpp b/search/hotels_classifier.cpp index 5e9f924725..5ac5fe964a 100644 --- a/search/hotels_classifier.cpp +++ b/search/hotels_classifier.cpp @@ -2,8 +2,6 @@ #include "search/result.hpp" -#include "std/cstdint.hpp" - namespace search { // static diff --git a/search/hotels_filter.cpp b/search/hotels_filter.cpp index 84cb6bf7e7..04f15ff0ea 100644 --- a/search/hotels_filter.cpp +++ b/search/hotels_filter.cpp @@ -7,7 +7,9 @@ #include "base/assert.hpp" #include "base/checked_cast.hpp" -#include "std/algorithm.hpp" +#include <algorithm> + +using namespace std; namespace search { diff --git a/search/hotels_filter.hpp b/search/hotels_filter.hpp index 2ad8bbb02c..0714c4bd98 100644 --- a/search/hotels_filter.hpp +++ b/search/hotels_filter.hpp @@ -7,13 +7,12 @@ #include "indexer/ftypes_matcher.hpp" #include "indexer/mwm_set.hpp" -#include "std/map.hpp" -#include "std/shared_ptr.hpp" -#include "std/sstream.hpp" -#include "std/string.hpp" -#include "std/unique_ptr.hpp" -#include "std/utility.hpp" -#include "std/vector.hpp" +#include <map> +#include <memory> +#include <sstream> +#include <string> +#include <utility> +#include <vector> class FeatureType; @@ -72,14 +71,14 @@ struct Rule { virtual ~Rule() = default; - static bool IsIdentical(shared_ptr<Rule> const & lhs, shared_ptr<Rule> const & rhs); + static bool IsIdentical(std::shared_ptr<Rule> const & lhs, std::shared_ptr<Rule> const & rhs); virtual bool Matches(Description const & d) const = 0; virtual bool IdenticalTo(Rule const & rhs) const = 0; - virtual string ToString() const = 0; + virtual std::string ToString() const = 0; }; -string DebugPrint(Rule const & rule); +std::string DebugPrint(Rule const & rule); template <typename Field> struct EqRule final : public Rule @@ -100,9 +99,9 @@ struct EqRule final : public Rule return r && Field::Eq(r->m_value, m_value); } - string ToString() const override + std::string ToString() const override { - ostringstream os; + std::ostringstream os; os << "[ " << Field::Name() << " == " << m_value << " ]"; return os.str(); } @@ -129,9 +128,9 @@ struct LtRule final : public Rule return r && Field::Eq(r->m_value, m_value); } - string ToString() const override + std::string ToString() const override { - ostringstream os; + std::ostringstream os; os << "[ " << Field::Name() << " < " << m_value << " ]"; return os.str(); } @@ -159,9 +158,9 @@ struct LeRule final : public Rule return r && Field::Eq(r->m_value, m_value); } - string ToString() const override + std::string ToString() const override { - ostringstream os; + std::ostringstream os; os << "[ " << Field::Name() << " <= " << m_value << " ]"; return os.str(); } @@ -188,9 +187,9 @@ struct GtRule final : public Rule return r && Field::Eq(r->m_value, m_value); } - string ToString() const override + std::string ToString() const override { - ostringstream os; + std::ostringstream os; os << "[ " << Field::Name() << " > " << m_value << " ]"; return os.str(); } @@ -218,9 +217,9 @@ struct GeRule final : public Rule return r && Field::Eq(r->m_value, m_value); } - string ToString() const override + std::string ToString() const override { - ostringstream os; + std::ostringstream os; os << "[ " << Field::Name() << " >= " << m_value << " ]"; return os.str(); } @@ -230,7 +229,7 @@ struct GeRule final : public Rule struct AndRule final : public Rule { - AndRule(shared_ptr<Rule> lhs, shared_ptr<Rule> rhs) : m_lhs(move(lhs)), m_rhs(move(rhs)) {} + AndRule(std::shared_ptr<Rule> lhs, std::shared_ptr<Rule> rhs) : m_lhs(move(lhs)), m_rhs(move(rhs)) {} // Rule overrides: bool Matches(Description const & d) const override @@ -249,9 +248,9 @@ struct AndRule final : public Rule return r && IsIdentical(m_lhs, r->m_lhs) && IsIdentical(m_rhs, r->m_rhs); } - string ToString() const override + std::string ToString() const override { - ostringstream os; + std::ostringstream os; os << "["; os << (m_lhs ? m_lhs->ToString() : "<none>"); os << " && "; @@ -260,13 +259,13 @@ struct AndRule final : public Rule return os.str(); } - shared_ptr<Rule> m_lhs; - shared_ptr<Rule> m_rhs; + std::shared_ptr<Rule> m_lhs; + std::shared_ptr<Rule> m_rhs; }; struct OrRule final : public Rule { - OrRule(shared_ptr<Rule> lhs, shared_ptr<Rule> rhs) : m_lhs(move(lhs)), m_rhs(move(rhs)) {} + OrRule(std::shared_ptr<Rule> lhs, std::shared_ptr<Rule> rhs) : m_lhs(move(lhs)), m_rhs(move(rhs)) {} // Rule overrides: bool Matches(Description const & d) const override @@ -285,9 +284,9 @@ struct OrRule final : public Rule return r && IsIdentical(m_lhs, r->m_lhs) && IsIdentical(m_rhs, r->m_rhs); } - string ToString() const override + std::string ToString() const override { - ostringstream os; + std::ostringstream os; os << "["; os << (m_lhs ? m_lhs->ToString() : "<none>"); os << " || "; @@ -296,8 +295,8 @@ struct OrRule final : public Rule return os.str(); } - shared_ptr<Rule> m_lhs; - shared_ptr<Rule> m_rhs; + std::shared_ptr<Rule> m_lhs; + std::shared_ptr<Rule> m_rhs; }; struct OneOfRule final : public Rule @@ -313,9 +312,9 @@ struct OneOfRule final : public Rule return r && m_types == r->m_types; } - string ToString() const override + std::string ToString() const override { - ostringstream os; + std::ostringstream os; os << "[ one of:"; for (size_t i = 0; i < static_cast<size_t>(ftypes::IsHotelChecker::Type::Count); ++i) { @@ -334,75 +333,75 @@ struct OneOfRule final : public Rule }; template <typename Field> -shared_ptr<Rule> Eq(typename Field::Value value) +std::shared_ptr<Rule> Eq(typename Field::Value value) { - return make_shared<EqRule<Field>>(value); + return std::make_shared<EqRule<Field>>(value); } template <typename Field> -shared_ptr<Rule> Lt(typename Field::Value value) +std::shared_ptr<Rule> Lt(typename Field::Value value) { - return make_shared<LtRule<Field>>(value); + return std::make_shared<LtRule<Field>>(value); } template <typename Field> -shared_ptr<Rule> Le(typename Field::Value value) +std::shared_ptr<Rule> Le(typename Field::Value value) { - return make_shared<LeRule<Field>>(value); + return std::make_shared<LeRule<Field>>(value); } template <typename Field> -inline shared_ptr<Rule> Gt(typename Field::Value value) +inline std::shared_ptr<Rule> Gt(typename Field::Value value) { - return make_shared<GtRule<Field>>(value); + return std::make_shared<GtRule<Field>>(value); } template <typename Field> -shared_ptr<Rule> Ge(typename Field::Value value) +std::shared_ptr<Rule> Ge(typename Field::Value value) { - return make_shared<GeRule<Field>>(value); + return std::make_shared<GeRule<Field>>(value); } -inline shared_ptr<Rule> And(shared_ptr<Rule> lhs, shared_ptr<Rule> rhs) +inline std::shared_ptr<Rule> And(std::shared_ptr<Rule> lhs, std::shared_ptr<Rule> rhs) { - return make_shared<AndRule>(lhs, rhs); + return std::make_shared<AndRule>(lhs, rhs); } -inline shared_ptr<Rule> Or(shared_ptr<Rule> lhs, shared_ptr<Rule> rhs) +inline std::shared_ptr<Rule> Or(std::shared_ptr<Rule> lhs, std::shared_ptr<Rule> rhs) { - return make_shared<OrRule>(lhs, rhs); + return std::make_shared<OrRule>(lhs, rhs); } -inline shared_ptr<Rule> Is(ftypes::IsHotelChecker::Type type) +inline std::shared_ptr<Rule> Is(ftypes::IsHotelChecker::Type type) { CHECK(type != ftypes::IsHotelChecker::Type::Count, ()); - return make_shared<OneOfRule>(1U << static_cast<unsigned>(type)); + return std::make_shared<OneOfRule>(1U << static_cast<unsigned>(type)); } -inline shared_ptr<Rule> OneOf(unsigned types) { return make_shared<OneOfRule>(types); } +inline std::shared_ptr<Rule> OneOf(unsigned types) { return std::make_shared<OneOfRule>(types); } class HotelsFilter { public: - using Descriptions = vector<pair<uint32_t, Description>>; + using Descriptions = std::vector<std::pair<uint32_t, Description>>; class ScopedFilter { public: ScopedFilter(MwmSet::MwmId const & mwmId, Descriptions const & descriptions, - shared_ptr<Rule> rule); + std::shared_ptr<Rule> rule); bool Matches(FeatureID const & fid) const; private: MwmSet::MwmId const m_mwmId; Descriptions const & m_descriptions; - shared_ptr<Rule> const m_rule; + std::shared_ptr<Rule> const m_rule; }; HotelsFilter(HotelsCache & hotels); - unique_ptr<ScopedFilter> MakeScopedFilter(MwmContext const & context, shared_ptr<Rule> rule); + std::unique_ptr<ScopedFilter> MakeScopedFilter(MwmContext const & context, std::shared_ptr<Rule> rule); void ClearCaches(); @@ -410,7 +409,7 @@ private: Descriptions const & GetDescriptions(MwmContext const & context); HotelsCache & m_hotels; - map<MwmSet::MwmId, Descriptions> m_descriptions; + std::map<MwmSet::MwmId, Descriptions> m_descriptions; }; } // namespace hotels_filter } // namespace search diff --git a/search/house_numbers_matcher.cpp b/search/house_numbers_matcher.cpp index 2c5dc75e1e..45a94eace9 100644 --- a/search/house_numbers_matcher.cpp +++ b/search/house_numbers_matcher.cpp @@ -4,12 +4,14 @@ #include "base/logging.hpp" -#include "std/algorithm.hpp" -#include "std/iterator.hpp" -#include "std/limits.hpp" -#include "std/sstream.hpp" +#include <algorithm> +#include <iterator> +#include <limits> +#include <sstream> + #include "std/transform_iterator.hpp" +using namespace std; using namespace strings; namespace search diff --git a/search/house_numbers_matcher.hpp b/search/house_numbers_matcher.hpp index c30fc1acaa..a32cfc7200 100644 --- a/search/house_numbers_matcher.hpp +++ b/search/house_numbers_matcher.hpp @@ -2,9 +2,9 @@ #include "base/string_utils.hpp" -#include "std/string.hpp" -#include "std/utility.hpp" -#include "std/vector.hpp" +#include <string> +#include <utility> +#include <vector> namespace search { @@ -27,7 +27,7 @@ struct Token Token() = default; Token(strings::UniString const & value, Type type) : m_value(value), m_type(type) {} - Token(strings::UniString && value, Type type) : m_value(move(value)), m_type(type) {} + Token(strings::UniString && value, Type type) : m_value(std::move(value)), m_type(type) {} Token(Token &&) = default; Token & operator=(Token &&) = default; @@ -53,27 +53,27 @@ struct Token }; // Tokenizes |s| that may be a house number. -void Tokenize(strings::UniString s, bool isPrefix, vector<Token> & ts); +void Tokenize(strings::UniString s, bool isPrefix, std::vector<Token> & ts); // Parses a string that can be one or more house numbers. This method // can be used to parse addr:housenumber fields. -void ParseHouseNumber(strings::UniString const & s, vector<vector<Token>> & parses); +void ParseHouseNumber(strings::UniString const & s, std::vector<std::vector<Token>> & parses); // Parses a part of search query that can be a house number. -void ParseQuery(strings::UniString const & query, bool queryIsPrefix, vector<Token> & parse); +void ParseQuery(strings::UniString const & query, bool queryIsPrefix, std::vector<Token> & parse); // Returns true if house number matches to a given query. bool HouseNumbersMatch(strings::UniString const & houseNumber, strings::UniString const & query, bool queryIsPrefix); // Returns true if house number matches to a given parsed query. -bool HouseNumbersMatch(strings::UniString const & houseNumber, vector<Token> const & queryParse); +bool HouseNumbersMatch(strings::UniString const & houseNumber, std::vector<Token> const & queryParse); // Returns true if |s| looks like a house number. bool LooksLikeHouseNumber(strings::UniString const & s, bool isPrefix); -string DebugPrint(Token::Type type); +std::string DebugPrint(Token::Type type); -string DebugPrint(Token const & token); +std::string DebugPrint(Token const & token); } // namespace house_numbers } // namespace search diff --git a/search/house_to_street_table.cpp b/search/house_to_street_table.cpp index 868bbb5fa8..abdf44552a 100644 --- a/search/house_to_street_table.cpp +++ b/search/house_to_street_table.cpp @@ -11,8 +11,12 @@ #include "base/assert.hpp" #include "base/checked_cast.hpp" +#include <vector> + #include "defines.hpp" +using namespace std; + namespace search { namespace diff --git a/search/house_to_street_table.hpp b/search/house_to_street_table.hpp index 47ad9682cb..d5ec9a2f1d 100644 --- a/search/house_to_street_table.hpp +++ b/search/house_to_street_table.hpp @@ -1,7 +1,7 @@ #pragma once -#include "std/limits.hpp" -#include "std/unique_ptr.hpp" +#include <cstdint> +#include <memory> class MwmValue; @@ -25,7 +25,7 @@ public: /// @todo Actually, value may be nullptr in the very common case. /// It's better to construct a table from MwmHandle. - static unique_ptr<HouseToStreetTable> Load(MwmValue & value); + static std::unique_ptr<HouseToStreetTable> Load(MwmValue & value); // Returns true and stores street identifier to |streetIndex|. // Street identifier type depends on data version. See StreetIdType. @@ -34,5 +34,4 @@ public: virtual StreetIdType GetStreetIdType() const = 0; }; - } // namespace search diff --git a/search/interval_set.hpp b/search/interval_set.hpp index 775112c48a..13a6cd0765 100644 --- a/search/interval_set.hpp +++ b/search/interval_set.hpp @@ -1,9 +1,9 @@ #pragma once -#include "std/algorithm.hpp" -#include "std/set.hpp" -#include "std/utility.hpp" -#include "std/vector.hpp" +#include <algorithm> +#include <set> +#include <utility> +#include <vector> // todo(@m) Move to search/base? namespace search @@ -16,7 +16,7 @@ template <typename Elem> class IntervalSet { public: - using Interval = pair<Elem, Elem>; + using Interval = std::pair<Elem, Elem>; // Adds an |interval| to the set, coalescing adjacent intervals if needed. // @@ -29,21 +29,21 @@ public: // // Complexity: O(num of intervals intersecting with |interval| + // log(total number of intervals)). - void SubtractFrom(Interval const & interval, vector<Interval> & difference) const; + void SubtractFrom(Interval const & interval, std::vector<Interval> & difference) const; // Returns all elements of the set as a set of intervals. // // Complexity: O(1). - inline set<Interval> const & Elems() const { return m_intervals; } + inline std::set<Interval> const & Elems() const { return m_intervals; } private: - using Iterator = typename set<Interval>::iterator; + using Iterator = typename std::set<Interval>::iterator; // Calculates range of intervals that have non-empty intersection with a given |interval|. void Cover(Interval const & interval, Iterator & begin, Iterator & end) const; // This is a set of disjoint intervals. - set<Interval> m_intervals; + std::set<Interval> m_intervals; }; template <typename Elem> @@ -98,7 +98,7 @@ void IntervalSet<Elem>::Add(Interval const & interval) template <typename Elem> void IntervalSet<Elem>::SubtractFrom(Interval const & interval, - vector<Interval> & difference) const + std::vector<Interval> & difference) const { Iterator begin; Iterator end; @@ -117,7 +117,7 @@ void IntervalSet<Elem>::SubtractFrom(Interval const & interval, } else { - from = max(from, it->second); + from = std::max(from, it->second); } } @@ -131,7 +131,7 @@ void IntervalSet<Elem>::Cover(Interval const & interval, Iterator & begin, Itera Elem const & from = interval.first; Elem const & to = interval.second; - begin = m_intervals.lower_bound(make_pair(from, from)); + begin = m_intervals.lower_bound(std::make_pair(from, from)); if (begin != m_intervals.begin()) { auto prev = begin; @@ -140,6 +140,6 @@ void IntervalSet<Elem>::Cover(Interval const & interval, Iterator & begin, Itera begin = prev; } - end = m_intervals.lower_bound(make_pair(to, to)); + end = m_intervals.lower_bound(std::make_pair(to, to)); } } // namespace search diff --git a/search/keyword_lang_matcher.hpp b/search/keyword_lang_matcher.hpp index 16acde9022..623662399d 100644 --- a/search/keyword_lang_matcher.hpp +++ b/search/keyword_lang_matcher.hpp @@ -5,6 +5,7 @@ #include "base/string_utils.hpp" #include <array> +#include <cstdint> #include <string> #include <utility> #include <vector> diff --git a/search/lazy_centers_table.cpp b/search/lazy_centers_table.cpp index 59995a945b..ce32678650 100644 --- a/search/lazy_centers_table.cpp +++ b/search/lazy_centers_table.cpp @@ -9,7 +9,7 @@ namespace search LazyCentersTable::LazyCentersTable(MwmValue & value) : m_value(value) , m_state(STATE_NOT_LOADED) - , m_reader(unique_ptr<ModelReader>()) + , m_reader(std::unique_ptr<ModelReader>()) { } diff --git a/search/lazy_centers_table.hpp b/search/lazy_centers_table.hpp index 694d08867f..1009c3b7ab 100644 --- a/search/lazy_centers_table.hpp +++ b/search/lazy_centers_table.hpp @@ -6,7 +6,8 @@ #include "geometry/point2d.hpp" -#include "std/unique_ptr.hpp" +#include <cstdint> +#include <memory> class MwmValue; @@ -35,6 +36,6 @@ private: State m_state; FilesContainerR::TReader m_reader; - unique_ptr<CentersTable> m_table; + std::unique_ptr<CentersTable> m_table; }; } // namespace search diff --git a/search/locality_finder.hpp b/search/locality_finder.hpp index 56d510bbf7..83e2581b32 100644 --- a/search/locality_finder.hpp +++ b/search/locality_finder.hpp @@ -20,6 +20,7 @@ #include <limits> #include <map> #include <memory> +#include <string> #include <unordered_set> #include <utility> @@ -36,14 +37,14 @@ struct LocalityItem LocalityItem(StringUtf8Multilang const & names, m2::PointD const & center, Boundaries const & boundaries, uint64_t population, FeatureID const & id); - bool GetName(int8_t lang, string & name) const { return m_names.GetString(lang, name); } + bool GetName(int8_t lang, std::string & name) const { return m_names.GetString(lang, name); } - bool GetSpecifiedOrDefaultName(int8_t lang, string & name) const + bool GetSpecifiedOrDefaultName(int8_t lang, std::string & name) const { return GetName(lang, name) || GetName(StringUtf8Multilang::kDefaultCode, name); } - bool GetReadableName(string & name) const + bool GetReadableName(std::string & name) const { auto const mwmInfo = m_id.m_mwmId.GetInfo(); @@ -64,7 +65,7 @@ struct LocalityItem FeatureID m_id; }; -string DebugPrint(LocalityItem const & item); +std::string DebugPrint(LocalityItem const & item); class LocalitySelector { diff --git a/search/mode.cpp b/search/mode.cpp index d511d8987c..96de4dc280 100644 --- a/search/mode.cpp +++ b/search/mode.cpp @@ -2,7 +2,7 @@ namespace search { -string DebugPrint(Mode mode) +std::string DebugPrint(Mode mode) { switch (mode) { diff --git a/search/mode.hpp b/search/mode.hpp index df682bd7c4..a4a536c52b 100644 --- a/search/mode.hpp +++ b/search/mode.hpp @@ -1,6 +1,6 @@ #pragma once -#include "std/string.hpp" +#include <string> namespace search { @@ -13,5 +13,5 @@ enum class Mode Count }; -string DebugPrint(Mode mode); +std::string DebugPrint(Mode mode); } // namespace search diff --git a/search/model.cpp b/search/model.cpp index 0f5f048130..5476c3b14b 100644 --- a/search/model.cpp +++ b/search/model.cpp @@ -114,7 +114,7 @@ Model::Type Model::GetType(FeatureType & feature) const return TYPE_UNCLASSIFIED; } -string DebugPrint(Model::Type type) +std::string DebugPrint(Model::Type type) { switch (type) { @@ -129,6 +129,6 @@ string DebugPrint(Model::Type type) case Model::TYPE_COUNT: return "Count"; } ASSERT(false, ("Unknown search type:", static_cast<int>(type))); - return string(); + return {}; } } // namespace search diff --git a/search/model.hpp b/search/model.hpp index 5938d8e8df..abc34b412c 100644 --- a/search/model.hpp +++ b/search/model.hpp @@ -2,11 +2,10 @@ #include "indexer/ftypes_matcher.hpp" -#include "std/string.hpp" -#include "std/vector.hpp" - #include "base/macros.hpp" +#include <string> + class FeatureType; namespace search @@ -56,5 +55,5 @@ public: Type GetType(FeatureType & feature) const; }; -string DebugPrint(Model::Type type); +std::string DebugPrint(Model::Type type); } // namespace search diff --git a/search/mwm_context.hpp b/search/mwm_context.hpp index ef85e37101..35f801518f 100644 --- a/search/mwm_context.hpp +++ b/search/mwm_context.hpp @@ -14,9 +14,9 @@ #include "base/macros.hpp" -#include "std/shared_ptr.hpp" -#include "std/string.hpp" -#include "std/unique_ptr.hpp" +#include <cstdint> +#include <memory> +#include <string> class MwmValue; @@ -33,7 +33,7 @@ public: inline MwmSet::MwmId const & GetId() const { return m_handle.GetId(); } inline string const & GetName() const { return GetInfo()->GetCountryName(); } - inline shared_ptr<MwmInfo> const & GetInfo() const { return GetId().GetInfo(); } + inline std::shared_ptr<MwmInfo> const & GetInfo() const { return GetId().GetInfo(); } template <typename TFn> void ForEachIndex(covering::Intervals const & intervals, uint32_t scale, TFn && fn) const diff --git a/search/nested_rects_cache.cpp b/search/nested_rects_cache.cpp index 4ebc5b3253..809c17477e 100644 --- a/search/nested_rects_cache.cpp +++ b/search/nested_rects_cache.cpp @@ -10,7 +10,7 @@ #include "base/assert.hpp" #include "base/stl_helpers.hpp" -#include "std/algorithm.hpp" +#include <algorithm> namespace search { @@ -57,8 +57,8 @@ double NestedRectsCache::GetDistanceToFeatureMeters(FeatureID const & id) const if (auto const & info = id.m_mwmId.GetInfo()) { auto const & rect = info->m_bordersRect; - return max(MercatorBounds::DistanceOnEarth(rect.Center(), m_position), - GetRadiusMeters(static_cast<RectScale>(scale))); + return std::max(MercatorBounds::DistanceOnEarth(rect.Center(), m_position), + GetRadiusMeters(static_cast<RectScale>(scale))); } return RankingInfo::kMaxDistMeters; @@ -110,7 +110,7 @@ void NestedRectsCache::Update() }; m_dataSource.ForEachFeatureIDInRect(addId, rect, m_scale); for (auto & kv : bucket) - sort(kv.second.begin(), kv.second.end()); + std::sort(kv.second.begin(), kv.second.end()); } m_valid = true; diff --git a/search/nested_rects_cache.hpp b/search/nested_rects_cache.hpp index 829132b730..bb10d519b2 100644 --- a/search/nested_rects_cache.hpp +++ b/search/nested_rects_cache.hpp @@ -4,8 +4,9 @@ #include "geometry/point2d.hpp" -#include "std/map.hpp" -#include "std/vector.hpp" +#include <cstdint> +#include <map> +#include <vector> class DataSource; @@ -42,8 +43,8 @@ private: m2::PointD m_position; bool m_valid; - using TFeatures = vector<uint32_t>; - using TBucket = map<MwmSet::MwmId, TFeatures>; + using TFeatures = std::vector<uint32_t>; + using TBucket = std::map<MwmSet::MwmId, TFeatures>; // Sorted lists of features. TBucket m_buckets[RECT_SCALE_COUNT]; diff --git a/search/point_rect_matcher.hpp b/search/point_rect_matcher.hpp index bb08ca6e03..dc062d646d 100644 --- a/search/point_rect_matcher.hpp +++ b/search/point_rect_matcher.hpp @@ -6,6 +6,8 @@ #include "geometry/rect2d.hpp" #include <algorithm> +#include <cstddef> +#include <cstdint> #include <sstream> #include <string> #include <vector> diff --git a/search/pre_ranker.hpp b/search/pre_ranker.hpp index 354a169b88..3995388724 100644 --- a/search/pre_ranker.hpp +++ b/search/pre_ranker.hpp @@ -9,12 +9,12 @@ #include "base/macros.hpp" -#include "std/algorithm.hpp" -#include "std/cstdint.hpp" -#include "std/random.hpp" -#include "std/set.hpp" -#include "std/utility.hpp" -#include "std/vector.hpp" +#include <algorithm> +#include <cstddef> +#include <random> +#include <set> +#include <utility> +#include <vector> #include <boost/optional.hpp> @@ -66,7 +66,7 @@ public: { if (m_numSentResults >= Limit()) return; - m_results.emplace_back(forward<TArgs>(args)...); + m_results.emplace_back(std::forward<TArgs>(args)...); } // Computes missing fields for all pre-results. @@ -86,7 +86,7 @@ public: template <typename TFn> void ForEach(TFn && fn) { - for_each(m_results.begin(), m_results.end(), forward<TFn>(fn)); + std::for_each(m_results.begin(), m_results.end(), std::forward<TFn>(fn)); } void ClearCaches(); @@ -96,7 +96,7 @@ private: DataSource const & m_dataSource; Ranker & m_ranker; - vector<PreRankerResult> m_results; + std::vector<PreRankerResult> m_results; Params m_params; // Amount of results sent up the pipeline. @@ -106,15 +106,15 @@ private: NestedRectsCache m_pivotFeatures; // A set of ids for features that are emitted during the current search session. - set<FeatureID> m_currEmit; + std::set<FeatureID> m_currEmit; // A set of ids for features that were emitted during the previous // search session. They're used for filtering of current search in // viewport results, because we need to give more priority to // results that were on map previously. - set<FeatureID> m_prevEmit; + std::set<FeatureID> m_prevEmit; - minstd_rand m_rng; + std::minstd_rand m_rng; DISALLOW_COPY_AND_MOVE(PreRanker); }; diff --git a/search/projection_on_street.hpp b/search/projection_on_street.hpp index f27afa5104..d7cd99c9c6 100644 --- a/search/projection_on_street.hpp +++ b/search/projection_on_street.hpp @@ -3,7 +3,8 @@ #include "geometry/parametrized_segment.hpp" #include "geometry/point2d.hpp" -#include "std/vector.hpp" +#include <cstddef> +#include <vector> namespace search { @@ -29,7 +30,7 @@ struct ProjectionOnStreet class ProjectionOnStreetCalculator { public: - explicit ProjectionOnStreetCalculator(vector<m2::PointD> const & points); + explicit ProjectionOnStreetCalculator(std::vector<m2::PointD> const & points); // Finds nearest point on the street to the |point|. If such point // is located within |m_maxDistMeters|, stores projection in |proj| @@ -38,6 +39,6 @@ public: bool GetProjection(m2::PointD const & point, ProjectionOnStreet & proj) const; private: - vector<m2::ParametrizedSegment<m2::PointD>> m_segments; + std::vector<m2::ParametrizedSegment<m2::PointD>> m_segments; }; } // namespace search diff --git a/search/query_params.hpp b/search/query_params.hpp index 049c0f7de9..1a21f3660b 100644 --- a/search/query_params.hpp +++ b/search/query_params.hpp @@ -9,6 +9,7 @@ #include "base/string_utils.hpp" #include <algorithm> +#include <cstddef> #include <cstdint> #include <string> #include <type_traits> diff --git a/search/query_saver.cpp b/search/query_saver.cpp index 4e15acc6cf..aad31edc40 100644 --- a/search/query_saver.cpp +++ b/search/query_saver.cpp @@ -10,7 +10,12 @@ #include "base/logging.hpp" #include "base/string_utils.hpp" -#include "std/limits.hpp" +#include <cstdint> +#include <cstring> +#include <limits> +#include <memory> + +using namespace std; namespace { @@ -61,7 +66,6 @@ private: char const * m_pData; size_t m_size; }; - } // namespace namespace search diff --git a/search/query_saver.hpp b/search/query_saver.hpp index 5c93f1b1c3..57f36468cd 100644 --- a/search/query_saver.hpp +++ b/search/query_saver.hpp @@ -1,9 +1,9 @@ #pragma once -#include "std/list.hpp" -#include "std/string.hpp" -#include "std/vector.hpp" -#include "std/utility.hpp" +#include <list> +#include <string> +#include <utility> +#include <vector> namespace search { @@ -12,24 +12,28 @@ class QuerySaver { public: /// Search request <locale, request>. - using TSearchRequest = pair<string, string>; + using TSearchRequest = std::pair<std::string, std::string>; + QuerySaver(); + void Add(TSearchRequest const & query); + /// Returns several last saved queries from newest to oldest query. /// @see kMaxSuggestCount in implementation file. - list<TSearchRequest> const & Get() const { return m_topQueries; } + std::list<TSearchRequest> const & Get() const { return m_topQueries; } + /// Clear last queries storage. All data will be lost. void Clear(); private: friend void UnitTest_QuerySaverSerializerTest(); friend void UnitTest_QuerySaverCorruptedStringTest(); - void Serialize(string & data) const; - void Deserialize(string const & data); + void Serialize(std::string & data) const; + void Deserialize(std::string const & data); void Save(); void Load(); - list<TSearchRequest> m_topQueries; + std::list<TSearchRequest> m_topQueries; }; } // namespace search diff --git a/search/rank_table_cache.hpp b/search/rank_table_cache.hpp index b76c867133..fbf5efca3d 100644 --- a/search/rank_table_cache.hpp +++ b/search/rank_table_cache.hpp @@ -45,5 +45,4 @@ private: DISALLOW_COPY_AND_MOVE(RankTableCache); }; - } // namespace search diff --git a/search/ranking_utils.hpp b/search/ranking_utils.hpp index 11c6083ebd..8e75807c12 100644 --- a/search/ranking_utils.hpp +++ b/search/ranking_utils.hpp @@ -12,7 +12,7 @@ #include "base/string_utils.hpp" #include <algorithm> -#include <cstdint> +#include <cstddef> #include <limits> #include <string> #include <vector> diff --git a/search/region_info_getter.hpp b/search/region_info_getter.hpp index 29f7e53ad5..5aae0b470b 100644 --- a/search/region_info_getter.hpp +++ b/search/region_info_getter.hpp @@ -1,13 +1,13 @@ #pragma once -#include <memory> -#include <string> - #include "storage/country.hpp" #include "storage/storage_defines.hpp" #include "platform/get_text_by_id.hpp" +#include <memory> +#include <string> + namespace search { class RegionInfoGetter diff --git a/search/retrieval.cpp b/search/retrieval.cpp index 12a0d94392..38d0795239 100644 --- a/search/retrieval.cpp +++ b/search/retrieval.cpp @@ -25,10 +25,15 @@ #include "base/checked_cast.hpp" #include "base/control_flow.hpp" +#include "base/macros.hpp" -#include "std/algorithm.hpp" -#include "std/utility.hpp" +#include <algorithm> +#include <cstddef> +#include <cstdint> +#include <utility> +#include <vector> +using namespace std; using namespace strings; using osm::Editor; diff --git a/search/retrieval.hpp b/search/retrieval.hpp index ba8b320e06..44bd321533 100644 --- a/search/retrieval.hpp +++ b/search/retrieval.hpp @@ -13,7 +13,7 @@ #include "base/dfa_helpers.hpp" #include "base/levenshtein_dfa.hpp" -#include "std/unique_ptr.hpp" +#include <memory> class MwmValue; @@ -37,29 +37,29 @@ public: // Following functions retrieve from the search index corresponding to // |value| all features matching to |request|. - unique_ptr<coding::CompressedBitVector> RetrieveAddressFeatures( + std::unique_ptr<coding::CompressedBitVector> RetrieveAddressFeatures( SearchTrieRequest<strings::UniStringDFA> const & request) const; - unique_ptr<coding::CompressedBitVector> RetrieveAddressFeatures( + std::unique_ptr<coding::CompressedBitVector> RetrieveAddressFeatures( SearchTrieRequest<strings::PrefixDFAModifier<strings::UniStringDFA>> const & request) const; - unique_ptr<coding::CompressedBitVector> RetrieveAddressFeatures( + std::unique_ptr<coding::CompressedBitVector> RetrieveAddressFeatures( SearchTrieRequest<strings::LevenshteinDFA> const & request) const; - unique_ptr<coding::CompressedBitVector> RetrieveAddressFeatures( + std::unique_ptr<coding::CompressedBitVector> RetrieveAddressFeatures( SearchTrieRequest<strings::PrefixDFAModifier<strings::LevenshteinDFA>> const & request) const; // Retrieves from the search index corresponding to |value| all // postcodes matching to |slice|. - unique_ptr<coding::CompressedBitVector> RetrievePostcodeFeatures(TokenSlice const & slice) const; + std::unique_ptr<coding::CompressedBitVector> RetrievePostcodeFeatures(TokenSlice const & slice) const; // Retrieves from the geometry index corresponding to |value| all features belonging to |rect|. - unique_ptr<coding::CompressedBitVector> RetrieveGeometryFeatures(m2::RectD const & rect, - int scale) const; + std::unique_ptr<coding::CompressedBitVector> RetrieveGeometryFeatures(m2::RectD const & rect, + int scale) const; private: template <template <typename> class R, typename... Args> - unique_ptr<coding::CompressedBitVector> Retrieve(Args &&... args) const; + std::unique_ptr<coding::CompressedBitVector> Retrieve(Args &&... args) const; MwmContext const & m_context; base::Cancellable const & m_cancellable; @@ -67,7 +67,7 @@ private: version::MwmTraits::SearchIndexFormat m_format; - unique_ptr<TrieRoot<FeatureWithRankAndCenter>> m_root0; - unique_ptr<TrieRoot<FeatureIndexValue>> m_root1; + std::unique_ptr<TrieRoot<FeatureWithRankAndCenter>> m_root0; + std::unique_ptr<TrieRoot<FeatureIndexValue>> m_root1; }; } // namespace search diff --git a/search/reverse_geocoder.cpp b/search/reverse_geocoder.cpp index 9f8312db9c..793f195f70 100644 --- a/search/reverse_geocoder.cpp +++ b/search/reverse_geocoder.cpp @@ -13,6 +13,8 @@ #include "base/stl_helpers.hpp" +#include <algorithm> +#include <cstddef> #include <functional> #include <limits> diff --git a/search/reverse_geocoder.hpp b/search/reverse_geocoder.hpp index 7902df8c2e..736458710f 100644 --- a/search/reverse_geocoder.hpp +++ b/search/reverse_geocoder.hpp @@ -6,7 +6,6 @@ #include "base/string_utils.hpp" -#include <cstddef> #include <cstdint> #include <memory> #include <string> diff --git a/search/search_integration_tests/downloader_search_test.cpp b/search/search_integration_tests/downloader_search_test.cpp index db563ef6ea..4cfe30f3eb 100644 --- a/search/search_integration_tests/downloader_search_test.cpp +++ b/search/search_integration_tests/downloader_search_test.cpp @@ -18,9 +18,11 @@ #include "base/logging.hpp" #include "base/macros.hpp" -#include "std/algorithm.hpp" -#include "std/bind.hpp" -#include "std/string.hpp" +#include <algorithm> +#include <functional> +#include <memory> +#include <string> +#include <vector> using namespace generator::tests_support; using namespace search::tests_support; diff --git a/search/search_integration_tests/generate_tests.cpp b/search/search_integration_tests/generate_tests.cpp index 1ad4f31467..045421a3b7 100644 --- a/search/search_integration_tests/generate_tests.cpp +++ b/search/search_integration_tests/generate_tests.cpp @@ -21,6 +21,8 @@ #include <string> #include <utility> +#include "std/initializer_list.hpp" + using namespace generator::tests_support; using namespace std; diff --git a/search/search_integration_tests/pre_ranker_test.cpp b/search/search_integration_tests/pre_ranker_test.cpp index 1bd90d291b..3e801db30e 100644 --- a/search/search_integration_tests/pre_ranker_test.cpp +++ b/search/search_integration_tests/pre_ranker_test.cpp @@ -31,12 +31,13 @@ #include "base/math.hpp" #include "base/stl_helpers.hpp" -#include "std/algorithm.hpp" -#include "std/iterator.hpp" -#include "std/vector.hpp" +#include <algorithm> +#include <iterator> +#include <vector> using namespace generator::tests_support; using namespace search::tests_support; +using namespace std; class DataSource; diff --git a/search/search_integration_tests/processor_test.cpp b/search/search_integration_tests/processor_test.cpp index aebe1bc081..b8be26ccb2 100644 --- a/search/search_integration_tests/processor_test.cpp +++ b/search/search_integration_tests/processor_test.cpp @@ -29,11 +29,13 @@ #include "base/scope_guard.hpp" #include "base/string_utils.hpp" -#include "std/shared_ptr.hpp" -#include "std/vector.hpp" +#include <memory> +#include <string> +#include <vector> using namespace generator::tests_support; using namespace search::tests_support; +using namespace std; namespace search { diff --git a/search/search_integration_tests/search_edited_features_test.cpp b/search/search_integration_tests/search_edited_features_test.cpp index 4f12bf99da..c3498b9dd5 100644 --- a/search/search_integration_tests/search_edited_features_test.cpp +++ b/search/search_integration_tests/search_edited_features_test.cpp @@ -12,11 +12,12 @@ #include "coding/string_utf8_multilang.hpp" -#include "std/shared_ptr.hpp" +#include <memory> using namespace generator::tests_support; using namespace search::tests_support; using namespace search; +using namespace std; namespace { diff --git a/search/search_params.hpp b/search/search_params.hpp index 6e6e361008..dd151003e2 100644 --- a/search/search_params.hpp +++ b/search/search_params.hpp @@ -24,8 +24,8 @@ struct SearchParams static size_t const kDefaultNumResultsEverywhere = 30; static size_t const kDefaultNumResultsInViewport = 200; - using OnStarted = function<void()>; - using OnResults = function<void(Results const &)>; + using OnStarted = std::function<void()>; + using OnResults = std::function<void(Results const &)>; bool IsEqualCommon(SearchParams const & rhs) const; diff --git a/search/search_quality/assessment_tool/main_model.hpp b/search/search_quality/assessment_tool/main_model.hpp index 31a39aac15..b2e7d2469e 100644 --- a/search/search_quality/assessment_tool/main_model.hpp +++ b/search/search_quality/assessment_tool/main_model.hpp @@ -10,9 +10,10 @@ #include "base/thread_checker.hpp" +#include <cstddef> #include <cstdint> -#include <vector> #include <memory> +#include <vector> #include <boost/optional.hpp> diff --git a/search/search_quality/features_collector_tool/features_collector_tool.cpp b/search/search_quality/features_collector_tool/features_collector_tool.cpp index 4bd027d3b4..db92f2e903 100644 --- a/search/search_quality/features_collector_tool/features_collector_tool.cpp +++ b/search/search_quality/features_collector_tool/features_collector_tool.cpp @@ -25,12 +25,13 @@ #include "base/macros.hpp" #include "base/string_utils.hpp" -#include "std/fstream.hpp" -#include "std/iostream.hpp" -#include "std/limits.hpp" -#include "std/string.hpp" -#include "std/unique_ptr.hpp" -#include "std/vector.hpp" +#include <cstddef> +#include <fstream> +#include <iostream> +#include <limits> +#include <memory> +#include <string> +#include <vector> #include "defines.hpp" @@ -38,6 +39,7 @@ using namespace search::tests_support; using namespace search; +using namespace std; using namespace storage; DEFINE_string(data_path, "", "Path to data directory (resources dir)"); diff --git a/search/search_quality/matcher.hpp b/search/search_quality/matcher.hpp index 802f09c460..09dcc04d41 100644 --- a/search/search_quality/matcher.hpp +++ b/search/search_quality/matcher.hpp @@ -3,7 +3,7 @@ #include "search/result.hpp" #include "search/search_quality/sample.hpp" -#include <cstdint> +#include <cstddef> #include <limits> #include <vector> diff --git a/search/search_quality/sample.cpp b/search/search_quality/sample.cpp index 2f8ace2f91..e676d8db0f 100644 --- a/search/search_quality/sample.cpp +++ b/search/search_quality/sample.cpp @@ -35,7 +35,7 @@ bool LessRect(m2::RectD const & lhs, m2::RectD const & rhs) } template <typename T> -bool Less(std::vector<T> lhs, std::vector<T> rhs) +bool Less(vector<T> lhs, vector<T> rhs) { sort(lhs.begin(), lhs.end()); sort(rhs.begin(), rhs.end()); @@ -43,7 +43,7 @@ bool Less(std::vector<T> lhs, std::vector<T> rhs) } template <typename T> -bool Equal(std::vector<T> lhs, std::vector<T> rhs) +bool Equal(vector<T> lhs, vector<T> rhs) { sort(lhs.begin(), lhs.end()); sort(rhs.begin(), rhs.end()); @@ -131,7 +131,7 @@ bool Sample::operator<(Sample const & rhs) const bool Sample::operator==(Sample const & rhs) const { return !(*this < rhs) && !(rhs < *this); } // static -bool Sample::DeserializeFromJSONLines(string const & lines, std::vector<Sample> & samples) +bool Sample::DeserializeFromJSONLines(string const & lines, vector<Sample> & samples) { istringstream is(lines); string line; @@ -153,7 +153,7 @@ bool Sample::DeserializeFromJSONLines(string const & lines, std::vector<Sample> } // static -void Sample::SerializeToJSONLines(std::vector<Sample> const & samples, std::string & lines) +void Sample::SerializeToJSONLines(vector<Sample> const & samples, string & lines) { for (auto const & sample : samples) { 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 9d1444a3be..b0d3de4c31 100644 --- a/search/search_quality/search_quality_tool/search_quality_tool.cpp +++ b/search/search_quality/search_quality_tool/search_quality_tool.cpp @@ -32,18 +32,18 @@ #include "base/string_utils.hpp" #include "base/timer.hpp" -#include "std/algorithm.hpp" -#include "std/cmath.hpp" -#include "std/cstdio.hpp" -#include "std/fstream.hpp" -#include "std/iomanip.hpp" -#include "std/iostream.hpp" -#include "std/limits.hpp" -#include "std/map.hpp" -#include "std/numeric.hpp" -#include "std/sstream.hpp" -#include "std/string.hpp" -#include "std/vector.hpp" +#include <algorithm> +#include <cmath> +#include <cstdio> +#include <fstream> +#include <iomanip> +#include <iostream> +#include <limits> +#include <map> +#include <numeric> +#include <sstream> +#include <string> +#include <vector> #include "defines.hpp" @@ -51,6 +51,7 @@ using namespace search::tests_support; using namespace search; +using namespace std; using namespace storage; DEFINE_string(data_path, "", "Path to data directory (resources dir)"); diff --git a/search/search_tests/algos_tests.cpp b/search/search_tests/algos_tests.cpp index db4c4cb4dc..4c7d33afce 100644 --- a/search/search_tests/algos_tests.cpp +++ b/search/search_tests/algos_tests.cpp @@ -2,13 +2,14 @@ #include "search/algos.hpp" -#include "std/algorithm.hpp" -#include "std/iterator.hpp" +#include <algorithm> +#include <iterator> +#include <vector> +using namespace std; namespace { - struct CompWithEqual { bool Less(int i1, int i2) const { return i1 <= i2; } @@ -22,8 +23,7 @@ void TestLongestSequence(int in[], size_t inSz, int eta[]) reverse(res.begin(), res.end()); TEST(equal(res.begin(), res.end(), eta), (res)); } - -} +} // namespace UNIT_TEST(LS_Smoke) { diff --git a/search/search_tests/highlighting_tests.cpp b/search/search_tests/highlighting_tests.cpp index 6f753facc5..19fd3b6d68 100644 --- a/search/search_tests/highlighting_tests.cpp +++ b/search/search_tests/highlighting_tests.cpp @@ -7,10 +7,12 @@ #include "base/logging.hpp" #include "base/string_utils.hpp" -#include "std/cstdarg.hpp" -#include "std/string.hpp" -#include "std/utility.hpp" -#include "std/vector.hpp" +#include <cstdarg> +#include <string> +#include <utility> +#include <vector> + +using namespace std; namespace { diff --git a/search/search_tests/house_detector_tests.cpp b/search/search_tests/house_detector_tests.cpp index 279c1e7099..c0dea587e0 100644 --- a/search/search_tests/house_detector_tests.cpp +++ b/search/search_tests/house_detector_tests.cpp @@ -17,10 +17,14 @@ #include "base/logging.hpp" -#include "std/iostream.hpp" -#include "std/fstream.hpp" - - +#include <algorithm> +#include <cstddef> +#include <fstream> +#include <map> +#include <string> +#include <vector> + +using namespace std; using platform::LocalCountryFile; class StreetIDsByName @@ -338,7 +342,7 @@ string GetStreetKey(string const & name) { return strings::ToUtf8(search::GetStreetNameAsKey(name, false /* ignoreStreetSynonyms */)); } -} // namespace +} // namespace UNIT_TEST(HS_StreetKey) { @@ -351,7 +355,6 @@ UNIT_TEST(HS_StreetKey) namespace { - struct Address { string m_streetKey; @@ -368,8 +371,7 @@ void swap(Address & a1, Address & a2) std::swap(a1.m_lat, a2.m_lat); std::swap(a1.m_lon, a2.m_lon); } - -} +} // namespace UNIT_TEST(HS_MWMSearch) { diff --git a/search/search_tests/house_numbers_matcher_test.cpp b/search/search_tests/house_numbers_matcher_test.cpp index 02efe6eda1..3272855c07 100644 --- a/search/search_tests/house_numbers_matcher_test.cpp +++ b/search/search_tests/house_numbers_matcher_test.cpp @@ -2,13 +2,15 @@ #include "search/house_numbers_matcher.hpp" -#include "std/vector.hpp" +#include <string> +#include <vector> #include "base/string_utils.hpp" using namespace search::house_numbers; using namespace search; using namespace strings; +using namespace std; namespace { diff --git a/search/search_tests/locality_finder_test.cpp b/search/search_tests/locality_finder_test.cpp index 3db7bfccdb..7bc59d9022 100644 --- a/search/search_tests/locality_finder_test.cpp +++ b/search/search_tests/locality_finder_test.cpp @@ -16,6 +16,9 @@ #include "base/cancellable.hpp" +#include <string> +#include <vector> + namespace { class LocalityFinderTest : public generator::tests_support::TestWithClassificator @@ -61,11 +64,11 @@ public: platform::CountryIndexes::DeleteFromDisk(m_worldFile); } - void RunTests(vector<ms::LatLon> const & input, char const * results[]) + void RunTests(std::vector<ms::LatLon> const & input, char const * results[]) { for (size_t i = 0; i < input.size(); ++i) { - string result; + std::string result; m_finder.GetLocality( MercatorBounds::FromLatLon(input[i]), [&](search::LocalityItem const & item) { item.GetSpecifiedOrDefaultName(StringUtf8Multilang::kEnglishCode, result); @@ -82,7 +85,7 @@ public: UNIT_CLASS_TEST(LocalityFinderTest, Smoke) { - vector<ms::LatLon> input; + std::vector<ms::LatLon> input; input.emplace_back(53.8993094, 27.5433964); // Minsk input.emplace_back(48.856517, 2.3521); // Paris input.emplace_back(52.5193859, 13.3908289); // Berlin @@ -125,7 +128,7 @@ UNIT_CLASS_TEST(LocalityFinderTest, Smoke) UNIT_CLASS_TEST(LocalityFinderTest, Moscow) { - vector<ms::LatLon> input; + std::vector<ms::LatLon> input; input.emplace_back(55.80166, 37.54066); // Krasnoarmeyskaya 30 char const * results[] = diff --git a/search/search_tests/locality_scorer_test.cpp b/search/search_tests/locality_scorer_test.cpp index 81194c85d3..60ebcad617 100644 --- a/search/search_tests/locality_scorer_test.cpp +++ b/search/search_tests/locality_scorer_test.cpp @@ -15,6 +15,7 @@ #include "base/string_utils.hpp" #include <algorithm> +#include <cstdint> #include <set> #include <unordered_map> #include <vector> diff --git a/search/search_tests/locality_selector_test.cpp b/search/search_tests/locality_selector_test.cpp index d2d00b8b10..408fc3fa7b 100644 --- a/search/search_tests/locality_selector_test.cpp +++ b/search/search_tests/locality_selector_test.cpp @@ -4,7 +4,10 @@ #include "base/string_utils.hpp" +#include <string> + using namespace search; +using namespace std; namespace { diff --git a/search/search_tests/query_saver_tests.cpp b/search/search_tests/query_saver_tests.cpp index e9177b2049..e79f686b6f 100644 --- a/search/search_tests/query_saver_tests.cpp +++ b/search/search_tests/query_saver_tests.cpp @@ -2,8 +2,10 @@ #include "search/query_saver.hpp" -#include "std/string.hpp" -#include "std/vector.hpp" +#include <list> +#include <string> + +using namespace std; namespace { diff --git a/search/search_tests/ranking_tests.cpp b/search/search_tests/ranking_tests.cpp index 20ace7246e..fed39c23dd 100644 --- a/search/search_tests/ranking_tests.cpp +++ b/search/search_tests/ranking_tests.cpp @@ -11,10 +11,11 @@ #include "base/stl_helpers.hpp" #include "base/string_utils.hpp" -#include "std/cstdint.hpp" -#include "std/string.hpp" +#include <cstdint> +#include <string> using namespace search; +using namespace std; using namespace strings; namespace diff --git a/search/search_tests/segment_tree_tests.cpp b/search/search_tests/segment_tree_tests.cpp index 704e011bf6..23594104c5 100644 --- a/search/search_tests/segment_tree_tests.cpp +++ b/search/search_tests/segment_tree_tests.cpp @@ -5,6 +5,7 @@ #include "base/assert.hpp" #include <algorithm> +#include <cstddef> #include <initializer_list> #include <limits> #include <set> diff --git a/search/search_tests_support/test_search_request.cpp b/search/search_tests_support/test_search_request.cpp index bbf1d8a6c5..921266180f 100644 --- a/search/search_tests_support/test_search_request.cpp +++ b/search/search_tests_support/test_search_request.cpp @@ -5,10 +5,12 @@ #include "geometry/latlon.hpp" #include "geometry/mercator.hpp" +#include "base/assert.hpp" #include "base/logging.hpp" #include <functional> +using namespace std::chrono; using namespace std; namespace search diff --git a/search/search_tests_support/test_search_request.hpp b/search/search_tests_support/test_search_request.hpp index 9f686cf8be..6172716e42 100644 --- a/search/search_tests_support/test_search_request.hpp +++ b/search/search_tests_support/test_search_request.hpp @@ -5,13 +5,14 @@ #include "search/result.hpp" #include "search/search_params.hpp" -#include "std/condition_variable.hpp" -#include "std/mutex.hpp" -#include "std/string.hpp" -#include "std/vector.hpp" - #include "base/timer.hpp" +#include <chrono> +#include <condition_variable> +#include <mutex> +#include <string> +#include <vector> + namespace search { namespace tests_support @@ -24,7 +25,7 @@ class TestSearchEngine; class TestSearchRequest { public: - TestSearchRequest(TestSearchEngine & engine, string const & query, string const & locale, + TestSearchRequest(TestSearchEngine & engine, std::string const & query, std::string const & locale, Mode mode, m2::RectD const & viewport); TestSearchRequest(TestSearchEngine & engine, SearchParams const & params); @@ -32,11 +33,11 @@ public: void Run(); // Call these functions only after call to Wait(). - steady_clock::duration ResponseTime() const; - vector<search::Result> const & Results() const; + std::chrono::steady_clock::duration ResponseTime() const; + std::vector<search::Result> const & Results() const; protected: - TestSearchRequest(TestSearchEngine & engine, string const & query, string const & locale, + TestSearchRequest(TestSearchEngine & engine, std::string const & query, std::string const & locale, Mode mode, m2::RectD const & viewport, SearchParams::OnStarted const & onStarted, SearchParams::OnResults const & onResults); @@ -56,15 +57,15 @@ protected: // Overrides the default onResults callback. void SetCustomOnResults(SearchParams::OnResults const & onResults); - condition_variable m_cv; - mutable mutex m_mu; + std::condition_variable m_cv; + mutable std::mutex m_mu; - vector<search::Result> m_results; + std::vector<search::Result> m_results; bool m_done = false; base::Timer m_timer; - steady_clock::duration m_startTime; - steady_clock::duration m_endTime; + std::chrono::steady_clock::duration m_startTime; + std::chrono::steady_clock::duration m_endTime; TestSearchEngine & m_engine; SearchParams m_params; diff --git a/search/search_trie.hpp b/search/search_trie.hpp index ed180e8292..b257761d63 100644 --- a/search/search_trie.hpp +++ b/search/search_trie.hpp @@ -3,6 +3,8 @@ #include "coding/geometry_coding.hpp" #include "coding/point_coding.hpp" +#include <cstdint> + namespace search { static const uint8_t kCategoriesLang = 128; diff --git a/search/stats_cache.hpp b/search/stats_cache.hpp index 946e12a7c7..db04e4878c 100644 --- a/search/stats_cache.hpp +++ b/search/stats_cache.hpp @@ -1,30 +1,33 @@ #pragma once + #include "base/logging.hpp" -#include "std/unordered_map.hpp" -#include "std/utility.hpp" +#include <cstddef> +#include <string> +#include <unordered_map> +#include <utility> namespace search { template <class TKey, class TValue> class Cache { - unordered_map<TKey, TValue> m_map; + std::unordered_map<TKey, TValue> m_map; /// query statistics size_t m_accesses; size_t m_misses; - size_t m_emptyQueriesCount; /// empty queries count at a row - string m_name; /// cache name for print functions + std::size_t m_emptyQueriesCount; /// empty queries count at a row + std::string m_name; /// cache name for print functions public: - explicit Cache(string const & name) + explicit Cache(std::string const & name) : m_accesses(0), m_misses(0), m_emptyQueriesCount(0), m_name(name) { } - pair<TValue &, bool> Get(TKey const & key) + std::pair<TValue &, bool> Get(TKey const & key) { auto r = m_map.insert(make_pair(key, TValue())); @@ -32,7 +35,7 @@ public: if (r.second) ++m_misses; - return pair<TValue &, bool>(r.first->second, r.second); + return std::pair<TValue &, bool>(r.first->second, r.second); } void Clear() @@ -59,5 +62,4 @@ public: } } }; - } // namespace search diff --git a/search/street_vicinity_loader.cpp b/search/street_vicinity_loader.cpp index 0fd8560848..fbe9ab5041 100644 --- a/search/street_vicinity_loader.cpp +++ b/search/street_vicinity_loader.cpp @@ -11,6 +11,8 @@ #include "base/math.hpp" #include "base/stl_helpers.hpp" +using namespace std; + namespace search { StreetVicinityLoader::StreetVicinityLoader(int scale, double offsetMeters) @@ -74,5 +76,4 @@ void StreetVicinityLoader::LoadStreet(uint32_t featureId, Street & street) street.m_calculator = make_unique<ProjectionOnStreetCalculator>(points); } - } // namespace search diff --git a/search/street_vicinity_loader.hpp b/search/street_vicinity_loader.hpp index 3f3598054d..0f8c4ae19f 100644 --- a/search/street_vicinity_loader.hpp +++ b/search/street_vicinity_loader.hpp @@ -11,7 +11,11 @@ #include "base/macros.hpp" -#include "std/unordered_map.hpp" +#include <algorithm> +#include <cstdint> +#include <memory> +#include <unordered_map> +#include <vector> namespace search { @@ -30,9 +34,9 @@ public: inline bool IsEmpty() const { return !m_calculator || m_rect.IsEmptyInterior(); } - vector<uint32_t> m_features; + std::vector<uint32_t> m_features; m2::RectD m_rect; - unique_ptr<ProjectionOnStreetCalculator> m_calculator; + std::unique_ptr<ProjectionOnStreetCalculator> m_calculator; /// @todo Cache GetProjection results for features here, because /// feature::GetCenter and ProjectionOnStreetCalculator::GetProjection are not so fast. @@ -46,7 +50,7 @@ public: // Calls |fn| on each index in |sortedIds| where sortedIds[index] // belongs to the street's vicinity. template <typename TFn> - void ForEachInVicinity(uint32_t streetId, vector<uint32_t> const & sortedIds, double offsetMeters, + void ForEachInVicinity(uint32_t streetId, std::vector<uint32_t> const & sortedIds, double offsetMeters, TFn const & fn) { // Passed offset param should be less than the cached one, or the cache is invalid otherwise. @@ -61,7 +65,7 @@ public: for (uint32_t id : street.m_features) { // Load center and check projection only when |id| is in |sortedIds|. - if (!binary_search(sortedIds.begin(), sortedIds.end(), id)) + if (!std::binary_search(sortedIds.begin(), sortedIds.end(), id)) continue; FeatureType ft; @@ -91,5 +95,4 @@ private: DISALLOW_COPY_AND_MOVE(StreetVicinityLoader); }; - } // namespace search diff --git a/search/streets_matcher.cpp b/search/streets_matcher.cpp index ad2cd6e18f..b4914fa309 100644 --- a/search/streets_matcher.cpp +++ b/search/streets_matcher.cpp @@ -8,6 +8,8 @@ #include "base/logging.hpp" #include "base/stl_helpers.hpp" +using namespace std; + namespace search { namespace diff --git a/search/streets_matcher.hpp b/search/streets_matcher.hpp index e81881592d..8e88cec96c 100644 --- a/search/streets_matcher.hpp +++ b/search/streets_matcher.hpp @@ -4,7 +4,8 @@ #include "search/geocoder_context.hpp" #include "search/token_range.hpp" -#include "std/vector.hpp" +#include <cstddef> +#include <vector> namespace search { @@ -25,10 +26,10 @@ public: }; static void Go(BaseContext const & ctx, FeaturesFilter const & filter, QueryParams const & params, - vector<Prediction> & predictions); + std::vector<Prediction> & predictions); private: static void FindStreets(BaseContext const & ctx, FeaturesFilter const & filter, - QueryParams const & params, vector<Prediction> & prediction); + QueryParams const & params, std::vector<Prediction> & prediction); }; } // namespace search diff --git a/search/suggest.hpp b/search/suggest.hpp index 0908f42067..ae99550ec0 100644 --- a/search/suggest.hpp +++ b/search/suggest.hpp @@ -22,6 +22,6 @@ struct Suggest int8_t m_locale; }; -void GetSuggestion(RankerResult const & res, string const & query, QueryTokens const & paramTokens, +void GetSuggestion(RankerResult const & res, std::string const & query, QueryTokens const & paramTokens, strings::UniString const & prefix, std::string & suggest); } // namespace search diff --git a/search/token_slice.cpp b/search/token_slice.cpp index fce53d2e79..6b69af0c61 100644 --- a/search/token_slice.cpp +++ b/search/token_slice.cpp @@ -1,6 +1,8 @@ #include "search/token_slice.hpp" -#include "std/sstream.hpp" +#include <sstream> + +using namespace std; namespace search { @@ -53,5 +55,4 @@ string DebugPrint(TokenSliceNoCategories const & slice) { return SliceToString("TokenSliceNoCategories", slice); } - } // namespace search diff --git a/search/token_slice.hpp b/search/token_slice.hpp index cced7e4b07..2438a96456 100644 --- a/search/token_slice.hpp +++ b/search/token_slice.hpp @@ -7,9 +7,9 @@ #include "base/assert.hpp" -#include "std/cstdint.hpp" -#include "std/string.hpp" -#include "std/vector.hpp" +#include <cstddef> +#include <string> +#include <vector> namespace search { @@ -56,7 +56,7 @@ public: private: QueryParams const & m_params; - vector<size_t> m_indexes; + std::vector<size_t> m_indexes; }; class QuerySlice : public StringSliceBase @@ -97,8 +97,7 @@ private: QueryParams::String const & m_prefix; }; -string DebugPrint(TokenSlice const & slice); - -string DebugPrint(TokenSliceNoCategories const & slice); +std::string DebugPrint(TokenSlice const & slice); +std::string DebugPrint(TokenSliceNoCategories const & slice); } // namespace search diff --git a/search/types_skipper.cpp b/search/types_skipper.cpp index 050bd56e4e..da87bfd248 100644 --- a/search/types_skipper.cpp +++ b/search/types_skipper.cpp @@ -4,7 +4,8 @@ #include "indexer/feature_data.hpp" #include "indexer/ftypes_matcher.hpp" -#include "std/algorithm.hpp" +#include <algorithm> + #include "std/initializer_list.hpp" namespace search @@ -96,6 +97,6 @@ bool TypesSkipper::IsCountryOrState(feature::TypesHolder const & types) const // static bool TypesSkipper::HasType(Cont const & v, uint32_t t) { - return find(v.begin(), v.end(), t) != v.end(); + return std::find(v.begin(), v.end(), t) != v.end(); } } // namespace search diff --git a/search/types_skipper.hpp b/search/types_skipper.hpp index 9b97293ef7..b85996f974 100644 --- a/search/types_skipper.hpp +++ b/search/types_skipper.hpp @@ -4,6 +4,8 @@ #include "base/buffer_vector.hpp" +#include <cstdint> + namespace search { // There are 2 different ways of search index skipping: |