+ implement assignment operator in terms of a copy construction and a swap.
This commit is contained in:
parent
1a813f8af2
commit
c1a9b60b50
2 changed files with 4 additions and 7 deletions
|
@ -37,7 +37,7 @@ class MAPNIK_DECL font_set
|
|||
public:
|
||||
font_set(std::string const& name);
|
||||
font_set(font_set const& rhs);
|
||||
font_set& operator=(font_set const& rhs);
|
||||
font_set& operator=(font_set rhs);
|
||||
unsigned size() const;
|
||||
void set_name(std::string const& name);
|
||||
std::string const& get_name() const;
|
||||
|
|
|
@ -36,13 +36,10 @@ font_set::font_set(font_set const& rhs)
|
|||
: name_(rhs.name_),
|
||||
face_names_(rhs.face_names_) {}
|
||||
|
||||
font_set& font_set::operator=(font_set const& other)
|
||||
font_set& font_set::operator=(font_set other)
|
||||
{
|
||||
if (this == &other)
|
||||
return *this;
|
||||
name_ = other.name_;
|
||||
face_names_ = other.face_names_;
|
||||
|
||||
std::swap(name_,other.name_);
|
||||
std::swap(face_names_,other.face_names_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue