From 45bda29a459cdca784960b913835077319cd3121 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 12 Jun 2015 20:52:57 -0700 Subject: [PATCH] switch to c++11 library over boost (confirmed no speed drop on osx with test_marker_cache.cpp) --- include/mapnik/marker_cache.hpp | 8 ++++---- src/marker_cache.cpp | 11 ++++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/include/mapnik/marker_cache.hpp b/include/mapnik/marker_cache.hpp index 7072b3921..deade57ca 100644 --- a/include/mapnik/marker_cache.hpp +++ b/include/mapnik/marker_cache.hpp @@ -28,9 +28,9 @@ #include #include -// boost -#include +#include #include +#include namespace mapnik { @@ -46,9 +46,9 @@ private: marker_cache(); ~marker_cache(); bool insert_marker(std::string const& key, marker && path); - boost::unordered_map > marker_cache_; + std::unordered_map > marker_cache_; bool insert_svg(std::string const& name, std::string const& svg_string); - boost::unordered_map svg_cache_; + std::unordered_map svg_cache_; public: std::string known_svg_prefix_; std::string known_image_prefix_; diff --git a/src/marker_cache.cpp b/src/marker_cache.cpp index 0f63c6d62..e7c46a259 100644 --- a/src/marker_cache.cpp +++ b/src/marker_cache.cpp @@ -72,8 +72,7 @@ void marker_cache::clear() #ifdef MAPNIK_THREADSAFE std::lock_guard lock(mutex_); #endif - using iterator_type = boost::unordered_map >::const_iterator; - iterator_type itr = marker_cache_.begin(); + auto itr = marker_cache_.begin(); while(itr != marker_cache_.end()) { if (!is_uri(itr->first)) @@ -100,8 +99,7 @@ bool marker_cache::is_image_uri(std::string const& path) bool marker_cache::insert_svg(std::string const& name, std::string const& svg_string) { std::string key = known_svg_prefix_ + name; - using iterator_type = boost::unordered_map::const_iterator; - iterator_type itr = svg_cache_.find(key); + auto itr = svg_cache_.find(key); if (itr == svg_cache_.end()) { return svg_cache_.emplace(key,svg_string).second; @@ -153,8 +151,7 @@ std::shared_ptr marker_cache::find(std::string const& uri, #ifdef MAPNIK_THREADSAFE std::lock_guard lock(mutex_); #endif - using iterator_type = boost::unordered_map >::const_iterator; - iterator_type itr = marker_cache_.find(uri); + auto itr = marker_cache_.find(uri); if (itr != marker_cache_.end()) { return itr->second; @@ -165,7 +162,7 @@ std::shared_ptr marker_cache::find(std::string const& uri, // if uri references a built-in marker if (is_svg_uri(uri)) { - boost::unordered_map::const_iterator mark_itr = svg_cache_.find(uri); + auto mark_itr = svg_cache_.find(uri); if (mark_itr == svg_cache_.end()) { MAPNIK_LOG_ERROR(marker_cache) << "Marker does not exist: " << uri;