microsoft / DirectXMath

DirectXMath is an all inline SIMD C++ linear algebra library for use in games and graphics apps
https://walbourn.github.io/introducing-directxmath/
MIT License
1.54k stars 236 forks source link

C++20 spaceship operator for XMFLOAT2, XMFLOAT3, etc. #146

Closed walbourn closed 2 years ago

walbourn commented 2 years ago

Add defaulted comparisons for C++20 scenarios to XMFLOAT2, XMINT2, XMUINT2, XMFLOAT3, XMINT3, XMUINT3, XMFLOAT4, XMINT4, XMUINT4, XMFLOAT3X3, XMFLOAT4X3, XMFLOAT3X4, and XMFLOAT4X4

#if (__cplusplus >= 202002L)
    bool operator == (const XMFLOAT2&) const = default;
    auto operator <=> (const XMFLOAT2&) const = default;
#endif

This enables automatic generation of all the comparison operators.