[libcxx-commits] [libcxx] 173476e - [libc++] Add __decay_t and use it instead of decay<>::type

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 30 17:22:53 PDT 2023


Author: Nikolas Klauser
Date: 2023-03-31T02:22:48+02:00
New Revision: 173476ea0407cc037134370a651bb71e9f2dac04

URL: https://github.com/llvm/llvm-project/commit/173476ea0407cc037134370a651bb71e9f2dac04
DIFF: https://github.com/llvm/llvm-project/commit/173476ea0407cc037134370a651bb71e9f2dac04.diff

LOG: [libc++] Add __decay_t and use it instead of decay<>::type

This avoids instantiating lots of types.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D146984

Added: 
    

Modified: 
    libcxx/include/__algorithm/make_projected.h
    libcxx/include/__atomic/atomic_sync.h
    libcxx/include/__exception/nested_exception.h
    libcxx/include/__filesystem/path.h
    libcxx/include/__functional/bind.h
    libcxx/include/__functional/function.h
    libcxx/include/__functional/invoke.h
    libcxx/include/__functional/unwrap_ref.h
    libcxx/include/__memory/compressed_pair.h
    libcxx/include/__memory/pointer_traits.h
    libcxx/include/__type_traits/common_type.h
    libcxx/include/__type_traits/decay.h
    libcxx/include/__utility/auto_cast.h
    libcxx/include/__utility/pair.h
    libcxx/include/experimental/iterator
    libcxx/include/future
    libcxx/include/thread
    libcxx/include/valarray

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__algorithm/make_projected.h b/libcxx/include/__algorithm/make_projected.h
index 61055fcdf30d7..defda468b4ba3 100644
--- a/libcxx/include/__algorithm/make_projected.h
+++ b/libcxx/include/__algorithm/make_projected.h
@@ -57,8 +57,8 @@ struct _ProjectedPred {
 
 template <class _Pred,
           class _Proj,
-          __enable_if_t<!(!is_member_pointer<typename decay<_Pred>::type>::value &&
-                            __is_identity<typename decay<_Proj>::type>::value),
+          __enable_if_t<!(!is_member_pointer<__decay_t<_Pred> >::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 <class _Pred,
           class _Proj,
-          __enable_if_t<!is_member_pointer<typename decay<_Pred>::type>::value &&
-                          __is_identity<typename decay<_Proj>::type>::value,
+          __enable_if_t<!is_member_pointer<__decay_t<_Pred> >::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 939487aee7446..d55450bb5f9c5 100644
--- a/libcxx/include/__atomic/atomic_sync.h
+++ b/libcxx/include/__atomic/atomic_sync.h
@@ -65,7 +65,7 @@ template <class _Atp, class _Fn>
 _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 b842dde03e16a..182c7ddda6537 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 <class _Tp>
 _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 530821a9cb374..0ab66d2dc0e4c 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -144,7 +144,7 @@ struct __is_pathable_string<
   }
 };
 
-template <class _Source, class _DS = typename decay<_Source>::type,
+template <class _Source, class _DS = __decay_t<_Source>,
           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 0eb5ce7055895..71ca6bd6a8807 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 _Fp, class ..._BoundArgs>
-class __bind : public __weak_result_type<typename decay<_Fp>::type>
+class __bind : public __weak_result_type<__decay_t<_Fp> >
 {
 protected:
-    typedef typename decay<_Fp>::type _Fd;
-    typedef tuple<typename decay<_BoundArgs>::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 3c6998cb8c8fa..70ae6d13a0890 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -430,7 +430,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
     }
 
     template <class _Fp,
-        class = typename enable_if<!is_same<typename decay<_Fp>::type, __value_func>::value>::type>
+        class = typename enable_if<!is_same<__decay_t<_Fp>, __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 _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>
         }
     }
 
-    template <class _Fp, class = typename enable_if<!is_same<typename decay<_Fp>::type, __policy_func>::value>::type>
+    template <class _Fp, class = typename enable_if<!is_same<__decay_t<_Fp>, __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<class _Fp, class = _EnableIfLValueCallable<typename decay<_Fp>::type>>
+    template<class _Fp, class = _EnableIfLValueCallable<__decay_t<_Fp>>>
     function& operator=(_Fp&&);
 
     ~function();

diff  --git a/libcxx/include/__functional/invoke.h b/libcxx/include/__functional/invoke.h
index 4daf64403ccd4..82fd18d77cc0b 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 <class _Fp, class _A0,
-         class _DecayFp = typename decay<_Fp>::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 <class _Fp, class _A0,
-         class _DecayFp = typename decay<_Fp>::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 <class _Fp, class _A0,
-         class _DecayFp = typename decay<_Fp>::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 <class _Fp, class _A0,
-         class _DecayFp = typename decay<_Fp>::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 <class _Fp, class _A0,
-         class _DecayFp = typename decay<_Fp>::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 <class _Fp, class _A0,
-         class _DecayFp = typename decay<_Fp>::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 443b9b6b6b7a3..3abad73ac7f28 100644
--- a/libcxx/include/__functional/unwrap_ref.h
+++ b/libcxx/include/__functional/unwrap_ref.h
@@ -38,7 +38,7 @@ template <class _Tp>
 using unwrap_reference_t = typename unwrap_reference<_Tp>::type;
 
 template <class _Tp>
-struct unwrap_ref_decay : unwrap_reference<typename decay<_Tp>::type> { };
+struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > { };
 
 template <class _Tp>
 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<typename decay<_Tp>::type>
+    : __unwrap_reference<__decay_t<_Tp> >
 #endif
 { };
 

diff  --git a/libcxx/include/__memory/compressed_pair.h b/libcxx/include/__memory/compressed_pair.h
index 8093d7c93156d..36cda6aacd504 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 <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, typename decay<_Up>::type>::value> >
+  template <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::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 <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, typename decay<_Up>::type>::value> >
+  template <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::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 140dc15f70e52..c33e7bd43f29f 100644
--- a/libcxx/include/__memory/pointer_traits.h
+++ b/libcxx/include/__memory/pointer_traits.h
@@ -200,7 +200,7 @@ template <class _Pointer, class = __enable_if_t<
     _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value
 > >
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
-typename decay<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))>::type
+__decay_t<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))>
 __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 bd06b062baec8..afd766f05dec3 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 <class _Tp, class _Up>
 struct __common_type2_imp<_Tp, _Up, __void_t<decltype(true ? std::declval<_Tp>() : std::declval<_Up>())> >
 {
-  typedef _LIBCPP_NODEBUG typename decay<decltype(
+  typedef _LIBCPP_NODEBUG __decay_t<decltype(
                          true ? std::declval<_Tp>() : std::declval<_Up>()
-                         )>::type type;
+                         )> type;
 };
 
 template <class, class = void>
@@ -109,9 +109,9 @@ struct _LIBCPP_TEMPLATE_VIS common_type<_Tp>
 template <class _Tp, class _Up>
 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<typename decay<_Tp>::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 484ceb39ecbfa..a32c140e3c5e2 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 <class _Tp>
+using __decay_t _LIBCPP_NODEBUG = __decay(_Tp);
+
 template <class _Tp>
 struct decay {
-  using type _LIBCPP_NODEBUG = __decay(_Tp);
+  using type _LIBCPP_NODEBUG = __decay_t<_Tp>;
 };
+
 #else
 template <class _Up, bool>
 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 <class _Tp>
+using __decay_t = typename decay<_Tp>::type;
 #endif // __has_builtin(__decay)
 
 #if _LIBCPP_STD_VER >= 14
-template <class _Tp> using decay_t = typename decay<_Tp>::type;
+template <class _Tp> 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 381ed0c205b25..06715b3438f99 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<typename decay<decltype((expr))>::type>(expr)
+#define _LIBCPP_AUTO_CAST(expr) static_cast<::std::__decay_t<decltype((expr))> >(expr)
 
 #endif // _LIBCPP___UTILITY_AUTO_CAST_H

diff  --git a/libcxx/include/__utility/pair.h b/libcxx/include/__utility/pair.h
index 30797005fc02f..4ade56f3c3da7 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 <class _Tuple>
     using _CheckTLC _LIBCPP_NODEBUG = __conditional_t<
         __tuple_like_with_size<_Tuple, 2>::value
-            && !is_same<typename decay<_Tuple>::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 8c138b355cee1..e47314a770f2f 100644
--- a/libcxx/include/experimental/iterator
+++ b/libcxx/include/experimental/iterator
@@ -111,9 +111,9 @@ private:
 
 
 template <class _CharT, class _Traits, class _Delim>
-_LIBCPP_HIDE_FROM_ABI ostream_joiner<typename decay<_Delim>::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<typename decay<_Delim>::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 6f1eeff9cf1af..eb05c59211b93 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -1760,7 +1760,7 @@ template <class _Fp>
 __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f)
     : __f_(nullptr)
 {
-    typedef __libcpp_remove_reference_t<typename decay<_Fp>::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<typename decay<_Fp>::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 <class _Fp, class... _Args>
 _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI
-future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type>
+future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type>
 async(launch __policy, _Fp&& __f, _Args&&... __args)
 {
-    typedef __async_func<typename decay<_Fp>::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 <class _Fp, class... _Args>
 _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY
-future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type>
+future<typename __invoke_of<__decay_t<_Fp>, __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 19c8c2df89fd4..8959eb0de0d38 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 f305bac8bc764..3007d5c478aee 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -434,7 +434,7 @@ template <class _Op, class _A0>
 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 <class _Op, class _A0, class _A1>
 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 <class _Op, class _Tp>
 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 <class _Op, class _Tp, class _A1>
 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 <class _Op, class _A0, class _Tp>
 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 <class _Op, class _Tp>
 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_;


        


More information about the libcxx-commits mailing list