[libcxx] r324398 - Implement P0777: Treating unnecessay decay

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 12:56:55 PST 2018


Author: marshall
Date: Tue Feb  6 12:56:55 2018
New Revision: 324398

URL: http://llvm.org/viewvc/llvm-project?rev=324398&view=rev
Log:
Implement P0777: Treating unnecessay decay

Modified:
    libcxx/trunk/include/optional
    libcxx/trunk/include/tuple
    libcxx/trunk/include/type_traits
    libcxx/trunk/include/variant

Modified: libcxx/trunk/include/optional
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/optional?rev=324398&r1=324397&r2=324398&view=diff
==============================================================================
--- libcxx/trunk/include/optional (original)
+++ libcxx/trunk/include/optional Tue Feb  6 12:56:55 2018
@@ -612,8 +612,8 @@ private:
     };
     template <class _Up>
     using _CheckOptionalArgsCtor = conditional_t<
-        !is_same_v<decay_t<_Up>, in_place_t> &&
-        !is_same_v<decay_t<_Up>, optional>,
+        !is_same_v<__uncvref_t<_Up>, in_place_t> &&
+        !is_same_v<__uncvref_t<_Up>, optional>,
         _CheckOptionalArgsConstructor,
         __check_tuple_constructor_fail
     >;
@@ -761,7 +761,7 @@ public:
               class = enable_if_t
                       <__lazy_and<
                           integral_constant<bool,
-                              !is_same_v<decay_t<_Up>, optional> &&
+                              !is_same_v<__uncvref_t<_Up>, optional> &&
                               !(is_same_v<_Up, value_type> && is_scalar_v<value_type>)
                           >,
                           is_constructible<value_type, _Up>,

Modified: libcxx/trunk/include/tuple
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/tuple?rev=324398&r1=324397&r2=324398&view=diff
==============================================================================
--- libcxx/trunk/include/tuple (original)
+++ libcxx/trunk/include/tuple Tue Feb  6 12:56:55 2018
@@ -211,7 +211,7 @@ public:
     template <class _Tp,
               class = typename enable_if<
                   __lazy_and<
-                      __lazy_not<is_same<typename decay<_Tp>::type, __tuple_leaf>>
+                      __lazy_not<is_same<typename __uncvref<_Tp>::type, __tuple_leaf>>
                     , is_constructible<_Hp, _Tp>
                     >::value
                 >::type
@@ -293,7 +293,7 @@ public:
     template <class _Tp,
               class = typename enable_if<
                   __lazy_and<
-                        __lazy_not<is_same<typename decay<_Tp>::type, __tuple_leaf>>
+                        __lazy_not<is_same<typename __uncvref<_Tp>::type, __tuple_leaf>>
                       , is_constructible<_Hp, _Tp>
                     >::value
                 >::type
@@ -1383,7 +1383,7 @@ constexpr decltype(auto) apply(_Fn && __
 _LIBCPP_NOEXCEPT_RETURN(
     _VSTD::__apply_tuple_impl(
         _VSTD::forward<_Fn>(__f), _VSTD::forward<_Tuple>(__t),
-        typename __make_tuple_indices<tuple_size_v<decay_t<_Tuple>>>::type{})
+        typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{})
 )
 
 template <class _Tp, class _Tuple, size_t... _Idx>
@@ -1398,7 +1398,7 @@ inline _LIBCPP_INLINE_VISIBILITY
 constexpr _Tp make_from_tuple(_Tuple&& __t)
 _LIBCPP_NOEXCEPT_RETURN(
     _VSTD::__make_from_tuple_impl<_Tp>(_VSTD::forward<_Tuple>(__t),
-        typename __make_tuple_indices<tuple_size_v<decay_t<_Tuple>>>::type{})
+        typename __make_tuple_indices<tuple_size_v<remove_reference_t<_Tuple>>>::type{})
 )
 
 #undef _LIBCPP_NOEXCEPT_RETURN

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=324398&r1=324397&r2=324398&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Feb  6 12:56:55 2018
@@ -1180,9 +1180,7 @@ struct __is_same_uncvref : is_same<typen
 #if _LIBCPP_STD_VER > 17
 // aligned_union - same as __uncvref
 template <class _Tp>
-struct remove_cvref {
-    using type = remove_cv_t<remove_reference_t<_Tp>>;
-};
+struct remove_cvref : public __uncvref<_Tp> {};
 
 template <class _Tp> using remove_cvref_t = typename remove_cvref<_Tp>::type;
 #endif

Modified: libcxx/trunk/include/variant
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/variant?rev=324398&r1=324397&r2=324398&view=diff
==============================================================================
--- libcxx/trunk/include/variant (original)
+++ libcxx/trunk/include/variant Tue Feb  6 12:56:55 2018
@@ -1143,9 +1143,9 @@ public:
 
   template <
       class _Arg,
-      enable_if_t<!is_same_v<decay_t<_Arg>, variant>, int> = 0,
-      enable_if_t<!__is_inplace_type<decay_t<_Arg>>::value, int> = 0,
-      enable_if_t<!__is_inplace_index<decay_t<_Arg>>::value, int> = 0,
+      enable_if_t<!is_same_v<__uncvref_t<_Arg>, variant>, int> = 0,
+      enable_if_t<!__is_inplace_type<__uncvref_t<_Arg>>::value, int> = 0,
+      enable_if_t<!__is_inplace_index<__uncvref_t<_Arg>>::value, int> = 0,
       class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
       size_t _Ip =
           __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
@@ -1215,7 +1215,7 @@ public:
 
   template <
       class _Arg,
-      enable_if_t<!is_same_v<decay_t<_Arg>, variant>, int> = 0,
+      enable_if_t<!is_same_v<__uncvref_t<_Arg>, variant>, int> = 0,
       class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
       size_t _Ip =
           __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,




More information about the cfe-commits mailing list