Define default ctors/assignments in source files to avoid using objects of incomplete type in them

This commit is contained in:
Dmitry Marakasov 2014-02-11 04:59:49 +04:00
parent 0365329dc0
commit 1e4e1cb560
4 changed files with 12 additions and 4 deletions

View File

@ -50,6 +50,8 @@ Point::Point(const Point& other) {
}
}
Point::Point(Point&&) noexcept = default;
Point& Point::operator=(const Point& other) {
if (other.point_.get()) {
point_.reset(new SDL_Point);
@ -59,6 +61,8 @@ Point& Point::operator=(const Point& other) {
return *this;
}
Point& Point::operator=(Point&&) noexcept = default;
bool Point::operator==(const Point& other) const {
if (!point_ || !other.point_)
return point_ == other.point_; // true only if both null

View File

@ -52,9 +52,9 @@ public:
static Point Null();
Point(const Point& other);
Point(Point&&) noexcept = default;
Point(Point&&) noexcept;
Point& operator=(const Point& other);
Point& operator=(Point&&) noexcept = default;
Point& operator=(Point&&) noexcept;
bool operator==(const Point& other) const;
bool operator!=(const Point& other) const;

View File

@ -54,6 +54,8 @@ Rect::Rect(const Rect& other) {
}
}
Rect::Rect(Rect&&) noexcept = default;
Rect& Rect::operator=(const Rect& other) {
if (other.rect_.get()) {
rect_.reset(new SDL_Rect);
@ -65,6 +67,8 @@ Rect& Rect::operator=(const Rect& other) {
return *this;
}
Rect& Rect::operator=(Rect&&) noexcept = default;
bool Rect::operator==(const Rect& other) const {
if (!rect_ || !other.rect_)
return rect_ == other.rect_; // true only if both null

View File

@ -44,9 +44,9 @@ public:
static Rect FromCenter(int cx, int cy, int w, int h);
Rect(const Rect& other);
Rect(Rect&&) noexcept = default;
Rect(Rect&&) noexcept;
Rect& operator=(const Rect& other);
Rect& operator=(Rect&&) noexcept = default;
Rect& operator=(Rect&&) noexcept;
bool operator==(const Rect& other) const;
bool operator!=(const Rect& other) const;