diff --git a/Inc/SimpleMath.h b/Inc/SimpleMath.h index 6ecd544..11c2b07 100644 --- a/Inc/SimpleMath.h +++ b/Inc/SimpleMath.h @@ -19,6 +19,10 @@ #include #include +#if (__cplusplus >= 202002L) +#include +#endif + #include #include #include @@ -65,10 +69,14 @@ namespace DirectX #endif // Comparison operators + #if (__cplusplus >= 202002L) + bool operator == (const Rectangle&) const = default; + auto operator <=> (const Rectangle&) const = default; + #else bool operator == (const Rectangle& r) const noexcept { return (x == r.x) && (y == r.y) && (width == r.width) && (height == r.height); } - bool operator == (const RECT& rct) const noexcept { return (x == rct.left) && (y == rct.top) && (width == (rct.right - rct.left)) && (height == (rct.bottom - rct.top)); } - bool operator != (const Rectangle& r) const noexcept { return (x != r.x) || (y != r.y) || (width != r.width) || (height != r.height); } + #endif + bool operator == (const RECT& rct) const noexcept { return (x == rct.left) && (y == rct.top) && (width == (rct.right - rct.left)) && (height == (rct.bottom - rct.top)); } bool operator != (const RECT& rct) const noexcept { return (x != rct.left) || (y != rct.top) || (width != (rct.right - rct.left)) || (height != (rct.bottom - rct.top)); } // Assignment operators @@ -956,8 +964,13 @@ namespace DirectX Viewport& operator=(Viewport&&) = default; // Comparison operators + #if (__cplusplus >= 202002L) + bool operator == (const Viewport&) const = default; + auto operator <=> (const Viewport&) const = default; + #else bool operator == (const Viewport& vp) const noexcept; bool operator != (const Viewport& vp) const noexcept; + #endif // Assignment operators Viewport& operator= (const RECT& rct) noexcept; diff --git a/Inc/SimpleMath.inl b/Inc/SimpleMath.inl index e0242b2..2cd32dc 100644 --- a/Inc/SimpleMath.inl +++ b/Inc/SimpleMath.inl @@ -3724,6 +3724,7 @@ inline bool Ray::Intersects(const Plane& plane, _Out_ float& Dist) const noexcep // Comparision operators //------------------------------------------------------------------------------ +#if (__cplusplus < 202002L) inline bool Viewport::operator == (const Viewport& vp) const noexcept { return (x == vp.x && y == vp.y @@ -3737,6 +3738,7 @@ inline bool Viewport::operator != (const Viewport& vp) const noexcept || width != vp.width || height != vp.height || minDepth != vp.minDepth || maxDepth != vp.maxDepth); } +#endif //------------------------------------------------------------------------------ // Assignment operators