mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 10:55:57 -04:00
Define default ctors/assignments in source files to avoid using objects of incomplete type in them
This commit is contained in:
parent
0365329dc0
commit
1e4e1cb560
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user