compare.h 423 B

123456789101112131415161718
  1. #pragma once
  2. #include <compare>
  3. // Apple Clang does not properly support <=> in the STL - so we need to force it
  4. #if __cpp_lib_three_way_comparison < 201907L
  5. namespace std {
  6. template <typename T> auto operator<=>(T const & lhs, T const & rhs) {
  7. if (lhs < rhs) {
  8. return std::strong_ordering::less;
  9. }
  10. if (lhs > rhs) {
  11. return std::strong_ordering::greater;
  12. }
  13. return std::strong_ordering::equal;
  14. }
  15. }
  16. #endif