@@ -517,42 +517,36 @@ namespace mstd {
517517
518518 [[nodiscard]] const value_type* data () const { return _data.data (); }
519519
520- [[nodiscard]] _MSTD_CONSTEXPR20 bool operator ==(const stable_vector& other) const
521- #if _MSTD_HAS_CXX20
522- = default ;
523- #else
524- {
520+ [[nodiscard]] _MSTD_CONSTEXPR20 bool operator ==(const stable_vector& other) const {
525521 return _data == other._data && _toId == other._toId && _toData == other._toData ;
526522 }
527- #endif
528523
529- [[nodiscard]] _MSTD_CONSTEXPR20 bool operator !=(const stable_vector& other) const
530- #if _MSTD_HAS_CXX20
531- = default ;
532- #else
533- {
534- return !(*this == other);
535- }
536- #endif
524+ [[nodiscard]] _MSTD_CONSTEXPR20 bool operator !=(const stable_vector& other) const { return !(*this == other); }
537525
538526 #if _MSTD_HAS_CXX20
539- [[nodiscard]] _MSTD_CONSTEXPR20 auto operator <=>(const stable_vector& other) const = default ;
540- #else
541- [[nodiscard]] _MSTD_CONSTEXPR20 bool operator <(const stable_vector& other) const {
542- return _data < other._data && _toId < other._toId && _toData < other._toData ;
543- }
527+ [[nodiscard]] constexpr auto operator <=>(const stable_vector& other) const {
528+ if (auto cmp = _data <=> other._data ; cmp != 0 ) { return cmp; }
544529
545- [[nodiscard]] _MSTD_CONSTEXPR20 bool operator <=(const stable_vector& other) const {
546- return _data <= other._data && _toId <= other._toId && _toData <= other._toData ;
547- }
530+ if (auto cmp = _toId <=> other._toId ; cmp != 0 ) { return cmp; }
548531
549- [[nodiscard]] _MSTD_CONSTEXPR20 bool operator >(const stable_vector& other) const {
550- return _data > other._data && _toId > other._toId && _toData > other._toData ;
532+ return _toData <=> other._toData ;
551533 }
534+ #else
535+ [[nodiscard]] bool operator <(const stable_vector& other) const {
536+ if (_data < other._data ) { return true ; }
537+ if (other._data < _data) { return false ; }
538+
539+ if (_toId < other._toId ) { return true ; }
540+ if (other._toId < _toId) { return false ; }
552541
553- [[nodiscard]] _MSTD_CONSTEXPR20 bool operator >=(const stable_vector& other) const {
554- return _data >= other._data && _toId >= other._toId && _toData >= other._toData ;
542+ return _toData < other._toData ;
555543 }
544+
545+ [[nodiscard]] bool operator <=(const stable_vector& other) const { return !(other < *this ); }
546+
547+ [[nodiscard]] bool operator >(const stable_vector& other) const { return other < *this ; }
548+
549+ [[nodiscard]] bool operator >=(const stable_vector& other) const { return !(*this < other); }
556550 #endif
557551 };
558552} // namespace mstd
0 commit comments