From 6512d2873a5f83e3e598d384abae4437d8a4b461 Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 20 Dec 2012 16:36:16 +0000 Subject: [PATCH] + swap patch from @joto : http://www.remote.org/jochen/tmp/swap.patch --- include/mapnik/layer.hpp | 4 ++-- src/layer.cpp | 31 ++++++++++++++++--------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/mapnik/layer.hpp b/include/mapnik/layer.hpp index 78a17441c..b38858f06 100644 --- a/include/mapnik/layer.hpp +++ b/include/mapnik/layer.hpp @@ -47,7 +47,7 @@ public: std::string const& srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"); layer(layer const& l); - layer& operator=(layer const& l); + layer& operator=(layer const& rhs); bool operator==(layer const& other) const; /*! @@ -197,7 +197,7 @@ public: int buffer_size() const; ~layer(); private: - void swap(const layer& other); + void swap(layer& other); std::string name_; std::string srs_; diff --git a/src/layer.cpp b/src/layer.cpp index 0e8539747..ca7ed9f74 100644 --- a/src/layer.cpp +++ b/src/layer.cpp @@ -58,7 +58,7 @@ layer::layer(const layer& rhs) buffer_size_(rhs.buffer_size_), maximum_extent_(rhs.maximum_extent_) {} -layer& layer::operator=(const layer& rhs) +layer& layer::operator=(layer const& rhs) { layer tmp(rhs); swap(tmp); @@ -70,21 +70,22 @@ bool layer::operator==(layer const& other) const return (this == &other); } -void layer::swap(const layer& rhs) +void layer::swap(layer& rhs) { - name_=rhs.name_; - srs_ = rhs.srs_; - min_zoom_=rhs.min_zoom_; - max_zoom_=rhs.max_zoom_; - active_=rhs.active_; - queryable_=rhs.queryable_; - clear_label_cache_ = rhs.clear_label_cache_; - cache_features_ = rhs.cache_features_; - group_by_ = rhs.group_by_; - styles_=rhs.styles_; - ds_=rhs.ds_; - buffer_size_ = rhs.buffer_size_; - maximum_extent_ = rhs.maximum_extent_; + using std::swap; + swap(name_, rhs.name_); + swap(srs_, rhs.srs_); + swap(min_zoom_, rhs.min_zoom_); + swap(max_zoom_, rhs.max_zoom_); + swap(active_, rhs.active_); + swap(queryable_, rhs.queryable_); + swap(clear_label_cache_, rhs.clear_label_cache_); + swap(cache_features_, rhs.cache_features_); + swap(group_by_, rhs.group_by_); + swap(styles_, rhs.styles_); + swap(ds_, rhs.ds_); + swap(buffer_size_, rhs.buffer_size_); + swap(maximum_extent_, rhs.maximum_extent_); } layer::~layer() {}