|
@@ -1514,14 +1514,6 @@ template <class _T1, class _T2,
|
|
struct __is_convertible
|
|
struct __is_convertible
|
|
: public integral_constant<bool,
|
|
: public integral_constant<bool,
|
|
__is_convertible_imp::__is_convertible_test<_T1, _T2>::value
|
|
__is_convertible_imp::__is_convertible_test<_T1, _T2>::value
|
|
-#if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
|
|
|
- && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value
|
|
|
|
- && (!is_const<typename remove_reference<_T2>::type>::value
|
|
|
|
- || is_volatile<typename remove_reference<_T2>::type>::value)
|
|
|
|
- && (is_same<typename remove_cv<_T1>::type,
|
|
|
|
- typename remove_cv<typename remove_reference<_T2>::type>::type>::value
|
|
|
|
- || is_base_of<typename remove_reference<_T2>::type, _T1>::value))
|
|
|
|
-#endif
|
|
|
|
>
|
|
>
|
|
{};
|
|
{};
|
|
|
|
|
|
@@ -3165,239 +3157,11 @@ template <class _Tp, class ..._Args>
|
|
struct _LIBCPP_TEMPLATE_VIS is_constructible
|
|
struct _LIBCPP_TEMPLATE_VIS is_constructible
|
|
: public integral_constant<bool, __is_constructible(_Tp, _Args...)>
|
|
: public integral_constant<bool, __is_constructible(_Tp, _Args...)>
|
|
{};
|
|
{};
|
|
-#elif !defined(_LIBCPP_CXX03_LANG)
|
|
|
|
|
|
+#else
|
|
template <class _Tp, class... _Args>
|
|
template <class _Tp, class... _Args>
|
|
struct _LIBCPP_TEMPLATE_VIS is_constructible
|
|
struct _LIBCPP_TEMPLATE_VIS is_constructible
|
|
: public __libcpp_is_constructible<_Tp, _Args...>::type {};
|
|
: public __libcpp_is_constructible<_Tp, _Args...>::type {};
|
|
-#else
|
|
|
|
-// template <class T> struct is_constructible0;
|
|
|
|
-
|
|
|
|
-// main is_constructible0 test
|
|
|
|
-
|
|
|
|
-template <class _Tp>
|
|
|
|
-decltype((_Tp(), true_type()))
|
|
|
|
-__is_constructible0_test(_Tp&);
|
|
|
|
-
|
|
|
|
-false_type
|
|
|
|
-__is_constructible0_test(__any);
|
|
|
|
-
|
|
|
|
-template <class _Tp, class _A0>
|
|
|
|
-decltype((_Tp(_VSTD::declval<_A0>()), true_type()))
|
|
|
|
-__is_constructible1_test(_Tp&, _A0&);
|
|
|
|
-
|
|
|
|
-template <class _A0>
|
|
|
|
-false_type
|
|
|
|
-__is_constructible1_test(__any, _A0&);
|
|
|
|
-
|
|
|
|
-template <class _Tp, class _A0, class _A1>
|
|
|
|
-decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type()))
|
|
|
|
-__is_constructible2_test(_Tp&, _A0&, _A1&);
|
|
|
|
-
|
|
|
|
-template <class _A0, class _A1>
|
|
|
|
-false_type
|
|
|
|
-__is_constructible2_test(__any, _A0&, _A1&);
|
|
|
|
-
|
|
|
|
-template <class _Tp, class _A0, class _A1, class _A2>
|
|
|
|
-decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>(), _VSTD::declval<_A2>()), true_type()))
|
|
|
|
-__is_constructible3_test(_Tp&, _A0&, _A1&, _A2&);
|
|
|
|
-
|
|
|
|
-template <class _A0, class _A1, class _A2>
|
|
|
|
-false_type
|
|
|
|
-__is_constructible3_test(__any, _A0&, _A1&, _A2&);
|
|
|
|
-
|
|
|
|
-template <bool, class _Tp>
|
|
|
|
-struct __is_constructible0_imp // false, _Tp is not a scalar
|
|
|
|
- : public common_type
|
|
|
|
- <
|
|
|
|
- decltype(__is_constructible0_test(declval<_Tp&>()))
|
|
|
|
- >::type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <bool, class _Tp, class _A0>
|
|
|
|
-struct __is_constructible1_imp // false, _Tp is not a scalar
|
|
|
|
- : public common_type
|
|
|
|
- <
|
|
|
|
- decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>()))
|
|
|
|
- >::type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <bool, class _Tp, class _A0, class _A1>
|
|
|
|
-struct __is_constructible2_imp // false, _Tp is not a scalar
|
|
|
|
- : public common_type
|
|
|
|
- <
|
|
|
|
- decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>()))
|
|
|
|
- >::type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <bool, class _Tp, class _A0, class _A1, class _A2>
|
|
|
|
-struct __is_constructible3_imp // false, _Tp is not a scalar
|
|
|
|
- : public common_type
|
|
|
|
- <
|
|
|
|
- decltype(__is_constructible3_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>(), declval<_A2>()))
|
|
|
|
- >::type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-// handle scalars and reference types
|
|
|
|
-
|
|
|
|
-// Scalars are default constructible, references are not
|
|
|
|
-
|
|
|
|
-template <class _Tp>
|
|
|
|
-struct __is_constructible0_imp<true, _Tp>
|
|
|
|
- : public is_scalar<_Tp>
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Tp, class _A0>
|
|
|
|
-struct __is_constructible1_imp<true, _Tp, _A0>
|
|
|
|
- : public is_convertible<_A0, _Tp>
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Tp, class _A0, class _A1>
|
|
|
|
-struct __is_constructible2_imp<true, _Tp, _A0, _A1>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Tp, class _A0, class _A1, class _A2>
|
|
|
|
-struct __is_constructible3_imp<true, _Tp, _A0, _A1, _A2>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-// Treat scalars and reference types separately
|
|
|
|
-
|
|
|
|
-template <bool, class _Tp>
|
|
|
|
-struct __is_constructible0_void_check
|
|
|
|
- : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
|
|
|
|
- _Tp>
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <bool, class _Tp, class _A0>
|
|
|
|
-struct __is_constructible1_void_check
|
|
|
|
- : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
|
|
|
|
- _Tp, _A0>
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <bool, class _Tp, class _A0, class _A1>
|
|
|
|
-struct __is_constructible2_void_check
|
|
|
|
- : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
|
|
|
|
- _Tp, _A0, _A1>
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <bool, class _Tp, class _A0, class _A1, class _A2>
|
|
|
|
-struct __is_constructible3_void_check
|
|
|
|
- : public __is_constructible3_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value,
|
|
|
|
- _Tp, _A0, _A1, _A2>
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-// If any of T or Args is void, is_constructible should be false
|
|
|
|
-
|
|
|
|
-template <class _Tp>
|
|
|
|
-struct __is_constructible0_void_check<true, _Tp>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Tp, class _A0>
|
|
|
|
-struct __is_constructible1_void_check<true, _Tp, _A0>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Tp, class _A0, class _A1>
|
|
|
|
-struct __is_constructible2_void_check<true, _Tp, _A0, _A1>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Tp, class _A0, class _A1, class _A2>
|
|
|
|
-struct __is_constructible3_void_check<true, _Tp, _A0, _A1, _A2>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-// is_constructible entry point
|
|
|
|
-
|
|
|
|
-template <class _Tp, class _A0 = __is_construct::__nat,
|
|
|
|
- class _A1 = __is_construct::__nat,
|
|
|
|
- class _A2 = __is_construct::__nat>
|
|
|
|
-struct _LIBCPP_TEMPLATE_VIS is_constructible
|
|
|
|
- : public __is_constructible3_void_check<is_void<_Tp>::value
|
|
|
|
- || is_abstract<_Tp>::value
|
|
|
|
- || is_function<_Tp>::value
|
|
|
|
- || is_void<_A0>::value
|
|
|
|
- || is_void<_A1>::value
|
|
|
|
- || is_void<_A2>::value,
|
|
|
|
- _Tp, _A0, _A1, _A2>
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Tp>
|
|
|
|
-struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat>
|
|
|
|
- : public __is_constructible0_void_check<is_void<_Tp>::value
|
|
|
|
- || is_abstract<_Tp>::value
|
|
|
|
- || is_function<_Tp>::value,
|
|
|
|
- _Tp>
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Tp, class _A0>
|
|
|
|
-struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, _A0, __is_construct::__nat>
|
|
|
|
- : public __is_constructible1_void_check<is_void<_Tp>::value
|
|
|
|
- || is_abstract<_Tp>::value
|
|
|
|
- || is_function<_Tp>::value
|
|
|
|
- || is_void<_A0>::value,
|
|
|
|
- _Tp, _A0>
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Tp, class _A0, class _A1>
|
|
|
|
-struct _LIBCPP_TEMPLATE_VIS is_constructible<_Tp, _A0, _A1, __is_construct::__nat>
|
|
|
|
- : public __is_constructible2_void_check<is_void<_Tp>::value
|
|
|
|
- || is_abstract<_Tp>::value
|
|
|
|
- || is_function<_Tp>::value
|
|
|
|
- || is_void<_A0>::value
|
|
|
|
- || is_void<_A1>::value,
|
|
|
|
- _Tp, _A0, _A1>
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-// Array types are default constructible if their element type
|
|
|
|
-// is default constructible
|
|
|
|
-
|
|
|
|
-template <class _Ap, size_t _Np>
|
|
|
|
-struct __is_constructible0_imp<false, _Ap[_Np]>
|
|
|
|
- : public is_constructible<typename remove_all_extents<_Ap>::type>
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Ap, size_t _Np, class _A0>
|
|
|
|
-struct __is_constructible1_imp<false, _Ap[_Np], _A0>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Ap, size_t _Np, class _A0, class _A1>
|
|
|
|
-struct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Ap, size_t _Np, class _A0, class _A1, class _A2>
|
|
|
|
-struct __is_constructible3_imp<false, _Ap[_Np], _A0, _A1, _A2>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-// Incomplete array types are not constructible
|
|
|
|
-
|
|
|
|
-template <class _Ap>
|
|
|
|
-struct __is_constructible0_imp<false, _Ap[]>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Ap, class _A0>
|
|
|
|
-struct __is_constructible1_imp<false, _Ap[], _A0>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Ap, class _A0, class _A1>
|
|
|
|
-struct __is_constructible2_imp<false, _Ap[], _A0, _A1>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-template <class _Ap, class _A0, class _A1, class _A2>
|
|
|
|
-struct __is_constructible3_imp<false, _Ap[], _A0, _A1, _A2>
|
|
|
|
- : public false_type
|
|
|
|
- {};
|
|
|
|
-
|
|
|
|
-#endif // __has_feature(is_constructible)
|
|
|
|
-
|
|
|
|
|
|
+#endif
|
|
|
|
|
|
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
|
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
|
template <class _Tp, class ..._Args>
|
|
template <class _Tp, class ..._Args>
|