Commit 256f67aa by Jonathan Wakely

libstdc++: Simplify std::three_way_comparable_with (LWG 3360)

This also removes a useless condition that was supposed to be removed by
the P1959R0 changes, but left in when that was implemented.

	* libsupc++/compare (three_way_comparable): Remove always-false check
	that should have been removed with weak_equality (P1959R0).
	(three_way_comparable_with): Likewise. Reorder requirements (LWG 3360).
parent 0294dc5f
2020-02-19 Jonathan Wakely <jwakely@redhat.com> 2020-02-19 Jonathan Wakely <jwakely@redhat.com>
* libsupc++/compare (three_way_comparable): Remove always-false check
that should have been removed with weak_equality (P1959R0).
(three_way_comparable_with): Likewise. Reorder requirements (LWG 3360).
* include/std/concepts (__detail::__partially_ordered_with): Move here * include/std/concepts (__detail::__partially_ordered_with): Move here
from <compare>. from <compare>.
(totally_ordered, totally_ordered_with): Use __partially_ordered_with (totally_ordered, totally_ordered_with): Use __partially_ordered_with
......
...@@ -417,8 +417,7 @@ namespace std ...@@ -417,8 +417,7 @@ namespace std
template<typename _Tp, typename _Cat = partial_ordering> template<typename _Tp, typename _Cat = partial_ordering>
concept three_way_comparable concept three_way_comparable
= __detail::__weakly_eq_cmp_with<_Tp, _Tp> = __detail::__weakly_eq_cmp_with<_Tp, _Tp>
&& (!convertible_to<_Cat, partial_ordering> && __detail::__partially_ordered_with<_Tp, _Tp>
|| __detail::__partially_ordered_with<_Tp, _Tp>)
&& requires(const remove_reference_t<_Tp>& __a, && requires(const remove_reference_t<_Tp>& __a,
const remove_reference_t<_Tp>& __b) { const remove_reference_t<_Tp>& __b) {
{ __a <=> __b } -> __detail::__compares_as<_Cat>; { __a <=> __b } -> __detail::__compares_as<_Cat>;
...@@ -426,16 +425,15 @@ namespace std ...@@ -426,16 +425,15 @@ namespace std
template<typename _Tp, typename _Up, typename _Cat = partial_ordering> template<typename _Tp, typename _Up, typename _Cat = partial_ordering>
concept three_way_comparable_with concept three_way_comparable_with
= __detail::__weakly_eq_cmp_with<_Tp, _Up> = three_way_comparable<_Tp, _Cat>
&& (!convertible_to<_Cat, partial_ordering>
|| __detail::__partially_ordered_with<_Tp, _Up>)
&& three_way_comparable<_Tp, _Cat>
&& three_way_comparable<_Up, _Cat> && three_way_comparable<_Up, _Cat>
&& common_reference_with<const remove_reference_t<_Tp>&, && common_reference_with<const remove_reference_t<_Tp>&,
const remove_reference_t<_Up>&> const remove_reference_t<_Up>&>
&& three_way_comparable< && three_way_comparable<
common_reference_t<const remove_reference_t<_Tp>&, common_reference_t<const remove_reference_t<_Tp>&,
const remove_reference_t<_Up>&>, _Cat> const remove_reference_t<_Up>&>, _Cat>
&& __detail::__weakly_eq_cmp_with<_Tp, _Up>
&& __detail::__partially_ordered_with<_Tp, _Up>
&& requires(const remove_reference_t<_Tp>& __t, && requires(const remove_reference_t<_Tp>& __t,
const remove_reference_t<_Up>& __u) { const remove_reference_t<_Up>& __u) {
{ __t <=> __u } -> __detail::__compares_as<_Cat>; { __t <=> __u } -> __detail::__compares_as<_Cat>;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment