[libcxx-commits] [libcxx] r364065 - Use rvalue references throughout the is_constructible traits.

Eric Fiselier via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 21 08:35:34 PDT 2019


Author: ericwf
Date: Fri Jun 21 08:35:33 2019
New Revision: 364065

URL: http://llvm.org/viewvc/llvm-project?rev=364065&view=rev
Log:
Use rvalue references throughout the is_constructible traits.

Modified:
    libcxx/trunk/include/type_traits
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp
    libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=364065&r1=364064&r2=364065&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Fri Jun 21 08:35:33 2019
@@ -2198,12 +2198,8 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 // is_move_assignable
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_move_assignable
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     : public is_assignable<typename add_lvalue_reference<_Tp>::type,
                            typename add_rvalue_reference<_Tp>::type> {};
-#else
-    : public is_copy_assignable<_Tp> {};
-#endif
 
 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
 template <class _Tp>
@@ -2304,8 +2300,6 @@ forward(typename remove_reference<_Tp>::
     return static_cast<_Tp&&>(__t);
 }
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
 template <class _Tp>
 inline _LIBCPP_INLINE_VISIBILITY
 typename decay<_Tp>::type
@@ -2314,18 +2308,6 @@ __decay_copy(_Tp&& __t)
     return _VSTD::forward<_Tp>(__t);
 }
 
-#else
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-typename decay<_Tp>::type
-__decay_copy(const _Tp& __t)
-{
-    return _VSTD::forward<_Tp>(__t);
-}
-
-#endif
-
 template <class _Rp, class _Class, class ..._Param>
 struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
 {
@@ -2872,11 +2854,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_move_constructible
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
-#else
-    : public is_copy_constructible<_Tp>
-#endif
     {};
 
 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
@@ -2914,11 +2892,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially
 };
 
 template <class _Tp>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&&>
-#else
-struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp>
-#endif
     : integral_constant<bool, is_scalar<_Tp>::value>
 {
 };
@@ -2971,11 +2945,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 // is_trivially_move_constructible
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
-#else
-    : public is_trivially_copy_constructible<_Tp>
-#endif
     {};
 
 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
@@ -3012,14 +2982,10 @@ template <class _Tp>
 struct is_trivially_assignable<_Tp&, const _Tp&>
     : integral_constant<bool, is_scalar<_Tp>::value> {};
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
 template <class _Tp>
 struct is_trivially_assignable<_Tp&, _Tp&&>
     : integral_constant<bool, is_scalar<_Tp>::value> {};
 
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
 #endif  // !__has_feature(is_trivially_assignable)
 
 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
@@ -3044,11 +3010,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_move_assignable
     : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
                                      typename add_rvalue_reference<_Tp>::type>
-#else
-                                     typename add_lvalue_reference<_Tp>::type>
-#endif
     {};
 
 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
@@ -3097,7 +3059,7 @@ template <class _Tp, class... _Args>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
     : public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {};
 
-#elif !defined(_LIBCPP_HAS_NO_NOEXCEPT)
+#else
 
 template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
 
@@ -3134,58 +3096,6 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_c
 {
 };
 
-#else  // __has_keyword(__is_nothrow_constructible) || !defined(_LIBCPP_HAS_NO_NOEXCEPT)
-
-template <class _Tp, class... _Args>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
-    : false_type
-{
-};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp>
-#if __has_feature(has_nothrow_constructor) || defined(_LIBCPP_COMPILER_GCC)
-    : integral_constant<bool, __has_nothrow_constructor(_Tp)>
-#else
-    : integral_constant<bool, is_scalar<_Tp>::value>
-#endif
-{
-};
-
-template <class _Tp>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&&>
-#else
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp>
-#endif
-#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC)
-    : integral_constant<bool, __has_nothrow_copy(_Tp)>
-#else
-    : integral_constant<bool, is_scalar<_Tp>::value>
-#endif
-{
-};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&>
-#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC)
-    : integral_constant<bool, __has_nothrow_copy(_Tp)>
-#else
-    : integral_constant<bool, is_scalar<_Tp>::value>
-#endif
-{
-};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&>
-#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC)
-    : integral_constant<bool, __has_nothrow_copy(_Tp)>
-#else
-    : integral_constant<bool, is_scalar<_Tp>::value>
-#endif
-{
-};
-
 #endif  // _LIBCPP_HAS_NO_NOEXCEPT
 
 
@@ -3222,11 +3132,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 // is_nothrow_move_constructible
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
-#else
-    : public is_nothrow_copy_constructible<_Tp>
-#endif
     {};
 
 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
@@ -3243,7 +3149,7 @@ template <class _Tp, class _Arg>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
     : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {};
 
-#elif !defined(_LIBCPP_HAS_NO_NOEXCEPT)
+#else
 
 template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable;
 
@@ -3265,48 +3171,6 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_a
 {
 };
 
-#else  // __has_keyword(__is_nothrow_assignable) || !defined(_LIBCPP_HAS_NO_NOEXCEPT)
-
-template <class _Tp, class _Arg>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
-    : public false_type {};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp>
-#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_COMPILER_GCC)
-    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
-#else
-    : integral_constant<bool, is_scalar<_Tp>::value> {};
-#endif
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp&>
-#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_COMPILER_GCC)
-    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
-#else
-    : integral_constant<bool, is_scalar<_Tp>::value> {};
-#endif
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, const _Tp&>
-#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_COMPILER_GCC)
-    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
-#else
-    : integral_constant<bool, is_scalar<_Tp>::value> {};
-#endif
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-template <class _Tp>
-struct is_nothrow_assignable<_Tp&, _Tp&&>
-#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_COMPILER_GCC)
-    : integral_constant<bool, __has_nothrow_assign(_Tp)> {};
-#else
-    : integral_constant<bool, is_scalar<_Tp>::value> {};
-#endif
-
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
 #endif  // _LIBCPP_HAS_NO_NOEXCEPT
 
 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
@@ -3331,11 +3195,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 
 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable
     : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
                                      typename add_rvalue_reference<_Tp>::type>
-#else
-                                     typename add_lvalue_reference<_Tp>::type>
-#endif
     {};
 
 #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
@@ -3346,7 +3206,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR boo
 
 // is_nothrow_destructible
 
-#if !defined(_LIBCPP_HAS_NO_NOEXCEPT)
+#if !defined(_LIBCPP_CXX03_LANG)
 
 template <bool, class _Tp> struct __libcpp_is_nothrow_destructible;
 
@@ -3380,16 +3240,12 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_d
 {
 };
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
 template <class _Tp>
 struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&&>
     : public true_type
 {
 };
 
-#endif
-
 #else
 
 template <class _Tp> struct __libcpp_nothrow_destructor

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp?rev=364065&r1=364064&r2=364065&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp Fri Jun 21 08:35:33 2019
@@ -62,11 +62,10 @@ int main(int, char**)
     test_is_move_assignable<NotEmpty> ();
     test_is_move_assignable<Empty> ();
 
-#if TEST_STD_VER >= 11
     test_is_not_move_assignable<const int> ();
     test_is_not_move_assignable<int[]> ();
     test_is_not_move_assignable<int[3]> ();
-#endif
+
     test_is_not_move_assignable<void> ();
 
   return 0;

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp?rev=364065&r1=364064&r2=364065&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp Fri Jun 21 08:35:33 2019
@@ -61,9 +61,7 @@ struct A
 
 struct B
 {
-#if TEST_STD_VER >= 11
     B(B&&);
-#endif
 };
 
 int main(int, char**)

Modified: libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp?rev=364065&r1=364064&r2=364065&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp Fri Jun 21 08:35:33 2019
@@ -101,7 +101,7 @@ int main(int, char**)
     test_is_nothrow_destructible<Abstract>();
     test_is_nothrow_destructible<Empty>();
     test_is_nothrow_destructible<Union>();
-
+#endif
     // requires access control
     test_is_not_nothrow_destructible<ProtectedDestructor>();
     test_is_not_nothrow_destructible<PrivateDestructor>();
@@ -109,7 +109,7 @@ int main(int, char**)
     test_is_not_nothrow_destructible<VirtualPrivateDestructor>();
     test_is_not_nothrow_destructible<PureProtectedDestructor>();
     test_is_not_nothrow_destructible<PurePrivateDestructor>();
-#endif
+
 
   return 0;
 }




More information about the libcxx-commits mailing list