[libcxx] r206805 - Use compiler intrinsic __is_constructible if available

Marshall Clow mclow.lists at gmail.com
Mon Apr 21 15:30:32 PDT 2014


Author: marshall
Date: Mon Apr 21 17:30:32 2014
New Revision: 206805

URL: http://llvm.org/viewvc/llvm-project?rev=206805&view=rev
Log:
Use compiler intrinsic __is_constructible if available

Modified:
    libcxx/trunk/include/type_traits

Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=206805&r1=206804&r2=206805&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Mon Apr 21 17:30:32 2014
@@ -2034,10 +2034,24 @@ class _LIBCPP_TYPE_VIS_ONLY result_of<_F
 
 #endif  // _LIBCPP_HAS_NO_VARIADICS
 
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
 // template <class T, class... Args> struct is_constructible;
 
+namespace __is_construct
+{
+struct __nat {};
+}
+
+#if __has_feature(is_constructible)
+
+template <class _Tp, class ..._Args>
+struct _LIBCPP_TYPE_VIS_ONLY is_constructible
+    : public integral_constant<bool, __is_constructible(_Tp, _Args...)>
+    {};
+
+#else
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
 //      main is_constructible test
 
 template <class _Tp, class ..._Args>
@@ -2265,13 +2279,6 @@ struct __is_constructible2_void_check<tr
 
 //      is_constructible entry point
 
-namespace __is_construct
-{
-
-struct __nat {};
-
-}
-
 template <class _Tp, class _A0 = __is_construct::__nat,
                      class _A1 = __is_construct::__nat>
 struct _LIBCPP_TYPE_VIS_ONLY is_constructible
@@ -2336,6 +2343,7 @@ struct __is_constructible2_imp<false, _A
     {};
 
 #endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // __has_feature(is_constructible)
 
 // is_default_constructible
 





More information about the cfe-commits mailing list