From 69fc93d87ad7e8ae96f97563675b5bd9beb0e958 Mon Sep 17 00:00:00 2001 From: Jiri Drbalek Date: Tue, 11 Nov 2014 13:30:01 +0000 Subject: [PATCH] add move constructor to vertex_cache --- include/mapnik/vertex_cache.hpp | 1 + src/vertex_cache.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/mapnik/vertex_cache.hpp b/include/mapnik/vertex_cache.hpp index 277936032..119a6668c 100644 --- a/include/mapnik/vertex_cache.hpp +++ b/include/mapnik/vertex_cache.hpp @@ -97,6 +97,7 @@ public: /////////////////////////////////////////////////////////////////////// template vertex_cache(T &path); + vertex_cache(vertex_cache && rhs); double length() const { return current_subpath_->length; } diff --git a/src/vertex_cache.cpp b/src/vertex_cache.cpp index f5dc1909c..5df556bca 100644 --- a/src/vertex_cache.cpp +++ b/src/vertex_cache.cpp @@ -28,6 +28,21 @@ namespace mapnik { +vertex_cache::vertex_cache(vertex_cache && rhs) + : current_position_(std::move(rhs.current_position_)), + segment_starting_point_(std::move(rhs.segment_starting_point_)), + subpaths_(std::move(rhs.subpaths_)), + position_in_segment_(std::move(rhs.position_in_segment_)), + angle_(std::move(rhs.angle_)), + angle_valid_(std::move(rhs.angle_valid_)), + offseted_lines_(std::move(rhs.offseted_lines_)), + position_(std::move(rhs.position_)) +{ + // The C++11 standard doesn't guarantee iterators are valid when container is moved. + // We can create them from indexes but we don't need to. Just let them uninitialized. + initialized_ = false; +} + double vertex_cache::current_segment_angle() { return std::atan2(-(current_segment_->pos.y - segment_starting_point_.y),