|
26 | 26 | namespace bsoncxx {
|
27 | 27 | namespace detail {
|
28 | 28 |
|
29 |
| -template <typename L, typename R> |
30 |
| -auto is_equality_comparable_f(...) -> std::false_type; |
31 |
| - |
32 |
| -BSONCXX_PRIVATE_WARNINGS_PUSH(); |
33 |
| -BSONCXX_PRIVATE_WARNINGS_DISABLE(GNU("-Wfloat-equal")); |
34 |
| -template <typename L, typename R> |
35 |
| -auto is_equality_comparable_f(int, bool b = false) |
36 |
| - -> true_t< |
37 |
| - decltype((std::declval<L const&>() == std::declval<R const&>()) ? 0 : 0, (std::declval<R const&>() == std::declval<L const&>()) ? 0 : 0, (std::declval<L const&>() != std::declval<R const&>()) ? 0 : 0, (std::declval<R const&>() != std::declval<L const&>()) ? 0 : 0)>; |
38 |
| -BSONCXX_PRIVATE_WARNINGS_POP(); |
39 |
| - |
40 |
| -// Detect whether two types are equality-comparable. |
41 |
| -// |
42 |
| -// Requires L == R, L != R, R == L, and R != L. |
43 |
| -template <typename L, typename R = L> |
44 |
| -struct is_equality_comparable : decltype(is_equality_comparable_f<L, R>(0)) {}; |
45 |
| - |
46 | 29 | // Callable object and tag type for equality comparison.
|
47 | 30 | struct equal_to {
|
48 | 31 | template <typename L, typename R>
|
@@ -180,33 +163,6 @@ struct ordering_operators {
|
180 | 163 | #pragma pop_macro("DEFOP")
|
181 | 164 | };
|
182 | 165 |
|
183 |
| -template <typename L, typename R> |
184 |
| -std::false_type is_partially_ordered_with_f(rank<0>); |
185 |
| - |
186 |
| -template <typename L, typename R> |
187 |
| -auto is_partially_ordered_with_f(rank<1>) -> true_t< |
188 |
| - decltype(std::declval<L const&>() > std::declval<R const&>()), |
189 |
| - decltype(std::declval<L const&>() < std::declval<R const&>()), |
190 |
| - decltype(std::declval<L const&>() >= std::declval<R const&>()), |
191 |
| - decltype(std::declval<L const&>() <= std::declval<R const&>()), |
192 |
| - decltype(std::declval<R const&>() < std::declval<L const&>()), |
193 |
| - decltype(std::declval<R const&>() > std::declval<L const&>()), |
194 |
| - decltype(std::declval<R const&>() <= std::declval<L const&>()), |
195 |
| - decltype(std::declval<R const&>() >= std::declval<L const&>())>; |
196 |
| - |
197 |
| -template <typename T, typename U> |
198 |
| -struct is_partially_ordered_with : decltype(is_partially_ordered_with_f<T, U>(rank<1>{})) {}; |
199 |
| - |
200 |
| -template <typename T> |
201 |
| -struct is_totally_ordered : conjunction<is_equality_comparable<T>, is_partially_ordered_with<T, T>> {}; |
202 |
| - |
203 |
| -template <typename T, typename U> |
204 |
| -struct is_totally_ordered_with : conjunction< |
205 |
| - is_totally_ordered<T>, |
206 |
| - is_totally_ordered<U>, |
207 |
| - is_equality_comparable<T, U>, |
208 |
| - is_partially_ordered_with<T, U>> {}; |
209 |
| - |
210 | 166 | } // namespace detail
|
211 | 167 | } // namespace bsoncxx
|
212 | 168 |
|
|
0 commit comments