diff --git a/libcxx/include/__memory/unique_ptr.h b/libcxx/include/__memory/unique_ptr.h --- a/libcxx/include/__memory/unique_ptr.h +++ b/libcxx/include/__memory/unique_ptr.h @@ -138,7 +138,7 @@ typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; template , _Dummy>::type> + __type_identity, _Dummy>::type> using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG = typename enable_if::value && !is_pointer<_Deleter>::value>::type; @@ -352,7 +352,7 @@ typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type; template , _Dummy>::type> + __type_identity, _Dummy>::type> using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG = typename enable_if::value && !is_pointer<_Deleter>::value>::type; diff --git a/libcxx/include/deque b/libcxx/include/deque --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -1314,7 +1314,7 @@ deque(_InputIter __f, _InputIter __l, const allocator_type& __a, typename enable_if<__is_cpp17_input_iterator<_InputIter>::value>::type* = 0); deque(const deque& __c); - deque(const deque& __c, const __identity_t& __a); + deque(const deque& __c, const __type_identity_t& __a); deque& operator=(const deque& __c); @@ -1328,7 +1328,7 @@ _LIBCPP_INLINE_VISIBILITY deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value); _LIBCPP_INLINE_VISIBILITY - deque(deque&& __c, const __identity_t& __a); + deque(deque&& __c, const __type_identity_t& __a); _LIBCPP_INLINE_VISIBILITY deque& operator=(deque&& __c) _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value && @@ -1650,7 +1650,7 @@ } template -deque<_Tp, _Allocator>::deque(const deque& __c, const __identity_t& __a) +deque<_Tp, _Allocator>::deque(const deque& __c, const __type_identity_t& __a) : __base(__a) { __append(__c.begin(), __c.end()); @@ -1693,7 +1693,7 @@ template inline -deque<_Tp, _Allocator>::deque(deque&& __c, const __identity_t& __a) +deque<_Tp, _Allocator>::deque(deque&& __c, const __type_identity_t& __a) : __base(_VSTD::move(__c), __a) { if (__a != __c.__alloc()) diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list --- a/libcxx/include/forward_list +++ b/libcxx/include/forward_list @@ -691,7 +691,7 @@ __is_cpp17_input_iterator<_InputIterator>::value >::type* = nullptr); forward_list(const forward_list& __x); - forward_list(const forward_list& __x, const __identity_t& __a); + forward_list(const forward_list& __x, const __type_identity_t& __a); forward_list& operator=(const forward_list& __x); @@ -700,7 +700,7 @@ forward_list(forward_list&& __x) _NOEXCEPT_(is_nothrow_move_constructible::value) : base(_VSTD::move(__x)) {} - forward_list(forward_list&& __x, const __identity_t& __a); + forward_list(forward_list&& __x, const __type_identity_t& __a); forward_list(initializer_list __il); forward_list(initializer_list __il, const allocator_type& __a); @@ -983,7 +983,7 @@ template forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x, - const __identity_t& __a) + const __type_identity_t& __a) : base(__a) { insert_after(cbefore_begin(), __x.begin(), __x.end()); @@ -1004,7 +1004,7 @@ #ifndef _LIBCPP_CXX03_LANG template forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, - const __identity_t& __a) + const __type_identity_t& __a) : base(_VSTD::move(__x), __a) { if (base::__alloc() != __x.__alloc()) diff --git a/libcxx/include/list b/libcxx/include/list --- a/libcxx/include/list +++ b/libcxx/include/list @@ -883,7 +883,7 @@ typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type* = 0); list(const list& __c); - list(const list& __c, const __identity_t& __a); + list(const list& __c, const __type_identity_t& __a); _LIBCPP_INLINE_VISIBILITY list& operator=(const list& __c); #ifndef _LIBCPP_CXX03_LANG @@ -894,7 +894,7 @@ list(list&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value); _LIBCPP_INLINE_VISIBILITY - list(list&& __c, const __identity_t& __a); + list(list&& __c, const __type_identity_t& __a); _LIBCPP_INLINE_VISIBILITY list& operator=(list&& __c) _NOEXCEPT_( @@ -1255,7 +1255,7 @@ } template -list<_Tp, _Alloc>::list(const list& __c, const __identity_t& __a) +list<_Tp, _Alloc>::list(const list& __c, const __type_identity_t& __a) : base(__a) { _VSTD::__debug_db_insert_c(this); @@ -1294,7 +1294,7 @@ template inline -list<_Tp, _Alloc>::list(list&& __c, const __identity_t& __a) +list<_Tp, _Alloc>::list(list&& __c, const __type_identity_t& __a) : base(__a) { _VSTD::__debug_db_insert_c(this); diff --git a/libcxx/include/map b/libcxx/include/map --- a/libcxx/include/map +++ b/libcxx/include/map @@ -958,8 +958,8 @@ typedef _Key key_type; typedef _Tp mapped_type; typedef pair value_type; - typedef __identity_t<_Compare> key_compare; - typedef __identity_t<_Allocator> allocator_type; + typedef __type_identity_t<_Compare> key_compare; + typedef __type_identity_t<_Allocator> allocator_type; typedef value_type& reference; typedef const value_type& const_reference; @@ -1743,8 +1743,8 @@ typedef _Key key_type; typedef _Tp mapped_type; typedef pair value_type; - typedef __identity_t<_Compare> key_compare; - typedef __identity_t<_Allocator> allocator_type; + typedef __type_identity_t<_Compare> key_compare; + typedef __type_identity_t<_Allocator> allocator_type; typedef value_type& reference; typedef const value_type& const_reference; diff --git a/libcxx/include/set b/libcxx/include/set --- a/libcxx/include/set +++ b/libcxx/include/set @@ -503,9 +503,9 @@ // types: typedef _Key key_type; typedef key_type value_type; - typedef __identity_t<_Compare> key_compare; + typedef __type_identity_t<_Compare> key_compare; typedef key_compare value_compare; - typedef __identity_t<_Allocator> allocator_type; + typedef __type_identity_t<_Allocator> allocator_type; typedef value_type& reference; typedef const value_type& const_reference; @@ -1036,9 +1036,9 @@ // types: typedef _Key key_type; typedef key_type value_type; - typedef __identity_t<_Compare> key_compare; + typedef __type_identity_t<_Compare> key_compare; typedef key_compare value_compare; - typedef __identity_t<_Allocator> allocator_type; + typedef __type_identity_t<_Allocator> allocator_type; typedef value_type& reference; typedef const value_type& const_reference; diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -529,12 +529,6 @@ template struct __void_t { typedef void type; }; -template -struct __identity { typedef _Tp type; }; - -template -using __identity_t _LIBCPP_NODEBUG = typename __identity<_Tp>::type; - template struct _LIBCPP_TEMPLATE_VIS __dependent_type : public _Tp {}; @@ -1333,6 +1327,13 @@ #endif // type_identity + +template +struct __type_identity { typedef _Tp type; }; + +template +using __type_identity_t _LIBCPP_NODEBUG = typename __type_identity<_Tp>::type; + #if _LIBCPP_STD_VER > 17 template struct type_identity { typedef _Tp type; }; template using type_identity_t = typename type_identity<_Tp>::type; diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -1014,9 +1014,9 @@ // types typedef _Key key_type; typedef _Tp mapped_type; - typedef __identity_t<_Hash> hasher; - typedef __identity_t<_Pred> key_equal; - typedef __identity_t<_Alloc> allocator_type; + typedef __type_identity_t<_Hash> hasher; + typedef __type_identity_t<_Pred> key_equal; + typedef __type_identity_t<_Alloc> allocator_type; typedef pair value_type; typedef value_type& reference; typedef const value_type& const_reference; @@ -1908,9 +1908,9 @@ // types typedef _Key key_type; typedef _Tp mapped_type; - typedef __identity_t<_Hash> hasher; - typedef __identity_t<_Pred> key_equal; - typedef __identity_t<_Alloc> allocator_type; + typedef __type_identity_t<_Hash> hasher; + typedef __type_identity_t<_Pred> key_equal; + typedef __type_identity_t<_Alloc> allocator_type; typedef pair value_type; typedef value_type& reference; typedef const value_type& const_reference; diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set --- a/libcxx/include/unordered_set +++ b/libcxx/include/unordered_set @@ -490,9 +490,9 @@ // types typedef _Value key_type; typedef key_type value_type; - typedef __identity_t<_Hash> hasher; - typedef __identity_t<_Pred> key_equal; - typedef __identity_t<_Alloc> allocator_type; + typedef __type_identity_t<_Hash> hasher; + typedef __type_identity_t<_Pred> key_equal; + typedef __type_identity_t<_Alloc> allocator_type; typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same::value), @@ -1150,9 +1150,9 @@ // types typedef _Value key_type; typedef key_type value_type; - typedef __identity_t<_Hash> hasher; - typedef __identity_t<_Pred> key_equal; - typedef __identity_t<_Alloc> allocator_type; + typedef __type_identity_t<_Hash> hasher; + typedef __type_identity_t<_Pred> key_equal; + typedef __type_identity_t<_Alloc> allocator_type; typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same::value), diff --git a/libcxx/include/variant b/libcxx/include/variant --- a/libcxx/include/variant +++ b/libcxx/include/variant @@ -562,7 +562,7 @@ inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_fdiagonal_impl() { return __make_dispatch<_Fp, _Vs...>( - index_sequence<((void)__identity<_Vs>{}, _Ip)...>{}); + index_sequence<((void)__type_identity<_Vs>{}, _Ip)...>{}); } template @@ -1202,12 +1202,12 @@ struct __no_narrowing_check { template - using _Apply = __identity<_Dest>; + using _Apply = __type_identity<_Dest>; }; struct __narrowing_check { template - static auto __test_impl(_Dest (&&)[1]) -> __identity<_Dest>; + static auto __test_impl(_Dest (&&)[1]) -> __type_identity<_Dest>; template using _Apply _LIBCPP_NODEBUG = decltype(__test_impl<_Dest>({declval<_Source>()})); }; @@ -1233,7 +1233,7 @@ struct __overload_bool { template > auto operator()(bool, _Up&&) const - -> enable_if_t, __identity<_Tp>>; + -> enable_if_t, __type_identity<_Tp>>; }; template diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -423,7 +423,7 @@ } vector(const vector& __x); - vector(const vector& __x, const __identity_t& __a); + vector(const vector& __x, const __type_identity_t& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(const vector& __x); @@ -443,7 +443,7 @@ #endif _LIBCPP_INLINE_VISIBILITY - vector(vector&& __x, const __identity_t& __a); + vector(vector&& __x, const __type_identity_t& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __x) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); @@ -1179,7 +1179,7 @@ } template -vector<_Tp, _Allocator>::vector(const vector& __x, const __identity_t& __a) +vector<_Tp, _Allocator>::vector(const vector& __x, const __type_identity_t& __a) : __end_cap_(nullptr, __a) { _VSTD::__debug_db_insert_c(this); @@ -1215,7 +1215,7 @@ template inline _LIBCPP_INLINE_VISIBILITY -vector<_Tp, _Allocator>::vector(vector&& __x, const __identity_t& __a) +vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t& __a) : __end_cap_(nullptr, __a) { _VSTD::__debug_db_insert_c(this); @@ -2148,7 +2148,7 @@ #else _NOEXCEPT_(is_nothrow_move_constructible::value); #endif - vector(vector&& __v, const __identity_t& __a); + vector(vector&& __v, const __type_identity_t& __a); _LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __v) _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value)); @@ -2784,7 +2784,7 @@ } template -vector::vector(vector&& __v, const __identity_t& __a) +vector::vector(vector&& __v, const __type_identity_t& __a) : __begin_(nullptr), __size_(0), __cap_alloc_(0, __a)