Commit 73a0a21d by Jonathan Wakely

libstdc++: Update __cpp_lib_three_way_comparison macro

With P1614R2 fully implemented (except for the <chrono> types which we
don't support at all) we can define the feature test macro to the new
value.

	* include/std/version (__cpp_lib_three_way_comparison): Update value.
	* libsupc++/compare (__cpp_lib_three_way_comparison): Likewise.
parent 93843da6
2020-04-20 Jonathan Wakely <jwakely@redhat.com> 2020-04-20 Jonathan Wakely <jwakely@redhat.com>
* include/std/version (__cpp_lib_three_way_comparison): Update value.
* libsupc++/compare (__cpp_lib_three_way_comparison): Likewise.
* include/bits/stl_map.h (map): Define operator<=> and remove * include/bits/stl_map.h (map): Define operator<=> and remove
operator< for C++20. operator< for C++20.
* include/bits/stl_multimap.h (multimap): Likewise. * include/bits/stl_multimap.h (multimap): Likewise.
......
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
#endif #endif
#define __cpp_lib_span 202002L #define __cpp_lib_span 202002L
#if __cpp_impl_three_way_comparison >= 201907L && __cpp_lib_concepts #if __cpp_impl_three_way_comparison >= 201907L && __cpp_lib_concepts
# define __cpp_lib_three_way_comparison 201711L # define __cpp_lib_three_way_comparison 201907L
#endif #endif
#define __cpp_lib_to_array 201907L #define __cpp_lib_to_array 201907L
#endif #endif
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include <concepts> #include <concepts>
#if __cpp_lib_concepts #if __cpp_lib_concepts
# define __cpp_lib_three_way_comparison 201711L # define __cpp_lib_three_way_comparison 201907L
#endif #endif
namespace std namespace std
...@@ -866,12 +866,23 @@ namespace std ...@@ -866,12 +866,23 @@ namespace std
namespace __detail namespace __detail
{ {
// [expos.only.func] // [expos.only.func] synth-three-way
inline constexpr struct _Synth3way inline constexpr struct _Synth3way
{ {
template<typename _Tp, typename _Up> template<typename _Tp, typename _Up>
static constexpr bool
_S_noexcept(const _Tp* __t = nullptr, const _Up* __u = nullptr)
{
if constexpr (three_way_comparable_with<_Tp, _Up>)
return noexcept(*__t <=> *__u);
else
return noexcept(*__t < *__u) && noexcept(*__u < *__t);
}
template<typename _Tp, typename _Up>
constexpr auto constexpr auto
operator()(const _Tp& __t, const _Up& __u) const operator()(const _Tp& __t, const _Up& __u) const
noexcept(_S_noexcept<_Tp, _Up>())
requires requires requires requires
{ {
{ __t < __u } -> __boolean_testable; { __t < __u } -> __boolean_testable;
...@@ -892,6 +903,7 @@ namespace std ...@@ -892,6 +903,7 @@ namespace std
} }
} __synth3way = {}; } __synth3way = {};
// [expos.only.func] synth-three-way-result
template<typename _Tp, typename _Up = _Tp> template<typename _Tp, typename _Up = _Tp>
using __synth3way_t using __synth3way_t
= decltype(__detail::__synth3way(std::declval<_Tp&>(), = decltype(__detail::__synth3way(std::declval<_Tp&>(),
......
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