add move constructor to vertex_cache

This commit is contained in:
Jiri Drbalek 2014-11-11 13:30:01 +00:00
parent 3013197de7
commit 69fc93d87a
2 changed files with 16 additions and 0 deletions

View file

@ -97,6 +97,7 @@ public:
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
template <typename T> vertex_cache(T &path); template <typename T> vertex_cache(T &path);
vertex_cache(vertex_cache && rhs);
double length() const { return current_subpath_->length; } double length() const { return current_subpath_->length; }

View file

@ -28,6 +28,21 @@
namespace mapnik 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() double vertex_cache::current_segment_angle()
{ {
return std::atan2(-(current_segment_->pos.y - segment_starting_point_.y), return std::atan2(-(current_segment_->pos.y - segment_starting_point_.y),