diff --git a/include/mapnik/enumeration.hpp b/include/mapnik/enumeration.hpp index d5b08736e..b7614584d 100644 --- a/include/mapnik/enumeration.hpp +++ b/include/mapnik/enumeration.hpp @@ -35,11 +35,7 @@ #include #include #include -#if __cpp_lib_string_view >= 201606L #include -#endif - -#include namespace mapnik { @@ -62,60 +58,9 @@ class illegal_enum_value : public std::exception }; namespace detail { -#if __cpp_lib_string_view >= 201606L -using mapnik_string_view = std::string_view; -#else -class mapnik_string_view // use std::string_view in C++17 -{ - public: - - template - constexpr mapnik_string_view(const char (&s)[N]) - : size_(N) - , data_(s) - {} - - constexpr mapnik_string_view(const char* s, std::size_t N) - : size_(N) - , data_(s) - {} - - constexpr char operator[](std::size_t index) const - { - return (index >= size_) ? throw std::out_of_range("Invalid index.") : data_[index]; - } - - constexpr char const* data() const { return data_; } - - private: - std::size_t size_; - const char* data_; -}; - -constexpr bool mapnik_string_view_equals(mapnik_string_view const& a, char const* b, std::size_t i) -{ - if (a[i] != b[i]) - { - return false; - } - else if (a[i] == 0 || b[i] == 0) - { - return true; - } - else - { - return mapnik_string_view_equals(a, b, i + 1); - } -} - -constexpr bool operator==(mapnik_string_view const& a, char const* b) -{ - return mapnik_string_view_equals(a, b, 0); -} -#endif template -using EnumStringT = std::tuple; +using EnumStringT = std::tuple; template using EnumMapT = std::array, N>; diff --git a/src/proj_transform_cache.cpp b/src/proj_transform_cache.cpp index 1913da29c..54ffac4d8 100644 --- a/src/proj_transform_cache.cpp +++ b/src/proj_transform_cache.cpp @@ -26,14 +26,14 @@ MAPNIK_DISABLE_WARNING_PUSH #include #include #include -#include MAPNIK_DISABLE_WARNING_POP +#include namespace mapnik { namespace proj_transform_cache { namespace { using key_type = std::pair; -using compatible_key_type = std::pair; +using compatible_key_type = std::pair; struct compatible_hash { @@ -59,7 +59,7 @@ thread_local static cache_type cache_ = {}; void init(std::string const& source, std::string const& dest) { - compatible_key_type key = std::make_pair(source, dest); + compatible_key_type key = std::make_pair(source, dest); auto itr = cache_.find(key, compatible_hash{}, compatible_predicate{}); if (itr == cache_.end()) { @@ -71,7 +71,7 @@ void init(std::string const& source, std::string const& dest) proj_transform const* get(std::string const& source, std::string const& dest) { - compatible_key_type key = std::make_pair(source, dest); + compatible_key_type key = std::make_pair(source, dest); auto itr = cache_.find(key, compatible_hash{}, compatible_predicate{}); if (itr == cache_.end()) { diff --git a/src/well_known_srs.cpp b/src/well_known_srs.cpp index 2efb7a5d0..23a62de9b 100644 --- a/src/well_known_srs.cpp +++ b/src/well_known_srs.cpp @@ -72,7 +72,7 @@ boost::optional is_known_geographic(std::string const& srs) using well_known_srs_e_str = mapnik::detail::EnumStringT; constexpr detail::EnumMapT well_known_srs_e_map{{ - well_known_srs_e_str{well_known_srs_enum::WGS_84, detail::mapnik_string_view{MAPNIK_GEOGRAPHIC_PROJ_STR}}, + well_known_srs_e_str{well_known_srs_enum::WGS_84, MAPNIK_GEOGRAPHIC_PROJ_STR}, well_known_srs_e_str{well_known_srs_enum::WEB_MERC, MAPNIK_WEBMERCATOR_PROJ_STR}, well_known_srs_e_str{well_known_srs_enum::well_known_srs_enum_MAX, ""}, }};