custom swap

This commit is contained in:
artemp 2014-05-27 11:43:46 +01:00
parent 9972680020
commit d25abed9d2
2 changed files with 15 additions and 1 deletions

View file

@ -63,9 +63,11 @@ private:
boost::optional<composite_mode_e> comp_op_; boost::optional<composite_mode_e> comp_op_;
float opacity_; float opacity_;
bool image_filters_inflate_; bool image_filters_inflate_;
friend void swap(feature_type_style& lhs, feature_type_style & rhs);
public: public:
feature_type_style(); feature_type_style();
feature_type_style(feature_type_style const& rhs); feature_type_style(feature_type_style const& rhs);
feature_type_style(feature_type_style &&) = default;
feature_type_style& operator=(feature_type_style rhs); feature_type_style& operator=(feature_type_style rhs);
void add_rule(rule && rule); void add_rule(rule && rule);

View file

@ -62,10 +62,22 @@ feature_type_style::feature_type_style(feature_type_style const& rhs)
feature_type_style& feature_type_style::operator=(feature_type_style rhs) feature_type_style& feature_type_style::operator=(feature_type_style rhs)
{ {
std::swap(*this, rhs); swap(*this, rhs);
return *this; return *this;
} }
void swap( feature_type_style & lhs, feature_type_style & rhs)
{
using std::swap;
std::swap(lhs.rules_, rhs.rules_);
std::swap(lhs.filter_mode_, rhs.filter_mode_);
std::swap(lhs.filters_, rhs.filters_);
std::swap(lhs.direct_filters_, rhs.direct_filters_);
std::swap(lhs.comp_op_, rhs.comp_op_);
std::swap(lhs.opacity_, rhs.opacity_);
std::swap(lhs.image_filters_inflate_, rhs.image_filters_inflate_);
}
void feature_type_style::add_rule(rule && rule) void feature_type_style::add_rule(rule && rule)
{ {
rules_.push_back(std::move(rule)); rules_.push_back(std::move(rule));