39template <
typename Po
intType,
typename SizeType>
44 static_assert(std::is_arithmetic<PointType>::value,
"Template argument of Rect must be arithmetic.");
78 constexpr RectangleT(PointType x, PointType y, SizeType width, SizeType height)
90 return m_point.
GetX();
100 return m_point.
GetY();
150 template <
typename RhsPo
intType,
typename RhsSizeType>
166 template <
typename RhsPo
intType,
typename RhsSizeType>
169 return !(*
this == rhs);
185 return os <<
"{ point: " << rectangle.m_point <<
", size: " << rectangle.m_size <<
" }";
199 std::ostringstream ss;
208 friend detail::BackendAccessor<RectangleT<PointType, SizeType>>;
211 template <
typename T = PointType,
typename U = SizeType,
212 typename std::enable_if<has_c_type_of<RectangleT<T, U>>::value,
bool>::type =
false>
constexpr T GetY() const
Returns the y-coordinate (second component).
constexpr T GetX() const
Returns the x-coordinate (first component).
A generic rectangle defined by a point and a size.
constexpr SizeT< SizeType > GetSize() const
Returns the size of the rectangle.
constexpr PointType GetX() const
Returns the x-coordinate of the rectangle's top-left corner.
std::string ToString() const
Returns a string representation of the rectangle.
constexpr RectangleT(PointType x, PointType y, SizeType width, SizeType height)
Constructs a rectangle from coordinates and dimensions.
constexpr SizeType GetWidth() const
Returns the width of the rectangle.
constexpr SizeType GetHeight() const
Returns the height of the rectangle.
constexpr RectangleT(const PointT< PointType > &point, const SizeT< SizeType > &size)
Constructs a rectangle from a point and a size.
constexpr RectangleT()=default
Default constructor for RectangleT.
constexpr PointType GetY() const
Returns the y-coordinate of the rectangle's top-left corner.
constexpr bool operator==(const RectangleT< RhsPointType, RhsSizeType > &rhs) const
Equality operator.
friend std::ostream & operator<<(std::ostream &os, RectangleT rectangle)
Stream output operator for RectangleT.
constexpr PointT< PointType > GetPosition() const
Returns the top-left corner of the rectangle as a Point.
constexpr bool operator!=(const RectangleT< RhsPointType, RhsSizeType > &rhs) const
Inequality operator.
Represents a two-dimensional size with non-negative width and height.
constexpr T GetWidth() const
Returns the width.
constexpr T GetHeight() const
Returns the height.
#define PEAK_COMMON_NO_DISCARD
Compatability macro for the nodiscard attribute.
typename c_type_of_< Type >::type c_type_of_t