diff --git a/libcxx/include/__algorithm/make_projected.h b/libcxx/include/__algorithm/make_projected.h index 61055fcdf30d..defda468b4ba 100644 --- a/libcxx/include/__algorithm/make_projected.h +++ b/libcxx/include/__algorithm/make_projected.h @@ -57,8 +57,8 @@ struct _ProjectedPred { template ::type>::value && - __is_identity::type>::value), + __enable_if_t >::value && + __is_identity<__decay_t<_Proj> >::value), int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ProjectedPred<_Pred, _Proj> __make_projected(_Pred& __pred, _Proj& __proj) { @@ -70,8 +70,8 @@ __make_projected(_Pred& __pred, _Proj& __proj) { // the call stack when the comparator is invoked, even in an unoptimized build. template ::type>::value && - __is_identity::type>::value, + __enable_if_t >::value && + __is_identity<__decay_t<_Proj> >::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Pred& __make_projected(_Pred& __pred, _Proj&) { return __pred; diff --git a/libcxx/include/__atomic/atomic_sync.h b/libcxx/include/__atomic/atomic_sync.h index 939487aee744..d55450bb5f9c 100644 --- a/libcxx/include/__atomic/atomic_sync.h +++ b/libcxx/include/__atomic/atomic_sync.h @@ -65,7 +65,7 @@ template _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp* __a, _Fn && __test_fn) { - __libcpp_atomic_wait_backoff_impl<_Atp, typename decay<_Fn>::type> __backoff_fn = {__a, __test_fn}; + __libcpp_atomic_wait_backoff_impl<_Atp, __decay_t<_Fn> > __backoff_fn = {__a, __test_fn}; return std::__libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn); } diff --git a/libcxx/include/__exception/nested_exception.h b/libcxx/include/__exception/nested_exception.h index b842dde03e16..182c7ddda653 100644 --- a/libcxx/include/__exception/nested_exception.h +++ b/libcxx/include/__exception/nested_exception.h @@ -67,7 +67,7 @@ struct __throw_with_nested<_Tp, _Up, false> { template _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void throw_with_nested(_Tp&& __t) { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS - typedef typename decay<_Tp>::type _Up; + using _Up = __decay_t<_Tp>; static_assert(is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible"); __throw_with_nested<_Tp, _Up, diff --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h index 530821a9cb37..0ab66d2dc0e4 100644 --- a/libcxx/include/__filesystem/path.h +++ b/libcxx/include/__filesystem/path.h @@ -144,7 +144,7 @@ struct __is_pathable_string< } }; -template ::type, +template , class _UnqualPtrType = __remove_const_t<__remove_pointer_t<_DS> >, bool _IsCharPtr = is_pointer<_DS>::value&& diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h index 0eb5ce705589..71ca6bd6a880 100644 --- a/libcxx/include/__functional/bind.h +++ b/libcxx/include/__functional/bind.h @@ -263,11 +263,11 @@ __apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>, } template -class __bind : public __weak_result_type::type> +class __bind : public __weak_result_type<__decay_t<_Fp> > { protected: - typedef typename decay<_Fp>::type _Fd; - typedef tuple::type...> _Td; + using _Fd = __decay_t<_Fp>; + typedef tuple<__decay_t<_BoundArgs>...> _Td; private: _Fd __f_; _Td __bound_args_; diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h index 3c6998cb8c8f..70ae6d13a089 100644 --- a/libcxx/include/__functional/function.h +++ b/libcxx/include/__functional/function.h @@ -430,7 +430,7 @@ template class __value_func<_Rp(_ArgTypes...)> } template ::type, __value_func>::value>::type> + class = typename enable_if, __value_func>::value>::type> _LIBCPP_INLINE_VISIBILITY explicit __value_func(_Fp&& __f) : __value_func(_VSTD::forward<_Fp>(__f), allocator<_Fp>()) {} @@ -773,7 +773,7 @@ template class __policy_func<_Rp(_ArgTypes...)> } } - template ::type, __policy_func>::value>::type> + template , __policy_func>::value>::type> _LIBCPP_INLINE_VISIBILITY explicit __policy_func(_Fp&& __f) : __policy_(__policy::__create_empty()) { typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun; @@ -1029,7 +1029,7 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)> function& operator=(const function&); function& operator=(function&&) _NOEXCEPT; function& operator=(nullptr_t) _NOEXCEPT; - template::type>> + template>> function& operator=(_Fp&&); ~function(); diff --git a/libcxx/include/__functional/invoke.h b/libcxx/include/__functional/invoke.h index 4daf64403ccd..82fd18d77cc0 100644 --- a/libcxx/include/__functional/invoke.h +++ b/libcxx/include/__functional/invoke.h @@ -266,8 +266,8 @@ struct __member_pointer_class_type<_Ret _ClassType::*> { }; template ::type, - class _DecayA0 = typename decay<_A0>::type, + class _DecayFp = __decay_t<_Fp>, + class _DecayA0 = __decay_t<_A0>, class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> using __enable_if_bullet1 = typename enable_if < @@ -276,8 +276,8 @@ using __enable_if_bullet1 = typename enable_if >::type; template ::type, - class _DecayA0 = typename decay<_A0>::type> + class _DecayFp = __decay_t<_Fp>, + class _DecayA0 = __decay_t<_A0> > using __enable_if_bullet2 = typename enable_if < is_member_function_pointer<_DecayFp>::value @@ -285,8 +285,8 @@ using __enable_if_bullet2 = typename enable_if >::type; template ::type, - class _DecayA0 = typename decay<_A0>::type, + class _DecayFp = __decay_t<_Fp>, + class _DecayA0 = __decay_t<_A0>, class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> using __enable_if_bullet3 = typename enable_if < @@ -296,8 +296,8 @@ using __enable_if_bullet3 = typename enable_if >::type; template ::type, - class _DecayA0 = typename decay<_A0>::type, + class _DecayFp = __decay_t<_Fp>, + class _DecayA0 = __decay_t<_A0>, class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> using __enable_if_bullet4 = typename enable_if < @@ -306,8 +306,8 @@ using __enable_if_bullet4 = typename enable_if >::type; template ::type, - class _DecayA0 = typename decay<_A0>::type> + class _DecayFp = __decay_t<_Fp>, + class _DecayA0 = __decay_t<_A0> > using __enable_if_bullet5 = typename enable_if < is_member_object_pointer<_DecayFp>::value @@ -315,8 +315,8 @@ using __enable_if_bullet5 = typename enable_if >::type; template ::type, - class _DecayA0 = typename decay<_A0>::type, + class _DecayFp = __decay_t<_Fp>, + class _DecayA0 = __decay_t<_A0>, class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> using __enable_if_bullet6 = typename enable_if < diff --git a/libcxx/include/__functional/unwrap_ref.h b/libcxx/include/__functional/unwrap_ref.h index 443b9b6b6b7a..3abad73ac7f2 100644 --- a/libcxx/include/__functional/unwrap_ref.h +++ b/libcxx/include/__functional/unwrap_ref.h @@ -38,7 +38,7 @@ template using unwrap_reference_t = typename unwrap_reference<_Tp>::type; template -struct unwrap_ref_decay : unwrap_reference::type> { }; +struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > { }; template using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type; @@ -49,7 +49,7 @@ struct __unwrap_ref_decay #if _LIBCPP_STD_VER >= 20 : unwrap_ref_decay<_Tp> #else - : __unwrap_reference::type> + : __unwrap_reference<__decay_t<_Tp> > #endif { }; diff --git a/libcxx/include/__memory/compressed_pair.h b/libcxx/include/__memory/compressed_pair.h index 8093d7c93156..36cda6aacd50 100644 --- a/libcxx/include/__memory/compressed_pair.h +++ b/libcxx/include/__memory/compressed_pair.h @@ -46,7 +46,7 @@ struct __compressed_pair_elem { _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__default_init_tag) {} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__value_init_tag) : __value_() {} - template ::type>::value> > + template >::value> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u) : __value_(std::forward<_Up>(__u)) {} @@ -75,7 +75,7 @@ struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp { _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__default_init_tag) {} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__value_init_tag) : __value_type() {} - template ::type>::value> > + template >::value> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u) : __value_type(std::forward<_Up>(__u)) {} diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h index 140dc15f70e5..c33e7bd43f29 100644 --- a/libcxx/include/__memory/pointer_traits.h +++ b/libcxx/include/__memory/pointer_traits.h @@ -200,7 +200,7 @@ template , _IsFancyPointer<_Pointer> >::value > > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -typename decay::__call(std::declval()))>::type +__decay_t::__call(std::declval()))> __to_address(const _Pointer& __p) _NOEXCEPT { return __to_address_helper<_Pointer>::__call(__p); } diff --git a/libcxx/include/__type_traits/common_type.h b/libcxx/include/__type_traits/common_type.h index bd06b062baec..afd766f05dec 100644 --- a/libcxx/include/__type_traits/common_type.h +++ b/libcxx/include/__type_traits/common_type.h @@ -49,9 +49,9 @@ struct __common_type2_imp {}; template struct __common_type2_imp<_Tp, _Up, __void_t() : std::declval<_Up>())> > { - typedef _LIBCPP_NODEBUG typename decay() : std::declval<_Up>() - )>::type type; + )> type; }; template @@ -109,9 +109,9 @@ struct _LIBCPP_TEMPLATE_VIS common_type<_Tp> template struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up> : conditional< - _IsSame<_Tp, typename decay<_Tp>::type>::value && _IsSame<_Up, typename decay<_Up>::type>::value, + _IsSame<_Tp, __decay_t<_Tp> >::value && _IsSame<_Up, __decay_t<_Up> >::value, __common_type2_imp<_Tp, _Up>, - common_type::type, typename decay<_Up>::type> + common_type<__decay_t<_Tp>, __decay_t<_Up> > >::type {}; diff --git a/libcxx/include/__type_traits/decay.h b/libcxx/include/__type_traits/decay.h index 484ceb39ecbf..a32c140e3c5e 100644 --- a/libcxx/include/__type_traits/decay.h +++ b/libcxx/include/__type_traits/decay.h @@ -26,10 +26,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if __has_builtin(__decay) +template +using __decay_t _LIBCPP_NODEBUG = __decay(_Tp); + template struct decay { - using type _LIBCPP_NODEBUG = __decay(_Tp); + using type _LIBCPP_NODEBUG = __decay_t<_Tp>; }; + #else template struct __decay { @@ -60,10 +64,13 @@ struct _LIBCPP_TEMPLATE_VIS decay public: typedef _LIBCPP_NODEBUG typename __decay<_Up, __libcpp_is_referenceable<_Up>::value>::type type; }; + +template +using __decay_t = typename decay<_Tp>::type; #endif // __has_builtin(__decay) #if _LIBCPP_STD_VER >= 14 -template using decay_t = typename decay<_Tp>::type; +template using decay_t = __decay_t<_Tp>; #endif _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__utility/auto_cast.h b/libcxx/include/__utility/auto_cast.h index 381ed0c205b2..06715b3438f9 100644 --- a/libcxx/include/__utility/auto_cast.h +++ b/libcxx/include/__utility/auto_cast.h @@ -17,6 +17,6 @@ # pragma GCC system_header #endif -#define _LIBCPP_AUTO_CAST(expr) static_cast::type>(expr) +#define _LIBCPP_AUTO_CAST(expr) static_cast<::std::__decay_t >(expr) #endif // _LIBCPP___UTILITY_AUTO_CAST_H diff --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h index 30797005fc02..4ade56f3c3da 100644 --- a/libcxx/include/__utility/pair.h +++ b/libcxx/include/__utility/pair.h @@ -22,6 +22,7 @@ #include <__type_traits/common_reference.h> #include <__type_traits/common_type.h> #include <__type_traits/conditional.h> +#include <__type_traits/decay.h> #include <__type_traits/is_assignable.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_convertible.h> @@ -152,7 +153,7 @@ struct _LIBCPP_TEMPLATE_VIS pair template using _CheckTLC _LIBCPP_NODEBUG = __conditional_t< __tuple_like_with_size<_Tuple, 2>::value - && !is_same::type, pair>::value, + && !is_same<__decay_t<_Tuple>, pair>::value, _CheckTupleLikeConstructor, __check_tuple_constructor_fail >; diff --git a/libcxx/include/experimental/iterator b/libcxx/include/experimental/iterator index 8c138b355cee..e47314a770f2 100644 --- a/libcxx/include/experimental/iterator +++ b/libcxx/include/experimental/iterator @@ -111,9 +111,9 @@ private: template -_LIBCPP_HIDE_FROM_ABI ostream_joiner::type, _CharT, _Traits> +_LIBCPP_HIDE_FROM_ABI ostream_joiner<__decay_t<_Delim>, _CharT, _Traits> make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim && __d) -{ return ostream_joiner::type, _CharT, _Traits>(__os, _VSTD::forward<_Delim>(__d)); } +{ return ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>(__os, _VSTD::forward<_Delim>(__d)); } _LIBCPP_END_NAMESPACE_LFTS diff --git a/libcxx/include/future b/libcxx/include/future index 6f1eeff9cf1a..eb05c59211b9 100644 --- a/libcxx/include/future +++ b/libcxx/include/future @@ -1760,7 +1760,7 @@ template __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f) : __f_(nullptr) { - typedef __libcpp_remove_reference_t::type> _FR; + typedef __libcpp_remove_reference_t<__decay_t<_Fp> > _FR; typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { @@ -1784,7 +1784,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function( allocator_arg_t, const _Alloc& __a0, _Fp&& __f) : __f_(nullptr) { - typedef __libcpp_remove_reference_t::type> _FR; + typedef __libcpp_remove_reference_t<__decay_t<_Fp> > _FR; typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { @@ -2193,10 +2193,10 @@ inline _LIBCPP_INLINE_VISIBILITY bool __does_policy_contain(launch __policy, lau template _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI -future::type, typename decay<_Args>::type...>::type> +future, __decay_t<_Args>...>::type> async(launch __policy, _Fp&& __f, _Args&&... __args) { - typedef __async_func::type, typename decay<_Args>::type...> _BF; + typedef __async_func<__decay_t<_Fp>, __decay_t<_Args>...> _BF; typedef typename _BF::_Rp _Rp; #ifndef _LIBCPP_HAS_NO_EXCEPTIONS @@ -2219,7 +2219,7 @@ async(launch __policy, _Fp&& __f, _Args&&... __args) template _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY -future::type, typename decay<_Args>::type...>::type> +future, __decay_t<_Args>...>::type> async(_Fp&& __f, _Args&&... __args) { return _VSTD::async(launch::any, _VSTD::forward<_Fp>(__f), diff --git a/libcxx/include/thread b/libcxx/include/thread index 19c8c2df89fd..8959eb0de0d3 100644 --- a/libcxx/include/thread +++ b/libcxx/include/thread @@ -306,7 +306,7 @@ thread::thread(_Fp&& __f, _Args&&... __args) { typedef unique_ptr<__thread_struct> _TSPtr; _TSPtr __tsp(new __thread_struct); - typedef tuple<_TSPtr, typename decay<_Fp>::type, typename decay<_Args>::type...> _Gp; + typedef tuple<_TSPtr, __decay_t<_Fp>, __decay_t<_Args>...> _Gp; unique_ptr<_Gp> __p( new _Gp(_VSTD::move(__tsp), _VSTD::forward<_Fp>(__f), diff --git a/libcxx/include/valarray b/libcxx/include/valarray index f305bac8bc76..3007d5c478ae 100644 --- a/libcxx/include/valarray +++ b/libcxx/include/valarray @@ -434,7 +434,7 @@ template struct _UnaryOp { typedef typename _Op::__result_type __result_type; - typedef typename decay<__result_type>::type value_type; + using value_type = __decay_t<__result_type>; _Op __op_; _A0 __a0_; @@ -453,7 +453,7 @@ template struct _BinaryOp { typedef typename _Op::__result_type __result_type; - typedef typename decay<__result_type>::type value_type; + using value_type = __decay_t<__result_type>; _Op __op_; _A0 __a0_; @@ -1117,7 +1117,7 @@ template struct _UnaryOp<_Op, valarray<_Tp> > { typedef typename _Op::__result_type __result_type; - typedef typename decay<__result_type>::type value_type; + using value_type = __decay_t<__result_type>; _Op __op_; const valarray<_Tp>& __a0_; @@ -1136,7 +1136,7 @@ template struct _BinaryOp<_Op, valarray<_Tp>, _A1> { typedef typename _Op::__result_type __result_type; - typedef typename decay<__result_type>::type value_type; + using value_type = __decay_t<__result_type>; _Op __op_; const valarray<_Tp>& __a0_; @@ -1157,7 +1157,7 @@ template struct _BinaryOp<_Op, _A0, valarray<_Tp> > { typedef typename _Op::__result_type __result_type; - typedef typename decay<__result_type>::type value_type; + using value_type = __decay_t<__result_type>; _Op __op_; _A0 __a0_; @@ -1178,7 +1178,7 @@ template struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> > { typedef typename _Op::__result_type __result_type; - typedef typename decay<__result_type>::type value_type; + using value_type = __decay_t<__result_type>; _Op __op_; const valarray<_Tp>& __a0_;