// -*- C++ -*- //===------------------------ type_traits ---------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_TYPE_TRAITS #define _LIBCPP_TYPE_TRAITS /* type_traits synopsis namespace std { // helper class: template struct integral_constant; typedef integral_constant true_type; typedef integral_constant false_type; // helper traits template struct enable_if; template struct conditional; // Primary classification traits: template struct is_void; template struct is_integral; template struct is_floating_point; template struct is_array; template struct is_pointer; template struct is_lvalue_reference; template struct is_rvalue_reference; template struct is_member_object_pointer; template struct is_member_function_pointer; template struct is_enum; template struct is_union; template struct is_class; template struct is_function; // Secondary classification traits: template struct is_reference; template struct is_arithmetic; template struct is_fundamental; template struct is_member_pointer; template struct is_scalar; template struct is_object; template struct is_compound; // Const-volatile properties and transformations: template struct is_const; template struct is_volatile; template struct remove_const; template struct remove_volatile; template struct remove_cv; template struct add_const; template struct add_volatile; template struct add_cv; // Reference transformations: template struct remove_reference; template struct add_lvalue_reference; template struct add_rvalue_reference; // Pointer transformations: template struct remove_pointer; template struct add_pointer; // Integral properties: template struct is_signed; template struct is_unsigned; template struct make_signed; template struct make_unsigned; // Array properties and transformations: template struct rank; template struct extent; template struct remove_extent; template struct remove_all_extents; // Member introspection: template struct is_pod; template struct is_trivial; template struct is_trivially_copyable; template struct is_standard_layout; template struct is_literal_type; template struct is_empty; template struct is_polymorphic; template struct is_abstract; template struct is_constructible; template struct is_default_constructible; template struct is_copy_constructible; template struct is_move_constructible; template struct is_assignable; template struct is_copy_assignable; template struct is_move_assignable; template struct is_destructible; template struct is_trivially_constructible; template struct is_trivially_default_constructible; template struct is_trivially_copy_constructible; template struct is_trivially_move_constructible; template struct is_trivially_assignable; template struct is_trivially_copy_assignable; template struct is_trivially_move_assignable; template struct is_trivially_destructible; template struct is_nothrow_constructible; template struct is_nothrow_default_constructible; template struct is_nothrow_copy_constructible; template struct is_nothrow_move_constructible; template struct is_nothrow_assignable; template struct is_nothrow_copy_assignable; template struct is_nothrow_move_assignable; template struct is_nothrow_destructible; template struct has_virtual_destructor; // Relationships between types: template struct is_same; template struct is_base_of; template struct is_convertible; // Alignment properties and transformations: template struct alignment_of; template struct aligned_storage; template struct decay; template struct common_type; template struct underlying_type; template class result_of; // undefined template class result_of; } // std */ #include <__config> #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_STD template struct _LIBCPP_VISIBLE conditional {typedef _If type;}; template struct _LIBCPP_VISIBLE conditional {typedef _Then type;}; template struct _LIBCPP_VISIBLE enable_if {}; template struct _LIBCPP_VISIBLE enable_if {typedef _Tp type;}; struct __two {char __lx[2];}; // helper class: template struct _LIBCPP_VISIBLE integral_constant { static _LIBCPP_CONSTEXPR const _Tp value = __v; typedef _Tp value_type; typedef integral_constant type; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator value_type() const {return value;} }; template _LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value; typedef integral_constant true_type; typedef integral_constant false_type; // is_const template struct _LIBCPP_VISIBLE is_const : public false_type {}; template struct _LIBCPP_VISIBLE is_const<_Tp const> : public true_type {}; // is_volatile template struct _LIBCPP_VISIBLE is_volatile : public false_type {}; template struct _LIBCPP_VISIBLE is_volatile<_Tp volatile> : public true_type {}; // remove_const template struct _LIBCPP_VISIBLE remove_const {typedef _Tp type;}; template struct _LIBCPP_VISIBLE remove_const {typedef _Tp type;}; // remove_volatile template struct _LIBCPP_VISIBLE remove_volatile {typedef _Tp type;}; template struct _LIBCPP_VISIBLE remove_volatile {typedef _Tp type;}; // remove_cv template struct _LIBCPP_VISIBLE remove_cv {typedef typename remove_volatile::type>::type type;}; // is_void template struct __is_void : public false_type {}; template <> struct __is_void : public true_type {}; template struct _LIBCPP_VISIBLE is_void : public __is_void::type> {}; // __is_nullptr_t template struct ____is_nullptr_t : public false_type {}; template <> struct ____is_nullptr_t : public true_type {}; template struct _LIBCPP_VISIBLE __is_nullptr_t : public ____is_nullptr_t::type> {}; // is_integral template struct __is_integral : public false_type {}; template <> struct __is_integral : public true_type {}; template <> struct __is_integral : public true_type {}; template <> struct __is_integral : public true_type {}; template <> struct __is_integral : public true_type {}; template <> struct __is_integral : public true_type {}; #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS template <> struct __is_integral : public true_type {}; template <> struct __is_integral : public true_type {}; #endif // _LIBCPP_HAS_NO_UNICODE_CHARS template <> struct __is_integral : public true_type {}; template <> struct __is_integral : public true_type {}; template <> struct __is_integral : public true_type {}; template <> struct __is_integral : public true_type {}; template <> struct __is_integral : public true_type {}; template <> struct __is_integral : public true_type {}; template <> struct __is_integral : public true_type {}; template <> struct __is_integral : public true_type {}; template struct _LIBCPP_VISIBLE is_integral : public __is_integral::type> {}; // is_floating_point template struct __is_floating_point : public false_type {}; template <> struct __is_floating_point : public true_type {}; template <> struct __is_floating_point : public true_type {}; template <> struct __is_floating_point : public true_type {}; template struct _LIBCPP_VISIBLE is_floating_point : public __is_floating_point::type> {}; // is_array template struct _LIBCPP_VISIBLE is_array : public false_type {}; template struct _LIBCPP_VISIBLE is_array<_Tp[]> : public true_type {}; template struct _LIBCPP_VISIBLE is_array<_Tp[_Np]> : public true_type {}; // is_pointer template struct __is_pointer : public false_type {}; template struct __is_pointer<_Tp*> : public true_type {}; template struct _LIBCPP_VISIBLE is_pointer : public __is_pointer::type> {}; // is_reference template struct _LIBCPP_VISIBLE is_lvalue_reference : public false_type {}; template struct _LIBCPP_VISIBLE is_lvalue_reference<_Tp&> : public true_type {}; template struct _LIBCPP_VISIBLE is_rvalue_reference : public false_type {}; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct _LIBCPP_VISIBLE is_rvalue_reference<_Tp&&> : public true_type {}; #endif template struct _LIBCPP_VISIBLE is_reference : public false_type {}; template struct _LIBCPP_VISIBLE is_reference<_Tp&> : public true_type {}; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct _LIBCPP_VISIBLE is_reference<_Tp&&> : public true_type {}; #endif #if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) #define _LIBCPP_HAS_TYPE_TRAITS #endif // is_union #if __has_feature(is_union) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) template struct _LIBCPP_VISIBLE is_union : public integral_constant {}; #else template struct __libcpp_union : public false_type {}; template struct _LIBCPP_VISIBLE is_union : public __libcpp_union::type> {}; #endif // is_class #if __has_feature(is_class) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) template struct _LIBCPP_VISIBLE is_class : public integral_constant {}; #else namespace __is_class_imp { template char __test(int _Tp::*); template __two __test(...); } template struct _LIBCPP_VISIBLE is_class : public integral_constant(0)) == 1 && !is_union<_Tp>::value> {}; #endif // is_same template struct _LIBCPP_VISIBLE is_same : public false_type {}; template struct _LIBCPP_VISIBLE is_same<_Tp, _Tp> : public true_type {}; // is_function namespace __is_function_imp { template char __test(_Tp*); template __two __test(...); template _Tp& __source(); } template ::value || is_union<_Tp>::value || is_void<_Tp>::value || is_reference<_Tp>::value || is_same<_Tp, nullptr_t>::value > struct __is_function : public integral_constant(__is_function_imp::__source<_Tp>())) == 1> {}; template struct __is_function<_Tp, true> : public false_type {}; template struct _LIBCPP_VISIBLE is_function : public __is_function<_Tp> {}; // is_member_function_pointer template struct __is_member_function_pointer : public false_type {}; template struct __is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {}; template struct _LIBCPP_VISIBLE is_member_function_pointer : public __is_member_function_pointer::type> {}; // is_member_pointer template struct __is_member_pointer : public false_type {}; template struct __is_member_pointer<_Tp _Up::*> : public true_type {}; template struct _LIBCPP_VISIBLE is_member_pointer : public __is_member_pointer::type> {}; // is_member_object_pointer template struct _LIBCPP_VISIBLE is_member_object_pointer : public integral_constant::value && !is_member_function_pointer<_Tp>::value> {}; // is_enum #if __has_feature(is_enum) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) template struct _LIBCPP_VISIBLE is_enum : public integral_constant {}; #else template struct _LIBCPP_VISIBLE is_enum : public integral_constant::value && !is_integral<_Tp>::value && !is_floating_point<_Tp>::value && !is_array<_Tp>::value && !is_pointer<_Tp>::value && !is_reference<_Tp>::value && !is_member_pointer<_Tp>::value && !is_union<_Tp>::value && !is_class<_Tp>::value && !is_function<_Tp>::value > {}; #endif // is_arithmetic template struct _LIBCPP_VISIBLE is_arithmetic : public integral_constant::value || is_floating_point<_Tp>::value> {}; // is_fundamental template struct _LIBCPP_VISIBLE is_fundamental : public integral_constant::value || __is_nullptr_t<_Tp>::value || is_arithmetic<_Tp>::value> {}; // is_scalar template struct _LIBCPP_VISIBLE is_scalar : public integral_constant::value || is_member_pointer<_Tp>::value || is_pointer<_Tp>::value || __is_nullptr_t<_Tp>::value || is_enum<_Tp>::value > {}; template <> struct _LIBCPP_VISIBLE is_scalar : public true_type {}; // is_object template struct _LIBCPP_VISIBLE is_object : public integral_constant::value || is_array<_Tp>::value || is_union<_Tp>::value || is_class<_Tp>::value > {}; // is_compound template struct _LIBCPP_VISIBLE is_compound : public integral_constant::value> {}; // add_const template ::value || is_function<_Tp>::value || is_const<_Tp>::value > struct __add_const {typedef _Tp type;}; template struct __add_const<_Tp, false> {typedef const _Tp type;}; template struct _LIBCPP_VISIBLE add_const {typedef typename __add_const<_Tp>::type type;}; // add_volatile template ::value || is_function<_Tp>::value || is_volatile<_Tp>::value > struct __add_volatile {typedef _Tp type;}; template struct __add_volatile<_Tp, false> {typedef volatile _Tp type;}; template struct _LIBCPP_VISIBLE add_volatile {typedef typename __add_volatile<_Tp>::type type;}; // add_cv template struct _LIBCPP_VISIBLE add_cv {typedef typename add_const::type>::type type;}; // remove_reference template struct _LIBCPP_VISIBLE remove_reference {typedef _Tp type;}; template struct _LIBCPP_VISIBLE remove_reference<_Tp&> {typedef _Tp type;}; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct _LIBCPP_VISIBLE remove_reference<_Tp&&> {typedef _Tp type;}; #endif // add_lvalue_reference template struct _LIBCPP_VISIBLE add_lvalue_reference {typedef _Tp& type;}; template struct _LIBCPP_VISIBLE add_lvalue_reference<_Tp&> {typedef _Tp& type;}; // for older compiler template <> struct _LIBCPP_VISIBLE add_lvalue_reference {typedef void type;}; template <> struct _LIBCPP_VISIBLE add_lvalue_reference {typedef const void type;}; template <> struct _LIBCPP_VISIBLE add_lvalue_reference {typedef volatile void type;}; template <> struct _LIBCPP_VISIBLE add_lvalue_reference {typedef const volatile void type;}; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct _LIBCPP_VISIBLE add_rvalue_reference {typedef _Tp&& type;}; template <> struct _LIBCPP_VISIBLE add_rvalue_reference {typedef void type;}; template <> struct _LIBCPP_VISIBLE add_rvalue_reference {typedef const void type;}; template <> struct _LIBCPP_VISIBLE add_rvalue_reference {typedef volatile void type;}; template <> struct _LIBCPP_VISIBLE add_rvalue_reference {typedef const volatile void type;}; #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template typename add_rvalue_reference<_Tp>::type declval() _NOEXCEPT; #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES template typename add_lvalue_reference<_Tp>::type declval(); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES struct __any { __any(...); }; // remove_pointer template struct _LIBCPP_VISIBLE remove_pointer {typedef _Tp type;}; template struct _LIBCPP_VISIBLE remove_pointer<_Tp*> {typedef _Tp type;}; template struct _LIBCPP_VISIBLE remove_pointer<_Tp* const> {typedef _Tp type;}; template struct _LIBCPP_VISIBLE remove_pointer<_Tp* volatile> {typedef _Tp type;}; template struct _LIBCPP_VISIBLE remove_pointer<_Tp* const volatile> {typedef _Tp type;}; // add_pointer template struct _LIBCPP_VISIBLE add_pointer {typedef typename remove_reference<_Tp>::type* type;}; // is_signed template ::value> struct ___is_signed : public integral_constant {}; template struct ___is_signed<_Tp, false> : public true_type {}; // floating point template ::value> struct __is_signed : public ___is_signed<_Tp> {}; template struct __is_signed<_Tp, false> : public false_type {}; template struct _LIBCPP_VISIBLE is_signed : public __is_signed<_Tp> {}; // is_unsigned template ::value> struct ___is_unsigned : public integral_constant {}; template struct ___is_unsigned<_Tp, false> : public false_type {}; // floating point template ::value> struct __is_unsigned : public ___is_unsigned<_Tp> {}; template struct __is_unsigned<_Tp, false> : public false_type {}; template struct _LIBCPP_VISIBLE is_unsigned : public __is_unsigned<_Tp> {}; // rank template struct _LIBCPP_VISIBLE rank : public integral_constant {}; template struct _LIBCPP_VISIBLE rank<_Tp[]> : public integral_constant::value + 1> {}; template struct _LIBCPP_VISIBLE rank<_Tp[_Np]> : public integral_constant::value + 1> {}; // extent template struct _LIBCPP_VISIBLE extent : public integral_constant {}; template struct _LIBCPP_VISIBLE extent<_Tp[], 0> : public integral_constant {}; template struct _LIBCPP_VISIBLE extent<_Tp[], _Ip> : public integral_constant::value> {}; template struct _LIBCPP_VISIBLE extent<_Tp[_Np], 0> : public integral_constant {}; template struct _LIBCPP_VISIBLE extent<_Tp[_Np], _Ip> : public integral_constant::value> {}; // remove_extent template struct _LIBCPP_VISIBLE remove_extent {typedef _Tp type;}; template struct _LIBCPP_VISIBLE remove_extent<_Tp[]> {typedef _Tp type;}; template struct _LIBCPP_VISIBLE remove_extent<_Tp[_Np]> {typedef _Tp type;}; // remove_all_extents template struct _LIBCPP_VISIBLE remove_all_extents {typedef _Tp type;}; template struct _LIBCPP_VISIBLE remove_all_extents<_Tp[]> {typedef typename remove_all_extents<_Tp>::type type;}; template struct _LIBCPP_VISIBLE remove_all_extents<_Tp[_Np]> {typedef typename remove_all_extents<_Tp>::type type;}; // is_abstract namespace __is_abstract_imp { template char __test(_Tp (*)[1]); template __two __test(...); } template ::value> struct __libcpp_abstract : public integral_constant(0)) != 1> {}; template struct __libcpp_abstract<_Tp, false> : public false_type {}; template struct _LIBCPP_VISIBLE is_abstract : public __libcpp_abstract<_Tp> {}; // is_base_of #ifdef _LIBCP_HAS_IS_BASE_OF template struct _LIBCPP_VISIBLE is_base_of : public integral_constant {}; #else // __has_feature(is_base_of) #error is_base_of not implemented. #endif // __has_feature(is_base_of) // is_convertible #if __has_feature(is_convertible_to) template struct _LIBCPP_VISIBLE is_convertible : public integral_constant::value> {}; #else // __has_feature(is_convertible_to) namespace __is_convertible_imp { template char __test(_Tp); template __two __test(...); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template _Tp&& __source(); #else template typename remove_reference<_Tp>::type& __source(); #endif template ::value, bool _IsFunction = is_function<_Tp>::value, bool _IsVoid = is_void<_Tp>::value> struct __is_array_function_or_void {enum {value = 0};}; template struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};}; template struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};}; template struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};}; } template ::type>::value> struct __is_convertible_check { static const size_t __v = 0; }; template struct __is_convertible_check<_Tp, 0> { static const size_t __v = sizeof(_Tp); }; template ::value, unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value> struct __is_convertible : public integral_constant(__is_convertible_imp::__source<_T1>())) == 1 #else sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value && (!is_const::type>::value || is_volatile::type>::value) && (is_same::type, typename remove_cv::type>::type>::value || is_base_of::type, _T1>::value)) #endif > {}; template struct __is_convertible<_T1, _T2, 1, 0> : false_type {}; template struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {}; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {}; template struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {}; template struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {}; template struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {}; #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct __is_convertible<_T1, _T2*, 1, 0> : public integral_constant::type*, _T2*>::value> {}; template struct __is_convertible<_T1, _T2* const, 1, 0> : public integral_constant::type*, _T2*const>::value> {}; template struct __is_convertible<_T1, _T2* volatile, 1, 0> : public integral_constant::type*, _T2*volatile>::value> {}; template struct __is_convertible<_T1, _T2* const volatile, 1, 0> : public integral_constant::type*, _T2*const volatile>::value> {}; template struct __is_convertible<_T1, _T2, 2, 0> : public false_type {}; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct __is_convertible<_T1, _T1&&, 2, 0> : public true_type {}; #endif template struct __is_convertible<_T1, _T1&, 2, 0> : public true_type {}; template struct __is_convertible<_T1, _T1*, 2, 0> : public true_type {}; template struct __is_convertible<_T1, _T1*const, 2, 0> : public true_type {}; template struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {}; template struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {}; template struct __is_convertible<_T1, _T2, 3, 0> : public false_type {}; template struct __is_convertible<_T1, _T2, 0, 1> : public false_type {}; template struct __is_convertible<_T1, _T2, 1, 1> : public false_type {}; template struct __is_convertible<_T1, _T2, 2, 1> : public false_type {}; template struct __is_convertible<_T1, _T2, 3, 1> : public false_type {}; template struct __is_convertible<_T1, _T2, 0, 2> : public false_type {}; template struct __is_convertible<_T1, _T2, 1, 2> : public false_type {}; template struct __is_convertible<_T1, _T2, 2, 2> : public false_type {}; template struct __is_convertible<_T1, _T2, 3, 2> : public false_type {}; template struct __is_convertible<_T1, _T2, 0, 3> : public false_type {}; template struct __is_convertible<_T1, _T2, 1, 3> : public false_type {}; template struct __is_convertible<_T1, _T2, 2, 3> : public false_type {}; template struct __is_convertible<_T1, _T2, 3, 3> : public true_type {}; template struct _LIBCPP_VISIBLE is_convertible : public __is_convertible<_T1, _T2> { static const size_t __complete_check1 = __is_convertible_check<_T1>::__v; static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; }; #endif // __has_feature(is_convertible_to) // is_empty #if __has_feature(is_empty) template struct _LIBCPP_VISIBLE is_empty : public integral_constant {}; #else // __has_feature(is_empty) template struct __is_empty1 : public _Tp { double __lx; }; struct __is_empty2 { double __lx; }; template ::value> struct __libcpp_empty : public integral_constant) == sizeof(__is_empty2)> {}; template struct __libcpp_empty<_Tp, false> : public false_type {}; template struct _LIBCPP_VISIBLE is_empty : public __libcpp_empty<_Tp> {}; #endif // __has_feature(is_empty) // is_polymorphic #if __has_feature(is_polymorphic) template struct _LIBCPP_VISIBLE is_polymorphic : public integral_constant {}; #else template struct __is_polymorphic1 : public _Tp {}; template struct __is_polymorphic2 : public _Tp {virtual ~__is_polymorphic2() throw();}; template ::value> struct __libcpp_polymorphic : public integral_constant) == sizeof(__is_polymorphic2<_Tp>)> {}; template struct __libcpp_polymorphic<_Tp, false> : public false_type {}; template struct _LIBCPP_VISIBLE is_polymorphic : public __libcpp_polymorphic<_Tp> {}; #endif // __has_feature(is_polymorphic) // has_virtual_destructor #if __has_feature(has_virtual_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) template struct _LIBCPP_VISIBLE has_virtual_destructor : public integral_constant {}; #else // _LIBCPP_HAS_TYPE_TRAITS template struct _LIBCPP_VISIBLE has_virtual_destructor : public false_type {}; #endif // _LIBCPP_HAS_TYPE_TRAITS // alignment_of template struct __alignment_of {_Tp __lx;}; template struct _LIBCPP_VISIBLE alignment_of : public integral_constant::type>)> {}; // aligned_storage template struct __type_list { typedef _Hp _Head; typedef _Tp _Tail; }; struct __nat { #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS __nat() = delete; __nat(const __nat&) = delete; __nat& operator=(const __nat&) = delete; ~__nat() = delete; #endif }; template struct __align_type { static const size_t value = alignment_of<_Tp>::value; typedef _Tp type; }; struct __struct_double {long double __lx;}; struct __struct_double4 {double __lx[4];}; typedef __type_list<__align_type, __type_list<__align_type, __type_list<__align_type, __type_list<__align_type, __type_list<__align_type, __type_list<__align_type, __type_list<__align_type, __type_list<__align_type<__struct_double>, __type_list<__align_type<__struct_double4>, __type_list<__align_type, __nat > > > > > > > > > > __all_types; template struct __find_pod; template struct __find_pod<__type_list<_Hp, __nat>, _Align> { typedef typename conditional< _Align == _Hp::value, typename _Hp::type, void >::type type; }; template struct __find_pod<__type_list<_Hp, _Tp>, _Align> { typedef typename conditional< _Align == _Hp::value, typename _Hp::type, typename __find_pod<_Tp, _Align>::type >::type type; }; template struct __find_max_align; template struct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant {}; template struct __select_align { private: static const size_t __min = _A2 < _A1 ? _A2 : _A1; static const size_t __max = _A1 < _A2 ? _A2 : _A1; public: static const size_t value = _Len < __max ? __min : __max; }; template struct __find_max_align<__type_list<_Hp, _Tp>, _Len> : public integral_constant::value>::value> {}; template ::value> struct _LIBCPP_VISIBLE aligned_storage { typedef typename __find_pod<__all_types, _Align>::type _Aligner; static_assert(!is_void<_Aligner>::value, ""); union type { _Aligner __align; unsigned char __data[_Len]; }; }; #define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ template \ struct _LIBCPP_VISIBLE aligned_storage<_Len, n>\ {\ struct _ALIGNAS(n) type\ {\ unsigned char __lx[_Len];\ };\ } _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000); // MSDN says that MSVC does not support alignment beyond 8192 (=0x2000) #if !defined(_MSC_VER) _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); #endif // !_MSC_VER #undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION // __promote template ::value || is_void<_A1>::value) && (is_arithmetic<_A2>::value || is_void<_A2>::value) && (is_arithmetic<_A3>::value || is_void<_A3>::value)> class __promote {}; template class __promote<_A1, _A2, _A3, true> { private: typedef typename __promote<_A1>::type __type1; typedef typename __promote<_A2>::type __type2; typedef typename __promote<_A3>::type __type3; public: typedef decltype(__type1() + __type2() + __type3()) type; }; template class __promote<_A1, _A2, void, true> { private: typedef typename __promote<_A1>::type __type1; typedef typename __promote<_A2>::type __type2; public: typedef decltype(__type1() + __type2()) type; }; template class __promote<_A1, void, void, true> { public: typedef typename conditional::value, typename conditional::value, double, _A1>::type, void >::type type; }; #ifdef _LIBCPP_STORE_AS_OPTIMIZATION // __transform template ::value> struct __transform {typedef _Tp type;}; template struct __transform<_Tp, 1, true> {typedef unsigned char type;}; template struct __transform<_Tp, 2, true> {typedef unsigned short type;}; template struct __transform<_Tp, 4, true> {typedef unsigned int type;}; template struct __transform<_Tp, 8, true> {typedef unsigned long long type;}; #endif // _LIBCPP_STORE_AS_OPTIMIZATION // make_signed / make_unsigned typedef __type_list > > > > __signed_types; typedef __type_list > > > > __unsigned_types; template struct __find_first; template struct __find_first<__type_list<_Hp, _Tp>, _Size, true> { typedef _Hp type; }; template struct __find_first<__type_list<_Hp, _Tp>, _Size, false> { typedef typename __find_first<_Tp, _Size>::type type; }; template ::type>::value, bool = is_volatile::type>::value> struct __apply_cv { typedef _Up type; }; template struct __apply_cv<_Tp, _Up, true, false> { typedef const _Up type; }; template struct __apply_cv<_Tp, _Up, false, true> { typedef volatile _Up type; }; template struct __apply_cv<_Tp, _Up, true, true> { typedef const volatile _Up type; }; template struct __apply_cv<_Tp&, _Up, false, false> { typedef _Up& type; }; template struct __apply_cv<_Tp&, _Up, true, false> { typedef const _Up& type; }; template struct __apply_cv<_Tp&, _Up, false, true> { typedef volatile _Up& type; }; template struct __apply_cv<_Tp&, _Up, true, true> { typedef const volatile _Up& type; }; template ::value || is_enum<_Tp>::value> struct __make_signed {}; template struct __make_signed<_Tp, true> { typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type; }; template <> struct __make_signed {}; template <> struct __make_signed< signed short, true> {typedef short type;}; template <> struct __make_signed {typedef short type;}; template <> struct __make_signed< signed int, true> {typedef int type;}; template <> struct __make_signed {typedef int type;}; template <> struct __make_signed< signed long, true> {typedef long type;}; template <> struct __make_signed {typedef long type;}; template <> struct __make_signed< signed long long, true> {typedef long long type;}; template <> struct __make_signed {typedef long long type;}; template struct _LIBCPP_VISIBLE make_signed { typedef typename __apply_cv<_Tp, typename __make_signed::type>::type>::type type; }; template ::value || is_enum<_Tp>::value> struct __make_unsigned {}; template struct __make_unsigned<_Tp, true> { typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type; }; template <> struct __make_unsigned {}; template <> struct __make_unsigned< signed short, true> {typedef unsigned short type;}; template <> struct __make_unsigned {typedef unsigned short type;}; template <> struct __make_unsigned< signed int, true> {typedef unsigned int type;}; template <> struct __make_unsigned {typedef unsigned int type;}; template <> struct __make_unsigned< signed long, true> {typedef unsigned long type;}; template <> struct __make_unsigned {typedef unsigned long type;}; template <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;}; template <> struct __make_unsigned {typedef unsigned long long type;}; template struct _LIBCPP_VISIBLE make_unsigned { typedef typename __apply_cv<_Tp, typename __make_unsigned::type>::type>::type type; }; #ifdef _LIBCPP_HAS_NO_VARIADICS template struct _LIBCPP_VISIBLE common_type { public: typedef typename common_type::type, V>::type type; }; template struct _LIBCPP_VISIBLE common_type<_Tp, void, void> { public: typedef _Tp type; }; template struct _LIBCPP_VISIBLE common_type<_Tp, _Up, void> { private: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES static _Tp&& __t(); static _Up&& __u(); #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES static _Tp __t(); static _Up __u(); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES public: typedef typename remove_reference::type type; }; #else // _LIBCPP_HAS_NO_VARIADICS template struct common_type; template struct _LIBCPP_VISIBLE common_type<_Tp> { typedef _Tp type; }; template struct _LIBCPP_VISIBLE common_type<_Tp, _Up> { private: static _Tp&& __t(); static _Up&& __u(); static bool __f(); public: typedef typename remove_reference::type type; }; template struct _LIBCPP_VISIBLE common_type<_Tp, _Up, _Vp...> { typedef typename common_type::type, _Vp...>::type type; }; #endif // _LIBCPP_HAS_NO_VARIADICS // is_assignable template decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>(), true_type())) #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES __is_assignable_test(_Tp&&, _Arg&&); #else __is_assignable_test(_Tp, _Arg&); #endif template false_type #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES __is_assignable_test(__any, _Arg&&); #else __is_assignable_test(__any, _Arg&); #endif template ::value || is_void<_Arg>::value> struct __is_assignable_imp : public common_type < decltype(__is_assignable_test(declval<_Tp>(), declval<_Arg>())) >::type {}; template struct __is_assignable_imp<_Tp, _Arg, true> : public false_type { }; template struct is_assignable : public __is_assignable_imp<_Tp, _Arg> {}; // is_copy_assignable template struct _LIBCPP_VISIBLE is_copy_assignable : public is_assignable::type, const typename add_lvalue_reference<_Tp>::type> {}; // is_move_assignable template struct _LIBCPP_VISIBLE is_move_assignable #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES : public is_assignable::type, const typename add_rvalue_reference<_Tp>::type> {}; #else : public is_copy_assignable<_Tp> {}; #endif // is_destructible template struct __destructible_test { _Tp __t; }; template decltype((_VSTD::declval<__destructible_test<_Tp> >().~__destructible_test<_Tp>(), true_type())) #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES __is_destructible_test(_Tp&&); #else __is_destructible_test(_Tp&); #endif false_type __is_destructible_test(__any); template ::value || is_abstract<_Tp>::value> struct __destructible_imp : public common_type < decltype(__is_destructible_test(declval<_Tp>())) >::type {}; template struct __destructible_imp<_Tp, true> : public false_type {}; template struct is_destructible : public __destructible_imp<_Tp> {}; // move #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY typename remove_reference<_Tp>::type&& move(_Tp&& __t) _NOEXCEPT { typedef typename remove_reference<_Tp>::type _Up; return static_cast<_Up&&>(__t); } template inline _LIBCPP_INLINE_VISIBILITY _Tp&& forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT { return static_cast<_Tp&&>(__t); } template inline _LIBCPP_INLINE_VISIBILITY _Tp&& forward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT { static_assert(!std::is_lvalue_reference<_Tp>::value, "Can not forward an rvalue as an lvalue."); return static_cast<_Tp&&>(__t); } #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY _Tp& move(_Tp& __t) { return __t; } template inline _LIBCPP_INLINE_VISIBILITY const _Tp& move(const _Tp& __t) { return __t; } template inline _LIBCPP_INLINE_VISIBILITY _Tp& forward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT { return __t; } template class __rv { typedef typename remove_reference<_Tp>::type _Trr; _Trr& t_; public: _LIBCPP_INLINE_VISIBILITY _Trr* operator->() {return &t_;} _LIBCPP_INLINE_VISIBILITY explicit __rv(_Trr& __t) : t_(__t) {} }; #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct _LIBCPP_VISIBLE decay { private: typedef typename remove_reference<_Tp>::type _Up; public: typedef typename conditional < is_array<_Up>::value, typename remove_extent<_Up>::type*, typename conditional < is_function<_Up>::value, typename add_pointer<_Up>::type, typename remove_cv<_Up>::type >::type >::type type; }; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template inline _LIBCPP_INLINE_VISIBILITY typename decay<_Tp>::type __decay_copy(_Tp&& __t) { return _VSTD::forward<_Tp>(__t); } #else template inline _LIBCPP_INLINE_VISIBILITY typename decay<_Tp>::type __decay_copy(const _Tp& __t) { return _VSTD::forward<_Tp>(__t); } #endif template struct __member_pointer_traits_imp { }; #ifndef _LIBCPP_HAS_NO_VARIADICS template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> { typedef _Class _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> { typedef _Class const _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> { typedef _Class volatile _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> { typedef _Class const volatile _ClassType; typedef _Rp _ReturnType; }; #if __has_feature(cxx_reference_qualified_functions) template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> { typedef _Class& _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> { typedef _Class const& _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> { typedef _Class volatile& _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> { typedef _Class const volatile& _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> { typedef _Class&& _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> { typedef _Class const&& _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> { typedef _Class volatile&& _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> { typedef _Class const volatile&& _ClassType; typedef _Rp _ReturnType; }; #endif // __has_feature(cxx_reference_qualified_functions) #else // _LIBCPP_HAS_NO_VARIADICS template struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false> { typedef _Class _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> { typedef _Class _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> { typedef _Class _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> { typedef _Class _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> { typedef _Class const _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> { typedef _Class const _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> { typedef _Class const _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false> { typedef _Class const _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> { typedef _Class volatile _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> { typedef _Class volatile _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false> { typedef _Class volatile _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false> { typedef _Class volatile _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false> { typedef _Class const volatile _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false> { typedef _Class const volatile _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false> { typedef _Class const volatile _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false> { typedef _Class const volatile _ClassType; typedef _Rp _ReturnType; }; #endif // _LIBCPP_HAS_NO_VARIADICS template struct __member_pointer_traits_imp<_Rp _Class::*, false, true> { typedef _Class _ClassType; typedef _Rp _ReturnType; }; template struct __member_pointer_traits : public __member_pointer_traits_imp<_MP, is_member_function_pointer<_MP>::value, is_member_object_pointer<_MP>::value> { // typedef ... _ClassType; // typedef ... _ReturnType; }; // result_of template class result_of; #ifdef _LIBCPP_HAS_NO_VARIADICS template class __result_of { }; template class __result_of<_Fn(), true, false> { public: typedef decltype(declval<_Fn>()()) type; }; template class __result_of<_Fn(_A0), true, false> { public: typedef decltype(declval<_Fn>()(declval<_A0>())) type; }; template class __result_of<_Fn(_A0, _A1), true, false> { public: typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type; }; template class __result_of<_Fn(_A0, _A1, _A2), true, false> { public: typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type; }; template struct __result_of_mp; // member function pointer template struct __result_of_mp<_MP, _Tp, true> : public common_type::_ReturnType> { }; // member data pointer template struct __result_of_mdp; template struct __result_of_mdp<_Rp _Class::*, _Tp, false> { typedef typename __apply_cv()), _Rp>::type& type; }; template struct __result_of_mdp<_Rp _Class::*, _Tp, true> { typedef typename __apply_cv<_Tp, _Rp>::type& type; }; template struct __result_of_mp<_Rp _Class::*, _Tp, false> : public __result_of_mdp<_Rp _Class::*, _Tp, is_base_of<_Class, typename remove_reference<_Tp>::type>::value> { }; template class __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer : public __result_of_mp::type, _Tp, is_member_function_pointer::type>::value> { }; template class __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer : public __result_of_mp::type, _Tp, is_member_function_pointer::type>::value> { }; template class __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer : public __result_of_mp::type, _Tp, is_member_function_pointer::type>::value> { }; template class __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer : public __result_of_mp::type, _Tp, is_member_function_pointer::type>::value> { }; // result_of template class _LIBCPP_VISIBLE result_of<_Fn()> : public __result_of<_Fn(), is_class::type>::value || is_function::type>::value, is_member_pointer::type>::value > { }; template class _LIBCPP_VISIBLE result_of<_Fn(_A0)> : public __result_of<_Fn(_A0), is_class::type>::value || is_function::type>::value, is_member_pointer::type>::value > { }; template class _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1)> : public __result_of<_Fn(_A0, _A1), is_class::type>::value || is_function::type>::value, is_member_pointer::type>::value > { }; template class _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1, _A2)> : public __result_of<_Fn(_A0, _A1, _A2), is_class::type>::value || is_function::type>::value, is_member_pointer::type>::value > { }; #endif // _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS // template struct is_constructible; // main is_constructible test template struct __select_2nd { typedef T type; }; template typename __select_2nd()...))), true_type>::type __is_constructible_test(_Tp&&, _Args&& ...); template false_type __is_constructible_test(__any, _Args&& ...); template struct __is_constructible // false, _Tp is not a scalar : public common_type < decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...)) >::type {}; // function types are not constructible template struct __is_constructible : public false_type {}; // handle scalars and reference types // Scalars are default constructible, references are not template struct __is_constructible : public is_scalar<_Tp> {}; // Scalars and references are constructible from one arg if that arg is // implicitly convertible to the scalar or reference. template struct __is_constructible_ref { true_type static __lxx(_Tp); false_type static __lxx(...); }; template struct __is_constructible : public common_type < decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>())) >::type {}; // Scalars and references are not constructible from multiple args. template struct __is_constructible : public false_type {}; // Treat scalars and reference types separately template struct __is_constructible_void_check : public __is_constructible::value || is_reference<_Tp>::value, _Tp, _Args...> {}; // If any of T or Args is void, is_constructible should be false template struct __is_constructible_void_check : public false_type {}; template struct __contains_void; template <> struct __contains_void<> : false_type {}; template struct __contains_void<_A0, _Args...> { static const bool value = is_void<_A0>::value || __contains_void<_Args...>::value; }; // is_constructible entry point template struct _LIBCPP_VISIBLE is_constructible : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value || is_abstract<_Tp>::value, _Tp, _Args...> {}; // Array types are default constructible if their element type // is default constructible template struct __is_constructible : public is_constructible::type> {}; // Otherwise array types are not constructible by this syntax template struct __is_constructible : public false_type {}; // Incomplete array types are not constructible template struct __is_constructible : public false_type {}; #else // _LIBCPP_HAS_NO_VARIADICS // template struct is_constructible0; // main is_constructible0 test template decltype((_Tp(), true_type())) __is_constructible0_test(_Tp&); false_type __is_constructible0_test(__any); template decltype((_Tp(_VSTD::declval<_A0>()), true_type())) __is_constructible1_test(_Tp&, _A0&); template false_type __is_constructible1_test(__any, _A0&); template decltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type())) __is_constructible2_test(_Tp&, _A0&, _A1&); template false_type __is_constructible2_test(__any, _A0&, _A1&); template struct __is_constructible0_imp // false, _Tp is not a scalar : public common_type < decltype(__is_constructible0_test(declval<_Tp&>())) >::type {}; template struct __is_constructible1_imp // false, _Tp is not a scalar : public common_type < decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>())) >::type {}; template struct __is_constructible2_imp // false, _Tp is not a scalar : public common_type < decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>())) >::type {}; // handle scalars and reference types // Scalars are default constructible, references are not template struct __is_constructible0_imp : public is_scalar<_Tp> {}; template struct __is_constructible1_imp : public is_convertible<_A0, _Tp> {}; template struct __is_constructible2_imp : public false_type {}; // Treat scalars and reference types separately template struct __is_constructible0_void_check : public __is_constructible0_imp::value || is_reference<_Tp>::value, _Tp> {}; template struct __is_constructible1_void_check : public __is_constructible1_imp::value || is_reference<_Tp>::value, _Tp, _A0> {}; template struct __is_constructible2_void_check : public __is_constructible2_imp::value || is_reference<_Tp>::value, _Tp, _A0, _A1> {}; // If any of T or Args is void, is_constructible should be false template struct __is_constructible0_void_check : public false_type {}; template struct __is_constructible1_void_check : public false_type {}; template struct __is_constructible2_void_check : public false_type {}; // is_constructible entry point namespace __is_construct { struct __nat {}; } template struct _LIBCPP_VISIBLE is_constructible : public __is_constructible2_void_check::value || is_abstract<_Tp>::value || is_function<_Tp>::value || is_void<_A0>::value || is_void<_A1>::value, _Tp, _A0, _A1> {}; template struct _LIBCPP_VISIBLE is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> : public __is_constructible0_void_check::value || is_abstract<_Tp>::value || is_function<_Tp>::value, _Tp> {}; template struct _LIBCPP_VISIBLE is_constructible<_Tp, _A0, __is_construct::__nat> : public __is_constructible1_void_check::value || is_abstract<_Tp>::value || is_function<_Tp>::value || is_void<_A0>::value, _Tp, _A0> {}; // Array types are default constructible if their element type // is default constructible template struct __is_constructible0_imp : public is_constructible::type> {}; template struct __is_constructible1_imp : public false_type {}; template struct __is_constructible2_imp : public false_type {}; // Incomplete array types are not constructible template struct __is_constructible0_imp : public false_type {}; template struct __is_constructible1_imp : public false_type {}; template struct __is_constructible2_imp : public false_type {}; #endif // _LIBCPP_HAS_NO_VARIADICS // is_default_constructible template struct _LIBCPP_VISIBLE is_default_constructible : public is_constructible<_Tp> {}; // is_copy_constructible template struct _LIBCPP_VISIBLE is_copy_constructible : public is_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> {}; // is_move_constructible template struct _LIBCPP_VISIBLE 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 {}; // is_trivially_constructible #ifndef _LIBCPP_HAS_NO_VARIADICS #if __has_feature(is_trivially_constructible) template struct _LIBCPP_VISIBLE is_trivially_constructible : integral_constant { }; #else // !__has_feature(is_trivially_constructible) template struct _LIBCPP_VISIBLE is_trivially_constructible : false_type { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp> #if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant #else : integral_constant::value> #endif { }; template #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&&> #else struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp> #endif : integral_constant::value> { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&> : integral_constant::value> { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&> : integral_constant::value> { }; #endif // !__has_feature(is_trivially_constructible) #else // _LIBCPP_HAS_NO_VARIADICS template struct _LIBCPP_VISIBLE is_trivially_constructible : false_type { }; #if __has_feature(is_trivially_constructible) template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> : integral_constant { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp, __is_construct::__nat> : integral_constant { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&, __is_construct::__nat> : integral_constant { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&, __is_construct::__nat> : integral_constant { }; #else // !__has_feature(is_trivially_constructible) template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> : integral_constant::value> { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp, __is_construct::__nat> : integral_constant::value> { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&, __is_construct::__nat> : integral_constant::value> { }; template struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&, __is_construct::__nat> : integral_constant::value> { }; #endif // !__has_feature(is_trivially_constructible) #endif // _LIBCPP_HAS_NO_VARIADICS // is_trivially_default_constructible template struct _LIBCPP_VISIBLE is_trivially_default_constructible : public is_trivially_constructible<_Tp> {}; // is_trivially_copy_constructible template struct _LIBCPP_VISIBLE is_trivially_copy_constructible : public is_trivially_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> {}; // is_trivially_move_constructible template struct _LIBCPP_VISIBLE 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 {}; // is_trivially_assignable #if __has_feature(is_trivially_constructible) template struct is_trivially_assignable : integral_constant { }; #else // !__has_feature(is_trivially_constructible) template struct is_trivially_assignable : public false_type {}; template struct is_trivially_assignable<_Tp&, _Tp> : integral_constant::value> {}; template struct is_trivially_assignable<_Tp&, _Tp&> : integral_constant::value> {}; template struct is_trivially_assignable<_Tp&, const _Tp&> : integral_constant::value> {}; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct is_trivially_assignable<_Tp&, _Tp&&> : integral_constant::value> {}; #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // !__has_feature(is_trivially_constructible) // is_trivially_copy_assignable template struct _LIBCPP_VISIBLE is_trivially_copy_assignable : public is_trivially_assignable::type, const typename add_lvalue_reference<_Tp>::type> {}; // is_trivially_move_assignable template struct _LIBCPP_VISIBLE is_trivially_move_assignable : public is_trivially_assignable::type, #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES typename add_rvalue_reference<_Tp>::type> #else typename add_lvalue_reference<_Tp>::type> #endif {}; // is_trivially_destructible #if __has_feature(has_trivial_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) template struct _LIBCPP_VISIBLE is_trivially_destructible : public integral_constant {}; #else // _LIBCPP_HAS_TYPE_TRAITS template struct __libcpp_trivial_destructor : public integral_constant::value || is_reference<_Tp>::value> {}; template struct _LIBCPP_VISIBLE is_trivially_destructible : public __libcpp_trivial_destructor::type> {}; #endif // _LIBCPP_HAS_TYPE_TRAITS // is_nothrow_constructible #ifndef _LIBCPP_HAS_NO_VARIADICS #if __has_feature(cxx_noexcept) template struct __is_nothrow_constructible; template struct __is_nothrow_constructible : public integral_constant()...))> { }; template struct __is_nothrow_constructible : public false_type { }; template struct _LIBCPP_VISIBLE is_nothrow_constructible : __is_nothrow_constructible::value, _Tp, _Args...> { }; template struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp[_Ns]> : __is_nothrow_constructible::value, _Tp> { }; #else // __has_feature(cxx_noexcept) template struct _LIBCPP_VISIBLE is_nothrow_constructible : false_type { }; template struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp> #if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant #else : integral_constant::value> #endif { }; template #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&&> #else struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp> #endif #if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant #else : integral_constant::value> #endif { }; template struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&> #if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant #else : integral_constant::value> #endif { }; template struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&> #if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant #else : integral_constant::value> #endif { }; #endif // __has_feature(cxx_noexcept) #else // _LIBCPP_HAS_NO_VARIADICS template struct _LIBCPP_VISIBLE is_nothrow_constructible : false_type { }; template struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> #if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant #else : integral_constant::value> #endif { }; template struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp, __is_construct::__nat> #if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant #else : integral_constant::value> #endif { }; template struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&, __is_construct::__nat> #if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant #else : integral_constant::value> #endif { }; template struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&, __is_construct::__nat> #if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant #else : integral_constant::value> #endif { }; #endif // _LIBCPP_HAS_NO_VARIADICS // is_nothrow_default_constructible template struct _LIBCPP_VISIBLE is_nothrow_default_constructible : public is_nothrow_constructible<_Tp> {}; // is_nothrow_copy_constructible template struct _LIBCPP_VISIBLE is_nothrow_copy_constructible : public is_nothrow_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> {}; // is_nothrow_move_constructible template struct _LIBCPP_VISIBLE 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 {}; // is_nothrow_assignable #if __has_feature(cxx_noexcept) template struct __is_nothrow_assignable; template struct __is_nothrow_assignable : public false_type { }; template struct __is_nothrow_assignable : public integral_constant() = _VSTD::declval<_Arg>()) > { }; template struct _LIBCPP_VISIBLE is_nothrow_assignable : public __is_nothrow_assignable::value, _Tp, _Arg> { }; #else // __has_feature(cxx_noexcept) template struct _LIBCPP_VISIBLE is_nothrow_assignable : public false_type {}; template struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp> #if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant {}; #else : integral_constant::value> {}; #endif template struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp&> #if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant {}; #else : integral_constant::value> {}; #endif template struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, const _Tp&> #if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant {}; #else : integral_constant::value> {}; #endif #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct is_nothrow_assignable<_Tp&, _Tp&&> #if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) : integral_constant {}; #else : integral_constant::value> {}; #endif #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // __has_feature(cxx_noexcept) // is_nothrow_copy_assignable template struct _LIBCPP_VISIBLE is_nothrow_copy_assignable : public is_nothrow_assignable::type, const typename add_lvalue_reference<_Tp>::type> {}; // is_nothrow_move_assignable template struct _LIBCPP_VISIBLE is_nothrow_move_assignable : public is_nothrow_assignable::type, #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES typename add_rvalue_reference<_Tp>::type> #else typename add_lvalue_reference<_Tp>::type> #endif {}; // is_nothrow_destructible #if __has_feature(cxx_noexcept) template struct __is_nothrow_destructible; template struct __is_nothrow_destructible : public false_type { }; template struct __is_nothrow_destructible : public integral_constant().~_Tp()) > { }; template struct _LIBCPP_VISIBLE is_nothrow_destructible : public __is_nothrow_destructible::value, _Tp> { }; template struct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp[_Ns]> : public is_nothrow_destructible<_Tp> { }; template struct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp&> : public true_type { }; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template struct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp&&> : public true_type { }; #endif #else template struct __libcpp_nothrow_destructor : public integral_constant::value || is_reference<_Tp>::value> {}; template struct _LIBCPP_VISIBLE is_nothrow_destructible : public __libcpp_nothrow_destructor::type> {}; #endif // is_pod #if __has_feature(is_pod) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) template struct _LIBCPP_VISIBLE is_pod : public integral_constant {}; #else // _LIBCPP_HAS_TYPE_TRAITS template struct _LIBCPP_VISIBLE is_pod : public integral_constant::value && is_trivially_copy_constructible<_Tp>::value && is_trivially_copy_assignable<_Tp>::value && is_trivially_destructible<_Tp>::value> {}; #endif // _LIBCPP_HAS_TYPE_TRAITS // is_literal_type; template struct _LIBCPP_VISIBLE is_literal_type #if __has_feature(is_literal) : public integral_constant #else : integral_constant::type>::value || is_reference::type>::value> #endif {}; // is_standard_layout; template struct _LIBCPP_VISIBLE is_standard_layout #if __has_feature(is_standard_layout) : public integral_constant #else : integral_constant::type>::value> #endif {}; // is_trivially_copyable; template struct _LIBCPP_VISIBLE is_trivially_copyable #if __has_feature(is_trivially_copyable) : public integral_constant #else : integral_constant::type>::value> #endif {}; // is_trivial; template struct _LIBCPP_VISIBLE is_trivial #if __has_feature(is_trivial) : public integral_constant #else : integral_constant::value && is_trivially_default_constructible<_Tp>::value> #endif {}; #ifndef _LIBCPP_HAS_NO_VARIADICS // Check for complete types template struct __check_complete; template <> struct __check_complete<> { }; template struct __check_complete<_Hp, _T0, _Tp...> : private __check_complete<_Hp>, private __check_complete<_T0, _Tp...> { }; template struct __check_complete<_Hp, _Hp> : private __check_complete<_Hp> { }; template struct __check_complete<_Tp> { static_assert(sizeof(_Tp) > 0, "Type must be complete."); }; template struct __check_complete<_Tp&> : private __check_complete<_Tp> { }; template struct __check_complete<_Tp&&> : private __check_complete<_Tp> { }; template struct __check_complete<_Rp (*)(_Param...)> : private __check_complete<_Rp> { }; template struct __check_complete<_Rp (_Param...)> : private __check_complete<_Rp> { }; template struct __check_complete<_Rp (_Class::*)(_Param...)> : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) const> : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) volatile> : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) const volatile> : private __check_complete<_Class> { }; #if __has_feature(cxx_reference_qualified_functions) template struct __check_complete<_Rp (_Class::*)(_Param...) &> : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) const&> : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) volatile&> : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) &&> : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) const&&> : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> : private __check_complete<_Class> { }; template struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> : private __check_complete<_Class> { }; #endif template struct __check_complete<_Rp _Class::*> : private __check_complete<_Class> { }; // __invoke forward declarations // fall back - none of the bullets template auto __invoke(__any, _Args&& ...__args) -> __nat; // bullets 1 and 2 template _LIBCPP_INLINE_VISIBILITY auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)); template _LIBCPP_INLINE_VISIBILITY auto __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)); // bullets 3 and 4 template _LIBCPP_INLINE_VISIBILITY auto __invoke(_Fp&& __f, _A0&& __a0) -> decltype(_VSTD::forward<_A0>(__a0).*__f); template _LIBCPP_INLINE_VISIBILITY auto __invoke(_Fp&& __f, _A0&& __a0) -> decltype((*_VSTD::forward<_A0>(__a0)).*__f); // bullet 5 template _LIBCPP_INLINE_VISIBILITY auto __invoke(_Fp&& __f, _Args&& ...__args) -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)); // __invokable template struct __invokable_imp : private __check_complete<_Fp> { typedef decltype( __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...) ) type; static const bool value = !is_same::value; }; template struct __invokable : public integral_constant::value> { }; // __invoke_of template struct __invoke_of_imp // false { }; template struct __invoke_of_imp { typedef typename __invokable_imp<_Fp, _Args...>::type type; }; template struct __invoke_of : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...> { }; template class _LIBCPP_VISIBLE result_of<_Fp(_Args...)> : public __invoke_of<_Fp, _Args...> { }; #endif // _LIBCPP_HAS_NO_VARIADICS template inline _LIBCPP_INLINE_VISIBILITY #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE typename enable_if < is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value >::type #else void #endif swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && is_nothrow_move_assignable<_Tp>::value) { _Tp __t(_VSTD::move(__x)); __x = _VSTD::move(__y); __y = _VSTD::move(__t); } template inline _LIBCPP_INLINE_VISIBILITY void iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b))) _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(), *_VSTD::declval<_ForwardIterator2>()))) { swap(*__a, *__b); } // __swappable namespace __detail { using _VSTD::swap; __nat swap(__any, __any); template struct __swappable { typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type; static const bool value = !is_same::value; }; } // __detail template struct __is_swappable : public integral_constant::value> { }; #if __has_feature(cxx_noexcept) template struct __is_nothrow_swappable_imp : public integral_constant(), _VSTD::declval<_Tp&>()))> { }; template struct __is_nothrow_swappable_imp : public false_type { }; template struct __is_nothrow_swappable : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp> { }; #else // __has_feature(cxx_noexcept) template struct __is_nothrow_swappable : public false_type { }; #endif // __has_feature(cxx_noexcept) #ifdef _LIBCXX_UNDERLYING_TYPE template struct underlying_type { typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type; }; #else // _LIBCXX_UNDERLYING_TYPE template struct underlying_type { static_assert(_Support, "The underyling_type trait requires compiler " "support. Either no such support exists or " "libc++ does not know how to use it."); }; #endif // _LIBCXX_UNDERLYING_TYPE _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_TYPE_TRAITS