default assignment op + cleanups

This commit is contained in:
artemp 2015-03-04 09:19:53 +01:00
parent c58a5b4151
commit bdbaf947f7

View file

@ -41,22 +41,12 @@ struct point
{
point() {}
point(double x_, double y_)
: x(x_),y(y_) {}
point(point const& other)
: x(other.x),
y(other.y) {}
: x(x_), y(y_)
{}
point(point const& other) = default;
point(point && other) noexcept = default;
point & operator=(point const& other)
{
if (this == &other) return *this;
point tmp(other);
std::swap(x, tmp.x);
std::swap(y, tmp.y);
return *this;
}
point & operator=(point const& other) = default;
double x;
double y;
};