face_set_ptr can be unique rather than shared

This commit is contained in:
Dane Springmeyer 2014-10-01 19:01:26 -07:00
parent d29add9db3
commit 898d58c4f5
3 changed files with 5 additions and 4 deletions

View file

@ -49,7 +49,7 @@ namespace mapnik
class stroker; class stroker;
using stroker_ptr = std::shared_ptr<stroker>; using stroker_ptr = std::shared_ptr<stroker>;
class font_face_set; class font_face_set;
using face_set_ptr = std::shared_ptr<font_face_set>; using face_set_ptr = std::unique_ptr<font_face_set>;
class font_face; class font_face;
using face_ptr = std::shared_ptr<font_face>; using face_ptr = std::shared_ptr<font_face>;

View file

@ -98,7 +98,7 @@ public:
private: private:
std::vector<face_ptr> faces_; std::vector<face_ptr> faces_;
}; };
using face_set_ptr = std::shared_ptr<font_face_set>; using face_set_ptr = std::unique_ptr<font_face_set>;
// FT_Stroker wrapper // FT_Stroker wrapper

View file

@ -28,6 +28,7 @@
#include <mapnik/util/fs.hpp> #include <mapnik/util/fs.hpp>
#include <mapnik/util/file_io.hpp> #include <mapnik/util/file_io.hpp>
#include <mapnik/utils.hpp> #include <mapnik/utils.hpp>
#include <mapnik/make_unique.hpp>
// boost // boost
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
@ -361,7 +362,7 @@ face_ptr face_manager<T>::get_face(std::string const& name)
template <typename T> template <typename T>
face_set_ptr face_manager<T>::get_face_set(std::string const& name) face_set_ptr face_manager<T>::get_face_set(std::string const& name)
{ {
face_set_ptr face_set = std::make_shared<font_face_set>(); face_set_ptr face_set = std::make_unique<font_face_set>();
if (face_ptr face = get_face(name)) if (face_ptr face = get_face(name))
{ {
face_set->add(face); face_set->add(face);
@ -373,7 +374,7 @@ template <typename T>
face_set_ptr face_manager<T>::get_face_set(font_set const& fset) face_set_ptr face_manager<T>::get_face_set(font_set const& fset)
{ {
std::vector<std::string> const& names = fset.get_face_names(); std::vector<std::string> const& names = fset.get_face_names();
face_set_ptr face_set = std::make_shared<font_face_set>(); face_set_ptr face_set = std::make_unique<font_face_set>();
for (auto const& name : names) for (auto const& name : names)
{ {
face_ptr face = get_face(name); face_ptr face = get_face(name);