2019-07-12 Jonathan Wakely <jwakely@redhat.com>
+ * include/experimental/string_view (__detail::__idt): Remove.
+ (operator==, operator!=, operator<, operator>, operator<=, operator>=):
+ Use __type_identity_t instead of __detail::__idt;
+ * include/std/string_view (__detail::__idt): Remove.
+ (operator==, operator!=, operator<, operator>, operator<=, operator>=):
+ Use __type_identity_t instead of __detail::__idt;
+ * include/std/type_traits (__type_identity_t): New alias template.
+
* doc/xml/manual/status_cxx2020.xml: Update status for atomic_ref
and floating point atomics.
// [string.view.comparison], non-member basic_string_view comparison functions
- namespace __detail
- {
- // Identity transform to create a non-deduced context, so that only one
- // argument participates in template argument deduction and the other
- // argument gets implicitly converted to the deduced type. See n3766.html.
- template<typename _Tp>
- using __idt = common_type_t<_Tp>;
- }
+ // Several of these functions use type_identity_t to create a non-deduced
+ // context, so that only one argument participates in template argument
+ // deduction and the other argument gets implicitly converted to the deduced
+ // type (see N3766).
template<typename _CharT, typename _Traits>
constexpr bool
template<typename _CharT, typename _Traits>
constexpr bool
operator==(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+ noexcept
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
constexpr bool
- operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator!=(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+ noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
constexpr bool
- operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
constexpr bool
operator< (basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+ noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
constexpr bool
- operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator> (basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+ noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
constexpr bool
- operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator<=(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+ noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
constexpr bool
- operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ operator<=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator>=(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+ noexcept
{ return __x.compare(__y) >= 0; }
template<typename _CharT, typename _Traits>
constexpr bool
- operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ operator>=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) >= 0; }
// [string.view.comparison], non-member basic_string_view comparison function
- namespace __detail
- {
- // Identity transform to create a non-deduced context, so that only one
- // argument participates in template argument deduction and the other
- // argument gets implicitly converted to the deduced type. See n3766.html.
- template<typename _Tp>
- using __idt = common_type_t<_Tp>;
- }
+ // Several of these functions use type_identity_t to create a non-deduced
+ // context, so that only one argument participates in template argument
+ // deduction and the other argument gets implicitly converted to the deduced
+ // type (see N3766).
template<typename _CharT, typename _Traits>
constexpr bool
template<typename _CharT, typename _Traits>
constexpr bool
operator==(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+ noexcept
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
constexpr bool
- operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.size() == __y.size() && __x.compare(__y) == 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator!=(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+ noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
constexpr bool
- operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return !(__x == __y); }
template<typename _CharT, typename _Traits>
constexpr bool
operator< (basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+ noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
constexpr bool
- operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) < 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator> (basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+ noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
constexpr bool
- operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) > 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator<=(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+ noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
constexpr bool
- operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ operator<=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) <= 0; }
template<typename _CharT, typename _Traits>
constexpr bool
operator>=(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+ __type_identity_t<basic_string_view<_CharT, _Traits>> __y)
+ noexcept
{ return __x.compare(__y) >= 0; }
template<typename _CharT, typename _Traits>
constexpr bool
- operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ operator>=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
basic_string_view<_CharT, _Traits> __y) noexcept
{ return __x.compare(__y) >= 0; }
struct conditional;
template <typename _Type>
- struct __type_identity {
- using type = _Type;
- };
+ struct __type_identity
+ { using type = _Type; };
+
+ template<typename _Tp>
+ using __type_identity_t = typename __type_identity<_Tp>::type;
template<typename...>
struct __or_;