#ifndef SIZE_HH #define SIZE_HH #include #include struct Size final { Size() : width(0), height(0) {} Size(uint32_t width, uint32_t height) : width(width), height(height) {} bool empty() const { return width == 0 || height == 0; } operator bool() const { return !empty(); } std::strong_ordering operator<=>(Size const& other) const { if (empty()) { return other.empty() ? std::strong_ordering::equal : std::strong_ordering::less; } if (other.empty()) return std::strong_ordering::greater; auto ret = width <=> other.width; return ret == std::strong_ordering::equal ? height <=> other.height : ret; } uint32_t width; uint32_t height; }; #endif // SIZE_HH