13 Rect() : x(0), y(0), width(0), height(0){}
14 Rect(int32_t _x, int32_t _y, int32_t _width, int32_t _height) {
20 Rect(
const Rect& r) =
default;
21 Rect(Rect&& r)
noexcept {
26 r.x = r.y = r.width = r.height = 0;
29 Rect& operator = (
const Rect& r) =
default;
30 Rect& operator = (Rect&& r)
noexcept {
35 r.x = r.y = r.width = r.height = 0;
39 return { width, height };
41 int32_t area()
const {
42 return width * height;
45 return width <= 0 || height <= 0;
47 friend std::ostream& operator<<(std::ostream& os,
const Rect& rect) {
48 os <<
"Rect (x: " << rect.x <<
", y: " << rect.y <<
", width: " << rect.width <<
", height: " << rect.height <<
")";
52 return x >= 0 && y >= 0 && width > 0 && height > 0;
Definition: exceptions.hpp:15