30 template <
typename L,
typename R>
31 constexpr requires_t<bool, is_equality_comparable<L, R>> operator()(L&& l, R&& r)
const noexcept(
noexcept(l == r)) {
38class equality_operators {
39 template <
typename L,
typename R>
40 constexpr static auto impl(rank<1>, L& l, R& r) BSONCXX_PRIVATE_RETURNS(tag_invoke(equal_to{}, l, r));
42 template <
typename L,
typename R>
43 constexpr static auto impl(rank<0>, L& l, R& r) BSONCXX_PRIVATE_RETURNS(tag_invoke(equal_to{}, r, l));
46 template <
typename Left,
typename Other>
47 constexpr friend auto operator==(Left
const& self, Other
const& other)
48 BSONCXX_PRIVATE_RETURNS(equality_operators::impl(rank<1>{}, self, other));
52 template <
typename Left,
typename Other>
53 constexpr friend auto operator!=(Left
const& self, Other
const& other)
54 BSONCXX_PRIVATE_RETURNS(!equality_operators::impl(rank<1>{}, self, other));
61class strong_ordering {
65 constexpr strong_ordering(_construct,
signed char c) noexcept : _c(c) {}
68 static strong_ordering
const less;
69 static strong_ordering
const greater;
70 static strong_ordering
const equivalent;
71 static strong_ordering
const equal;
73 constexpr strong_ordering(std::nullptr_t) noexcept : strong_ordering(_construct{}, 0) {}
75 constexpr bool operator==(strong_ordering o)
const noexcept {
78 constexpr bool operator!=(strong_ordering o)
const noexcept {
81#pragma push_macro("DEFOP")
84 constexpr bool operator Op(std::nullptr_t) const noexcept { \
87 static_assert(true, "")
92#pragma pop_macro("DEFOP")
95 constexpr strong_ordering inverted() const noexcept;
98BSONCXX_PRIVATE_INLINE_CXX17 strong_ordering const strong_ordering::less =
99 strong_ordering(strong_ordering::_construct{}, -1);
100BSONCXX_PRIVATE_INLINE_CXX17 strong_ordering
const strong_ordering::greater =
101 strong_ordering(strong_ordering::_construct{}, 1);
102BSONCXX_PRIVATE_INLINE_CXX17 strong_ordering
const strong_ordering::equivalent =
103 strong_ordering(strong_ordering::_construct{}, 0);
104BSONCXX_PRIVATE_INLINE_CXX17 strong_ordering
const strong_ordering::equal =
105 strong_ordering(strong_ordering::_construct{}, 0);
108inline constexpr strong_ordering strong_ordering::inverted() const noexcept {
109 return *this < nullptr ? greater : *this >
nullptr ? less : *
this;
115struct compare_three_way {
116 BSONCXX_PRIVATE_WARNINGS_PUSH();
117 BSONCXX_PRIVATE_WARNINGS_DISABLE(GNU(
"-Wfloat-equal"));
121 typename =
decltype(std::declval<L>() < std::declval<R>()),
122 typename =
decltype(std::declval<L>() == std::declval<R>())>
123 constexpr static strong_ordering impl(L
const& l, R
const& r, rank<1>) {
124 return (l < r) ? strong_ordering::less : (l == r ? strong_ordering::equal : strong_ordering::greater);
126 BSONCXX_PRIVATE_WARNINGS_POP();
131 typename =
decltype(tag_invoke(std::declval<compare_three_way>(), std::declval<L>(), std::declval<R>()))>
132 constexpr static strong_ordering impl(L
const& l, R
const& r, rank<2>) {
133 return tag_invoke(compare_three_way{}, l, r);
136 template <
typename L,
typename R>
137 constexpr auto operator()(L
const& l, R
const& r)
const BSONCXX_PRIVATE_RETURNS((impl)(l, r, rank<2>{}));
142struct ordering_operators {
143 template <
typename L,
typename R>
144 constexpr static auto impl(L
const& l, R
const& r, rank<1>)
145 BSONCXX_PRIVATE_RETURNS(tag_invoke(compare_three_way{}, l, r));
147 template <
typename L,
typename R>
148 constexpr static auto impl(L
const& l, R
const& r, rank<0>)
149 BSONCXX_PRIVATE_RETURNS(tag_invoke(compare_three_way{}, r, l).inverted());
151#pragma push_macro("DEFOP")
154 template <typename L, typename R> \
155 constexpr friend auto operator Oper(L const& l, R const& r) \
156 BSONCXX_PRIVATE_RETURNS(ordering_operators::impl(l, r, rank<1>{}) Oper nullptr)
161#pragma pop_macro("DEFOP")
The bsoncxx v1 macro guard postlude header.
The bsoncxx v1 macro guard prelude header.
bool operator!=(element const &lhs, v_noabi::types::bson_value::view const &rhs)
Convenience methods to compare for equality against a bson_value.
Definition element.hpp:105
The top-level namespace within which all bsoncxx library entities are declared.
bool operator==(view_or_value< View, Value > const &lhs, view_or_value< View, Value > const &rhs)
Compare view_or_value objects for (in)equality.
Definition view_or_value.hpp:151