Skip to content

Commit 0233dc1

Browse files
committed
Don't split definitions of equality_comparable_with/totally_ordered_with
1 parent a777781 commit 0233dc1

File tree

4 files changed

+17
-37
lines changed

4 files changed

+17
-37
lines changed

libcxx/include/__compare/three_way_comparable.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ concept three_way_comparable =
3838
{ __a <=> __b } -> __compares_as<_Cat>;
3939
};
4040

41-
# if _LIBCPP_STD_VER >= 23
42-
4341
template <class _Tp, class _Up, class _Cat = partial_ordering>
4442
concept three_way_comparable_with =
4543
three_way_comparable<_Tp, _Cat> && three_way_comparable<_Up, _Cat> && __comparison_common_type_with<_Tp, _Up> &&
@@ -50,21 +48,6 @@ concept three_way_comparable_with =
5048
{ __u <=> __t } -> __compares_as<_Cat>;
5149
};
5250

53-
# else
54-
55-
template <class _Tp, class _Up, class _Cat = partial_ordering>
56-
concept three_way_comparable_with =
57-
three_way_comparable<_Tp, _Cat> && three_way_comparable<_Up, _Cat> &&
58-
common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
59-
three_way_comparable<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>, _Cat> &&
60-
__weakly_equality_comparable_with<_Tp, _Up> && __partially_ordered_with<_Tp, _Up> &&
61-
requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
62-
{ __t <=> __u } -> __compares_as<_Cat>;
63-
{ __u <=> __t } -> __compares_as<_Cat>;
64-
};
65-
66-
# endif // _LIBCPP_STD_VER >= 23
67-
6851
#endif // _LIBCPP_STD_VER >= 20
6952

7053
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__concepts/comparison_common_type.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,28 @@
99
#ifndef _LIBCPP___CONCEPTS_COMPARISON_COMMON_TYPE_H
1010
#define _LIBCPP___CONCEPTS_COMPARISON_COMMON_TYPE_H
1111

12+
#include "__concepts/common_reference_with.h"
1213
#include "__concepts/convertible_to.h"
1314
#include "__concepts/same_as.h"
1415
#include "__config"
1516
#include "__type_traits/common_reference.h"
17+
#include "__type_traits/make_const_lvalue_ref.h"
1618

1719
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1820
# pragma GCC system_header
1921
#endif
2022

2123
_LIBCPP_BEGIN_NAMESPACE_STD
2224

23-
#if _LIBCPP_STD_VER >= 23
25+
#if _LIBCPP_STD_VER >= 20
26+
27+
# if _LIBCPP_STD_VER < 23
28+
29+
template <class _Tp, class _Up>
30+
concept __comparison_common_type_with =
31+
common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>;
32+
33+
# else
2434

2535
template <class _Tp, class _Up, class _CommonRef = common_reference_t<const _Tp&, const _Up&>>
2636
concept __comparison_common_type_with_impl =
@@ -32,7 +42,9 @@ concept __comparison_common_type_with_impl =
3242
template <class _Tp, class _Up>
3343
concept __comparison_common_type_with = __comparison_common_type_with_impl<remove_cvref_t<_Tp>, remove_cvref_t<_Up>>;
3444

35-
#endif // _LIBCPP_STD_VER >= 23
45+
# endif // _LIBCPP_STD_VER < 23
46+
47+
#endif // _LIBCPP_STD_VER >= 20
3648

3749
_LIBCPP_END_NAMESPACE_STD
3850

libcxx/include/__concepts/equality_comparable.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ concept __weakly_equality_comparable_with =
3838
template <class _Tp>
3939
concept equality_comparable = __weakly_equality_comparable_with<_Tp, _Tp>;
4040

41-
# if _LIBCPP_STD_VER >= 23
42-
4341
// clang-format off
4442
template <class _Tp, class _Up>
4543
concept equality_comparable_with =
@@ -52,22 +50,6 @@ concept equality_comparable_with =
5250
__weakly_equality_comparable_with<_Tp, _Up>;
5351
// clang-format on
5452

55-
# else
56-
57-
// clang-format off
58-
template <class _Tp, class _Up>
59-
concept equality_comparable_with =
60-
equality_comparable<_Tp> && equality_comparable<_Up> &&
61-
common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
62-
equality_comparable<
63-
common_reference_t<
64-
__make_const_lvalue_ref<_Tp>,
65-
__make_const_lvalue_ref<_Up>>> &&
66-
__weakly_equality_comparable_with<_Tp, _Up>;
67-
// clang-format on
68-
69-
# endif // _LIBCPP_STD_VER >= 23
70-
7153
#endif // _LIBCPP_STD_VER >= 20
7254

7355
_LIBCPP_END_NAMESPACE_STD

libcxx/test/support/compare_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,9 @@ struct nonmovable_equality_with_int {
548548
nonmovable_equality_with_int(nonmovable_equality_with_int&&) = delete;
549549
nonmovable_equality_with_int& operator=(nonmovable_equality_with_int&&) = delete;
550550

551+
nonmovable_equality_with_int(nonmovable_equality_with_int const&) = delete;
552+
nonmovable_equality_with_int& operator=(nonmovable_equality_with_int const&) = delete;
553+
551554
friend bool operator==(nonmovable_equality_with_int const&, nonmovable_equality_with_int const&) = default;
552555
friend bool operator==(nonmovable_equality_with_int const&, int);
553556
};

0 commit comments

Comments
 (0)