5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPARE_OPERATORS_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_COMPARE_OPERATORS_HPP_
14#include "arene/base/compare/compare_three_way.hpp"
15#include "arene/base/compare/strong_ordering.hpp"
16#include "arene/base/compiler_support/attributes.hpp"
17#include "arene/base/compiler_support/diagnostics.hpp"
18#include "arene/base/constraints/constraints.hpp"
19#include "arene/base/stdlib_choice/declval.hpp"
20#include "arene/base/stdlib_choice/enable_if.hpp"
21#include "arene/base/stdlib_choice/is_same.hpp"
22#include "arene/base/type_traits/comparison_traits.hpp"
32namespace operators_detail {
37template <
typename LhsType,
typename RhsType>
38class inequality_operator_mixin {
46 ARENE_NODISCARD
friend constexpr auto operator!=(LhsType
const& lhs, RhsType
const& rhs)
noexcept ->
bool {
47 static_assert(is_nothrow_equality_comparable_v<LhsType
const&, RhsType
const&>,
"operator == should be noexcept");
54 constexpr inequality_operator_mixin()
noexcept =
default;
56 ~inequality_operator_mixin()
noexcept =
default;
59 constexpr inequality_operator_mixin(inequality_operator_mixin
const& other)
noexcept =
default;
62 constexpr inequality_operator_mixin(inequality_operator_mixin&& other)
noexcept =
default;
65 constexpr auto operator=(inequality_operator_mixin
const& other) &
noexcept -> inequality_operator_mixin& =
default;
68 constexpr auto operator=(inequality_operator_mixin&& other) &
noexcept -> inequality_operator_mixin& =
default;
92template <
typename Derived,
typename Other = Derived>
93class full_equality_operators_from_basic_equality
94 : operators_detail::inequality_operator_mixin<Derived, Other>
95 , operators_detail::inequality_operator_mixin<Other, Derived> {
102 ARENE_NODISCARD
friend constexpr auto operator==(Other
const& lhs, Derived
const& rhs)
noexcept ->
bool {
109 constexpr full_equality_operators_from_basic_equality()
noexcept =
default;
111 ~full_equality_operators_from_basic_equality()
noexcept =
default;
114 constexpr full_equality_operators_from_basic_equality(full_equality_operators_from_basic_equality
const& other
115 )
noexcept =
default;
118 constexpr full_equality_operators_from_basic_equality(full_equality_operators_from_basic_equality&& other
119 )
noexcept =
default;
122 constexpr auto operator=(full_equality_operators_from_basic_equality
const& other) &
noexcept
123 -> full_equality_operators_from_basic_equality& =
default;
126 constexpr auto operator=(full_equality_operators_from_basic_equality&& other) &
noexcept
127 -> full_equality_operators_from_basic_equality& =
default;
132template <
typename Derived>
133class full_equality_operators_from_basic_equality<Derived, Derived>
134 : operators_detail::inequality_operator_mixin<Derived, Derived> {
137 constexpr full_equality_operators_from_basic_equality()
noexcept =
default;
139 ~full_equality_operators_from_basic_equality()
noexcept =
default;
142 constexpr full_equality_operators_from_basic_equality(full_equality_operators_from_basic_equality
const& other
143 )
noexcept =
default;
146 constexpr full_equality_operators_from_basic_equality(full_equality_operators_from_basic_equality&& other
147 )
noexcept =
default;
150 constexpr auto operator=(full_equality_operators_from_basic_equality
const& other) &
noexcept
151 -> full_equality_operators_from_basic_equality& =
default;
154 constexpr auto operator=(full_equality_operators_from_basic_equality&& other) &
noexcept
155 -> full_equality_operators_from_basic_equality& =
default;
159namespace operators_detail {
164template <
typename LhsType,
typename RhsType>
165class ordering_operators_from_three_way_mixin {
171 ARENE_NODISCARD
friend constexpr auto operator<(LhsType
const& lhs, RhsType
const& rhs)
noexcept ->
bool {
175 std::is_same<
decltype(LhsType::three_way_compare(lhs, rhs)), strong_ordering>::value,
176 "LhsType class must provide three_way_compare function that "
177 "returns strong_ordering"
179 static_assert(
noexcept(LhsType::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
181 return LhsType::three_way_compare(lhs, rhs) == strong_ordering::less;
190 ARENE_NODISCARD
friend constexpr auto operator>(LhsType
const& lhs, RhsType
const& rhs)
noexcept ->
bool {
194 std::is_same<
decltype(LhsType::three_way_compare(lhs, rhs)), strong_ordering>::value,
195 "LhsType class must provide three_way_compare function that "
196 "returns strong_ordering"
198 static_assert(
noexcept(LhsType::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
200 return LhsType::three_way_compare(lhs, rhs) == strong_ordering::greater;
210 ARENE_NODISCARD
friend constexpr auto operator<=(LhsType
const& lhs, RhsType
const& rhs)
noexcept ->
bool {
214 std::is_same<
decltype(LhsType::three_way_compare(lhs, rhs)), strong_ordering>::value,
215 "LhsType class must provide three_way_compare function that "
216 "returns strong_ordering"
218 static_assert(
noexcept(LhsType::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
220 auto const cmp_res = LhsType::three_way_compare(lhs, rhs);
221 return cmp_res == strong_ordering::less || cmp_res == strong_ordering::equal;
234 ARENE_NODISCARD
friend constexpr auto operator>=(LhsType
const& lhs, RhsType
const& rhs)
noexcept ->
bool {
238 std::is_same<
decltype(LhsType::three_way_compare(lhs, rhs)), strong_ordering>::value,
239 "LhsType class must provide three_way_compare function that "
240 "returns strong_ordering"
242 static_assert(
noexcept(LhsType::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
244 auto const cmp_res = LhsType::three_way_compare(lhs, rhs);
245 return cmp_res == strong_ordering::greater || cmp_res == strong_ordering::equal;
251 constexpr ordering_operators_from_three_way_mixin()
noexcept =
default;
253 ~ordering_operators_from_three_way_mixin()
noexcept =
default;
256 constexpr ordering_operators_from_three_way_mixin(ordering_operators_from_three_way_mixin
const& other
257 )
noexcept =
default;
260 constexpr ordering_operators_from_three_way_mixin(ordering_operators_from_three_way_mixin&& other)
noexcept =
default;
263 constexpr auto operator=(ordering_operators_from_three_way_mixin
const& other) &
noexcept
264 -> ordering_operators_from_three_way_mixin& =
default;
267 constexpr auto operator=(ordering_operators_from_three_way_mixin&& other) &
noexcept
268 -> ordering_operators_from_three_way_mixin& =
default;
300class ARENE_DEPRECATED_WITH(
"Use generic_ordering_from_three_way_compare instead"
356 )
noexcept =
default;
361 )
noexcept =
default;
374ARENE_IGNORE_ALL(
"-Wdeprecated-declarations",
"We still want to specialize the deprecated classes");
377template <
typename Derived>
378class full_ordering_operators_from_three_way_compare_and_equals<Derived, Derived>
379 : full_equality_operators_from_basic_equality<Derived>
380 , operators_detail::ordering_operators_from_three_way_mixin<Derived, Derived> {
384 constexpr full_ordering_operators_from_three_way_compare_and_equals()
noexcept =
default;
386 ~full_ordering_operators_from_three_way_compare_and_equals()
noexcept =
default;
389 constexpr full_ordering_operators_from_three_way_compare_and_equals(
390 full_ordering_operators_from_three_way_compare_and_equals
const& other
391 )
noexcept =
default;
394 constexpr full_ordering_operators_from_three_way_compare_and_equals(
395 full_ordering_operators_from_three_way_compare_and_equals&& other
396 )
noexcept =
default;
399 constexpr auto operator=(full_ordering_operators_from_three_way_compare_and_equals
const& other) &
noexcept
400 -> full_ordering_operators_from_three_way_compare_and_equals& =
default;
403 constexpr auto operator=(full_ordering_operators_from_three_way_compare_and_equals&& other) &
noexcept
404 -> full_ordering_operators_from_three_way_compare_and_equals& =
default;
411 "-Wdeprecated-declarations",
412 "We still want to use the deprecated class in this other deprecated class"
450 "Derived class must provide three_way_compare function that "
451 "returns strong_ordering"
467 )
noexcept =
default;
471 )
noexcept =
default;
483namespace operators_detail {
488template <
typename LhsType,
typename RhsType>
489class ordering_operators_from_less_than_mixin {
495 ARENE_NODISCARD
friend constexpr auto operator>(LhsType
const& lhs, RhsType
const& rhs)
noexcept ->
bool {
496 static_assert(is_nothrow_less_than_comparable_v<RhsType
const&, LhsType
const&>,
"rhs < lhs should be noexcept");
497 return static_cast<
bool>(rhs < lhs);
508 ARENE_NODISCARD
friend constexpr auto operator<=(LhsType
const& lhs, RhsType
const& rhs)
noexcept ->
bool {
509 static_assert(is_nothrow_less_than_comparable_v<RhsType
const&, LhsType
const&>,
"rhs < lhs should be noexcept");
510 return !
static_cast<
bool>(rhs < lhs);
521 ARENE_NODISCARD
friend constexpr auto operator>=(LhsType
const& lhs, RhsType
const& rhs)
noexcept ->
bool {
522 static_assert(is_nothrow_less_than_comparable_v<RhsType
const&, LhsType
const&>,
"rhs < lhs should be noexcept");
523 return !
static_cast<
bool>(lhs < rhs);
529 constexpr ordering_operators_from_less_than_mixin()
noexcept =
default;
531 ~ordering_operators_from_less_than_mixin()
noexcept =
default;
534 constexpr ordering_operators_from_less_than_mixin(ordering_operators_from_less_than_mixin
const& other
535 )
noexcept =
default;
538 constexpr ordering_operators_from_less_than_mixin(ordering_operators_from_less_than_mixin&& other)
noexcept =
default;
541 constexpr auto operator=(ordering_operators_from_less_than_mixin
const& other) &
noexcept
542 -> ordering_operators_from_less_than_mixin& =
default;
545 constexpr auto operator=(ordering_operators_from_less_than_mixin&& other) &
noexcept
546 -> ordering_operators_from_less_than_mixin& =
default;
583template <
typename Derived,
typename Other = Derived>
584class full_ordering_operators_from_less_than_and_equals
585 : operators_detail::ordering_operators_from_less_than_mixin<Derived, Other>
586 , operators_detail::ordering_operators_from_less_than_mixin<Other, Derived>
587 , full_equality_operators_from_basic_equality<Derived, Other> {
591 constexpr full_ordering_operators_from_less_than_and_equals()
noexcept =
default;
593 ~full_ordering_operators_from_less_than_and_equals()
noexcept =
default;
596 constexpr full_ordering_operators_from_less_than_and_equals(
597 full_ordering_operators_from_less_than_and_equals
const& other
598 )
noexcept =
default;
601 constexpr full_ordering_operators_from_less_than_and_equals(full_ordering_operators_from_less_than_and_equals&& other
602 )
noexcept =
default;
605 constexpr auto operator=(full_ordering_operators_from_less_than_and_equals
const& other) &
noexcept
606 -> full_ordering_operators_from_less_than_and_equals& =
default;
609 constexpr auto operator=(full_ordering_operators_from_less_than_and_equals&& other) &
noexcept
610 -> full_ordering_operators_from_less_than_and_equals& =
default;
615template <
typename Derived>
616class full_ordering_operators_from_less_than_and_equals<Derived, Derived>
617 : operators_detail::ordering_operators_from_less_than_mixin<Derived, Derived>
618 , full_equality_operators_from_basic_equality<Derived> {
621 constexpr full_ordering_operators_from_less_than_and_equals()
noexcept =
default;
623 ~full_ordering_operators_from_less_than_and_equals()
noexcept =
default;
626 constexpr full_ordering_operators_from_less_than_and_equals(
627 full_ordering_operators_from_less_than_and_equals
const& other
628 )
noexcept =
default;
631 constexpr full_ordering_operators_from_less_than_and_equals(full_ordering_operators_from_less_than_and_equals&& other
632 )
noexcept =
default;
635 constexpr auto operator=(full_ordering_operators_from_less_than_and_equals
const& other) &
noexcept
636 -> full_ordering_operators_from_less_than_and_equals& =
default;
639 constexpr auto operator=(full_ordering_operators_from_less_than_and_equals&& other) &
noexcept
640 -> full_ordering_operators_from_less_than_and_equals& =
default;
673template <
typename Derived,
typename Other = Derived>
674class full_ordering_operators_from_less_than : full_ordering_operators_from_less_than_and_equals<Derived, Other> {
682 ARENE_NODISCARD
friend constexpr auto operator==(Derived
const& lhs, Other
const& rhs)
noexcept ->
bool {
683 static_assert(is_nothrow_less_than_comparable_v<Derived
const&, Other
const&>,
"lhs < rhs should be noexcept");
684 static_assert(is_nothrow_less_than_comparable_v<Other
const&, Derived
const&>,
"rhs < lhs should be noexcept");
685 return !
static_cast<
bool>(lhs < rhs) && !
static_cast<
bool>(rhs < lhs);
693enum class inequality_heuristic :
bool {
695 definitely_not_equal,
697 may_be_equal_or_not_equal
706template <
typename T,
typename U = T,
typename = constraints<>>
707extern constexpr bool has_fast_inequality_check_v =
false;
710template <
typename T,
typename U>
743template <
typename Derived>
744class generic_ordering_from_three_way_compare {
757 std::enable_if_t<std::is_same<Self, Derived>::value>,
758 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>> =
nullptr>
759 ARENE_NODISCARD
friend constexpr auto operator<(Self
const& lhs, Other
const& rhs)
noexcept ->
bool {
762 static_assert(
noexcept(Derived::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
764 return Derived::three_way_compare(lhs, rhs) == strong_ordering::less;
780 std::enable_if_t<std::is_same<Self, Derived>::value>,
781 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>,
782 std::enable_if_t<!is_three_way_comparable_v<Other, Derived>>> =
nullptr>
783 ARENE_NODISCARD
friend constexpr auto operator<(Other
const& lhs, Self
const& rhs)
noexcept ->
bool {
786 static_assert(
noexcept(Derived::three_way_compare(rhs, lhs)),
"three_way_compare must be noexcept");
788 return Derived::three_way_compare(rhs, lhs) == strong_ordering::greater;
804 std::enable_if_t<std::is_same<Self, Derived>::value>,
805 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>> =
nullptr>
806 ARENE_NODISCARD
friend constexpr auto operator>(Self
const& lhs, Other
const& rhs)
noexcept ->
bool {
809 static_assert(
noexcept(Derived::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
811 return Derived::three_way_compare(lhs, rhs) == strong_ordering::greater;
827 std::enable_if_t<std::is_same<Self, Derived>::value>,
828 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>,
829 std::enable_if_t<!is_three_way_comparable_v<Other, Derived>>> =
nullptr>
830 ARENE_NODISCARD
friend constexpr auto operator>(Other
const& lhs, Self
const& rhs)
noexcept ->
bool {
833 static_assert(
noexcept(Derived::three_way_compare(rhs, lhs)),
"three_way_compare must be noexcept");
835 return Derived::three_way_compare(rhs, lhs) == strong_ordering::less;
851 std::enable_if_t<std::is_same<Self, Derived>::value>,
852 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>> =
nullptr>
853 ARENE_NODISCARD
friend constexpr auto operator<=(Self
const& lhs, Other
const& rhs)
noexcept ->
bool {
856 static_assert(
noexcept(Derived::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
858 return Derived::three_way_compare(lhs, rhs) != strong_ordering::greater;
874 std::enable_if_t<std::is_same<Self, Derived>::value>,
875 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>,
876 std::enable_if_t<!is_three_way_comparable_v<Other, Derived>>> =
nullptr>
877 ARENE_NODISCARD
friend constexpr auto operator<=(Other
const& lhs, Self
const& rhs)
noexcept ->
bool {
880 static_assert(
noexcept(Derived::three_way_compare(rhs, lhs)),
"three_way_compare must be noexcept");
882 return Derived::three_way_compare(rhs, lhs) != strong_ordering::less;
898 std::enable_if_t<std::is_same<Self, Derived>::value>,
899 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>> =
nullptr>
900 ARENE_NODISCARD
friend constexpr auto operator>=(Self
const& lhs, Other
const& rhs)
noexcept ->
bool {
903 static_assert(
noexcept(Derived::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
905 return Derived::three_way_compare(lhs, rhs) != strong_ordering::less;
921 std::enable_if_t<std::is_same<Self, Derived>::value>,
922 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>,
923 std::enable_if_t<!is_three_way_comparable_v<Other, Derived>>> =
nullptr>
924 ARENE_NODISCARD
friend constexpr auto operator>=(Other
const& lhs, Self
const& rhs)
noexcept ->
bool {
927 static_assert(
noexcept(Derived::three_way_compare(rhs, lhs)),
"three_way_compare must be noexcept");
929 return Derived::three_way_compare(rhs, lhs) != strong_ordering::greater;
945 std::enable_if_t<std::is_same<Self, Derived>::value>,
946 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>,
947 std::enable_if_t<!has_fast_inequality_check_v<Derived, Other>>> =
nullptr>
948 ARENE_NODISCARD
friend constexpr auto operator==(Self
const& lhs, Other
const& rhs)
noexcept ->
bool {
951 static_assert(
noexcept(Derived::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
953 return Derived::three_way_compare(lhs, rhs) == strong_ordering::equal;
969 std::enable_if_t<std::is_same<Self, Derived>::value>,
970 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>,
971 std::enable_if_t<has_fast_inequality_check_v<Derived, Other>>> =
nullptr>
972 ARENE_NODISCARD
friend constexpr auto operator==(Self
const& lhs, Other
const& rhs)
noexcept ->
bool {
975 static_assert(
noexcept(Derived::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
976 static_assert(
noexcept(Derived::fast_inequality_check(lhs, rhs)),
"fast_inequality_check must be noexcept");
978 return (Derived::fast_inequality_check(lhs, rhs) == inequality_heuristic::may_be_equal_or_not_equal) &&
979 (Derived::three_way_compare(lhs, rhs) == strong_ordering::equal);
996 std::enable_if_t<std::is_same<Self, Derived>::value>,
997 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>,
998 std::enable_if_t<!is_three_way_comparable_v<Other, Derived>>> =
nullptr>
999 ARENE_NODISCARD
friend constexpr auto operator==(Other
const& lhs, Self
const& rhs)
noexcept ->
bool {
1016 std::enable_if_t<std::is_same<Self, Derived>::value>,
1017 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>> =
nullptr>
1018 ARENE_NODISCARD
friend constexpr auto operator!=(Self
const& lhs, Other
const& rhs)
noexcept ->
bool {
1019 return !(lhs == rhs);
1036 std::enable_if_t<std::is_same<Self, Derived>::value>,
1037 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>,
1038 std::enable_if_t<!is_three_way_comparable_v<Other, Derived>>> =
nullptr>
1039 ARENE_NODISCARD
friend constexpr auto operator!=(Other
const& lhs, Self
const& rhs)
noexcept ->
bool {
1040 return !(lhs == rhs);
1046 constexpr generic_ordering_from_three_way_compare()
noexcept =
default;
1048 ~generic_ordering_from_three_way_compare()
noexcept =
default;
1051 constexpr generic_ordering_from_three_way_compare(generic_ordering_from_three_way_compare
const& other
1052 )
noexcept =
default;
1055 constexpr generic_ordering_from_three_way_compare(generic_ordering_from_three_way_compare&& other)
noexcept =
default;
1058 constexpr auto operator=(generic_ordering_from_three_way_compare
const& other) &
noexcept
1059 -> generic_ordering_from_three_way_compare& =
default;
1062 constexpr auto operator=(generic_ordering_from_three_way_compare&& other) &
noexcept
1063 -> generic_ordering_from_three_way_compare& =
default;
1066namespace operators_detail {
1070template <
typename Self,
typename Other>
1071constexpr bool eligible_for_reversed_equals_with_v =
1072 !std::is_same<Self, Other>::value && is_equality_comparable_v<Self, Other>;
1095template <
typename Derived>
1096class generic_ordering_from_three_way_compare_and_equals {
1108 std::enable_if_t<std::is_same<Self, Derived>::value>,
1109 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>> =
nullptr>
1110 ARENE_NODISCARD
friend constexpr auto operator<(Self
const& lhs, Other
const& rhs)
noexcept ->
bool {
1113 static_assert(
noexcept(Derived::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
1115 return Derived::three_way_compare(lhs, rhs) == strong_ordering::less;
1130 std::enable_if_t<std::is_same<Self, Derived>::value>,
1131 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>,
1132 std::enable_if_t<!is_three_way_comparable_v<Other, Derived>>> =
nullptr>
1133 ARENE_NODISCARD
friend constexpr auto operator<(Other
const& lhs, Self
const& rhs)
noexcept ->
bool {
1136 static_assert(
noexcept(Derived::three_way_compare(rhs, lhs)),
"three_way_compare must be noexcept");
1138 return Derived::three_way_compare(rhs, lhs) == strong_ordering::greater;
1153 std::enable_if_t<std::is_same<Self, Derived>::value>,
1154 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>> =
nullptr>
1155 ARENE_NODISCARD
friend constexpr auto operator>(Self
const& lhs, Other
const& rhs)
noexcept ->
bool {
1158 static_assert(
noexcept(Derived::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
1160 return Derived::three_way_compare(lhs, rhs) == strong_ordering::greater;
1175 std::enable_if_t<std::is_same<Self, Derived>::value>,
1176 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>,
1177 std::enable_if_t<!is_three_way_comparable_v<Other, Derived>>> =
nullptr>
1178 ARENE_NODISCARD
friend constexpr auto operator>(Other
const& lhs, Self
const& rhs)
noexcept ->
bool {
1181 static_assert(
noexcept(Derived::three_way_compare(rhs, lhs)),
"three_way_compare must be noexcept");
1183 return Derived::three_way_compare(rhs, lhs) == strong_ordering::less;
1198 std::enable_if_t<std::is_same<Self, Derived>::value>,
1199 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>> =
nullptr>
1200 ARENE_NODISCARD
friend constexpr auto operator<=(Self
const& lhs, Other
const& rhs)
noexcept ->
bool {
1203 static_assert(
noexcept(Derived::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
1205 return Derived::three_way_compare(lhs, rhs) != strong_ordering::greater;
1220 std::enable_if_t<std::is_same<Self, Derived>::value>,
1221 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>,
1222 std::enable_if_t<!is_three_way_comparable_v<Other, Derived>>> =
nullptr>
1223 ARENE_NODISCARD
friend constexpr auto operator<=(Other
const& lhs, Self
const& rhs)
noexcept ->
bool {
1226 static_assert(
noexcept(Derived::three_way_compare(rhs, lhs)),
"three_way_compare must be noexcept");
1228 return Derived::three_way_compare(rhs, lhs) != strong_ordering::less;
1243 std::enable_if_t<std::is_same<Self, Derived>::value>,
1244 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>> =
nullptr>
1245 ARENE_NODISCARD
friend constexpr auto operator>=(Self
const& lhs, Other
const& rhs)
noexcept ->
bool {
1248 static_assert(
noexcept(Derived::three_way_compare(lhs, rhs)),
"three_way_compare must be noexcept");
1250 return Derived::three_way_compare(lhs, rhs) != strong_ordering::less;
1265 std::enable_if_t<std::is_same<Self, Derived>::value>,
1266 std::enable_if_t<is_three_way_comparable_v<Derived, Other>>,
1267 std::enable_if_t<!is_three_way_comparable_v<Other, Derived>>> =
nullptr>
1268 ARENE_NODISCARD
friend constexpr auto operator>=(Other
const& lhs, Self
const& rhs)
noexcept ->
bool {
1271 static_assert(
noexcept(Derived::three_way_compare(rhs, lhs)),
"three_way_compare must be noexcept");
1273 return Derived::three_way_compare(rhs, lhs) != strong_ordering::greater;
1288 std::enable_if_t<std::is_same<Self, Derived>::value>,
1289 std::enable_if_t<operators_detail::eligible_for_reversed_equals_with_v<Self, Other>>> =
nullptr>
1290 ARENE_NODISCARD
friend constexpr auto operator==(Other
const& lhs, Self
const& rhs)
noexcept ->
bool {
1306 std::enable_if_t<std::is_same<Self, Derived>::value>,
1307 std::enable_if_t<is_equality_comparable_v<Self, Other>>> =
nullptr>
1308 ARENE_NODISCARD
friend constexpr auto operator!=(Self
const& lhs, Other
const& rhs)
noexcept ->
bool {
1309 return !(lhs == rhs);
1324 std::enable_if_t<std::is_same<Self, Derived>::value>,
1325 std::enable_if_t<operators_detail::eligible_for_reversed_equals_with_v<Self, Other>>> =
nullptr>
1326 ARENE_NODISCARD
friend constexpr auto operator!=(Other
const& lhs, Self
const& rhs)
noexcept ->
bool {
1327 return !(lhs == rhs);
1332 constexpr generic_ordering_from_three_way_compare_and_equals()
noexcept =
default;
1334 ~generic_ordering_from_three_way_compare_and_equals()
noexcept =
default;
1337 constexpr generic_ordering_from_three_way_compare_and_equals(
1338 generic_ordering_from_three_way_compare_and_equals
const& other
1339 )
noexcept =
default;
1342 constexpr generic_ordering_from_three_way_compare_and_equals(
1343 generic_ordering_from_three_way_compare_and_equals&& other
1344 )
noexcept =
default;
1347 constexpr auto operator=(generic_ordering_from_three_way_compare_and_equals
const& other) &
noexcept
1348 -> generic_ordering_from_three_way_compare_and_equals& =
default;
1351 constexpr auto operator=(generic_ordering_from_three_way_compare_and_equals&& other) &
noexcept
1352 -> generic_ordering_from_three_way_compare_and_equals& =
default;
Definition array_exceptions_disabled.cpp:11
ARENE_IGNORE_ALL("-Wfloat-equal", "Equality is used to check the properties of a single value, not compare two values")
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10