type_traits revision 276517
1227825Stheraven// -*- C++ -*- 2227825Stheraven//===------------------------ type_traits ---------------------------------===// 3227825Stheraven// 4227825Stheraven// The LLVM Compiler Infrastructure 5227825Stheraven// 6227825Stheraven// This file is dual licensed under the MIT and the University of Illinois Open 7227825Stheraven// Source Licenses. See LICENSE.TXT for details. 8227825Stheraven// 9227825Stheraven//===----------------------------------------------------------------------===// 10227825Stheraven 11227825Stheraven#ifndef _LIBCPP_TYPE_TRAITS 12227825Stheraven#define _LIBCPP_TYPE_TRAITS 13227825Stheraven 14227825Stheraven/* 15227825Stheraven type_traits synopsis 16227825Stheraven 17227825Stheravennamespace std 18227825Stheraven{ 19227825Stheraven 20227825Stheraven // helper class: 21227825Stheraven template <class T, T v> struct integral_constant; 22227825Stheraven typedef integral_constant<bool, true> true_type; 23227825Stheraven typedef integral_constant<bool, false> false_type; 24227825Stheraven 25227825Stheraven // helper traits 26227825Stheraven template <bool, class T = void> struct enable_if; 27227825Stheraven template <bool, class T, class F> struct conditional; 28227825Stheraven 29227825Stheraven // Primary classification traits: 30227825Stheraven template <class T> struct is_void; 31261283Sdim template <class T> struct is_null_pointer; // C++14 32227825Stheraven template <class T> struct is_integral; 33227825Stheraven template <class T> struct is_floating_point; 34227825Stheraven template <class T> struct is_array; 35227825Stheraven template <class T> struct is_pointer; 36227825Stheraven template <class T> struct is_lvalue_reference; 37227825Stheraven template <class T> struct is_rvalue_reference; 38227825Stheraven template <class T> struct is_member_object_pointer; 39227825Stheraven template <class T> struct is_member_function_pointer; 40227825Stheraven template <class T> struct is_enum; 41227825Stheraven template <class T> struct is_union; 42227825Stheraven template <class T> struct is_class; 43227825Stheraven template <class T> struct is_function; 44227825Stheraven 45227825Stheraven // Secondary classification traits: 46227825Stheraven template <class T> struct is_reference; 47227825Stheraven template <class T> struct is_arithmetic; 48227825Stheraven template <class T> struct is_fundamental; 49227825Stheraven template <class T> struct is_member_pointer; 50227825Stheraven template <class T> struct is_scalar; 51227825Stheraven template <class T> struct is_object; 52227825Stheraven template <class T> struct is_compound; 53227825Stheraven 54227825Stheraven // Const-volatile properties and transformations: 55227825Stheraven template <class T> struct is_const; 56227825Stheraven template <class T> struct is_volatile; 57227825Stheraven template <class T> struct remove_const; 58227825Stheraven template <class T> struct remove_volatile; 59227825Stheraven template <class T> struct remove_cv; 60227825Stheraven template <class T> struct add_const; 61227825Stheraven template <class T> struct add_volatile; 62227825Stheraven template <class T> struct add_cv; 63227825Stheraven 64227825Stheraven // Reference transformations: 65227825Stheraven template <class T> struct remove_reference; 66227825Stheraven template <class T> struct add_lvalue_reference; 67227825Stheraven template <class T> struct add_rvalue_reference; 68227825Stheraven 69227825Stheraven // Pointer transformations: 70227825Stheraven template <class T> struct remove_pointer; 71227825Stheraven template <class T> struct add_pointer; 72227825Stheraven 73227825Stheraven // Integral properties: 74227825Stheraven template <class T> struct is_signed; 75227825Stheraven template <class T> struct is_unsigned; 76227825Stheraven template <class T> struct make_signed; 77227825Stheraven template <class T> struct make_unsigned; 78227825Stheraven 79227825Stheraven // Array properties and transformations: 80227825Stheraven template <class T> struct rank; 81227825Stheraven template <class T, unsigned I = 0> struct extent; 82227825Stheraven template <class T> struct remove_extent; 83227825Stheraven template <class T> struct remove_all_extents; 84227825Stheraven 85227825Stheraven // Member introspection: 86227825Stheraven template <class T> struct is_pod; 87227825Stheraven template <class T> struct is_trivial; 88227825Stheraven template <class T> struct is_trivially_copyable; 89227825Stheraven template <class T> struct is_standard_layout; 90227825Stheraven template <class T> struct is_literal_type; 91227825Stheraven template <class T> struct is_empty; 92227825Stheraven template <class T> struct is_polymorphic; 93227825Stheraven template <class T> struct is_abstract; 94227825Stheraven 95227825Stheraven template <class T, class... Args> struct is_constructible; 96227825Stheraven template <class T> struct is_default_constructible; 97227825Stheraven template <class T> struct is_copy_constructible; 98227825Stheraven template <class T> struct is_move_constructible; 99227825Stheraven template <class T, class U> struct is_assignable; 100227825Stheraven template <class T> struct is_copy_assignable; 101227825Stheraven template <class T> struct is_move_assignable; 102227825Stheraven template <class T> struct is_destructible; 103227825Stheraven 104227825Stheraven template <class T, class... Args> struct is_trivially_constructible; 105227825Stheraven template <class T> struct is_trivially_default_constructible; 106227825Stheraven template <class T> struct is_trivially_copy_constructible; 107227825Stheraven template <class T> struct is_trivially_move_constructible; 108227825Stheraven template <class T, class U> struct is_trivially_assignable; 109227825Stheraven template <class T> struct is_trivially_copy_assignable; 110227825Stheraven template <class T> struct is_trivially_move_assignable; 111227825Stheraven template <class T> struct is_trivially_destructible; 112227825Stheraven 113227825Stheraven template <class T, class... Args> struct is_nothrow_constructible; 114227825Stheraven template <class T> struct is_nothrow_default_constructible; 115227825Stheraven template <class T> struct is_nothrow_copy_constructible; 116227825Stheraven template <class T> struct is_nothrow_move_constructible; 117227825Stheraven template <class T, class U> struct is_nothrow_assignable; 118227825Stheraven template <class T> struct is_nothrow_copy_assignable; 119227825Stheraven template <class T> struct is_nothrow_move_assignable; 120227825Stheraven template <class T> struct is_nothrow_destructible; 121227825Stheraven 122227825Stheraven template <class T> struct has_virtual_destructor; 123227825Stheraven 124227825Stheraven // Relationships between types: 125227825Stheraven template <class T, class U> struct is_same; 126227825Stheraven template <class Base, class Derived> struct is_base_of; 127227825Stheraven template <class From, class To> struct is_convertible; 128227825Stheraven 129227825Stheraven // Alignment properties and transformations: 130227825Stheraven template <class T> struct alignment_of; 131227825Stheraven template <size_t Len, size_t Align = most_stringent_alignment_requirement> 132227825Stheraven struct aligned_storage; 133249998Sdim template <size_t Len, class... Types> struct aligned_union; 134227825Stheraven 135227825Stheraven template <class T> struct decay; 136227825Stheraven template <class... T> struct common_type; 137227825Stheraven template <class T> struct underlying_type; 138227825Stheraven template <class> class result_of; // undefined 139227825Stheraven template <class Fn, class... ArgTypes> class result_of<Fn(ArgTypes...)>; 140227825Stheraven 141253159Stheraven // const-volatile modifications: 142253159Stheraven template <class T> 143253159Stheraven using remove_const_t = typename remove_const<T>::type; // C++14 144253159Stheraven template <class T> 145253159Stheraven using remove_volatile_t = typename remove_volatile<T>::type; // C++14 146253159Stheraven template <class T> 147253159Stheraven using remove_cv_t = typename remove_cv<T>::type; // C++14 148253159Stheraven template <class T> 149253159Stheraven using add_const_t = typename add_const<T>::type; // C++14 150253159Stheraven template <class T> 151253159Stheraven using add_volatile_t = typename add_volatile<T>::type; // C++14 152253159Stheraven template <class T> 153253159Stheraven using add_cv_t = typename add_cv<T>::type; // C++14 154253159Stheraven 155253159Stheraven // reference modifications: 156253159Stheraven template <class T> 157253159Stheraven using remove_reference_t = typename remove_reference<T>::type; // C++14 158253159Stheraven template <class T> 159253159Stheraven using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; // C++14 160253159Stheraven template <class T> 161253159Stheraven using add_rvalue_reference_t = typename add_rvalue_reference<T>::type; // C++14 162253159Stheraven 163253159Stheraven // sign modifications: 164253159Stheraven template <class T> 165253159Stheraven using make_signed_t = typename make_signed<T>::type; // C++14 166253159Stheraven template <class T> 167253159Stheraven using make_unsigned_t = typename make_unsigned<T>::type; // C++14 168253159Stheraven 169253159Stheraven // array modifications: 170253159Stheraven template <class T> 171253159Stheraven using remove_extent_t = typename remove_extent<T>::type; // C++14 172253159Stheraven template <class T> 173253159Stheraven using remove_all_extents_t = typename remove_all_extents<T>::type; // C++14 174253159Stheraven 175253159Stheraven // pointer modifications: 176253159Stheraven template <class T> 177253159Stheraven using remove_pointer_t = typename remove_pointer<T>::type; // C++14 178253159Stheraven template <class T> 179253159Stheraven using add_pointer_t = typename add_pointer<T>::type; // C++14 180253159Stheraven 181253159Stheraven // other transformations: 182253159Stheraven template <size_t Len, std::size_t Align=default-alignment> 183253159Stheraven using aligned_storage_t = typename aligned_storage<Len,Align>::type; // C++14 184253159Stheraven template <std::size_t Len, class... Types> 185253159Stheraven using aligned_union_t = typename aligned_union<Len,Types...>::type; // C++14 186253159Stheraven template <class T> 187253159Stheraven using decay_t = typename decay<T>::type; // C++14 188253159Stheraven template <bool b, class T=void> 189253159Stheraven using enable_if_t = typename enable_if<b,T>::type; // C++14 190253159Stheraven template <bool b, class T, class F> 191253159Stheraven using conditional_t = typename conditional<b,T,F>::type; // C++14 192253159Stheraven template <class... T> 193253159Stheraven using common_type_t = typename common_type<T...>::type; // C++14 194253159Stheraven template <class T> 195253159Stheraven using underlying_type_t = typename underlying_type<T>::type; // C++14 196253159Stheraven template <class F, class... ArgTypes> 197253159Stheraven using result_of_t = typename result_of<F(ArgTypes...)>::type; // C++14 198253159Stheraven 199227825Stheraven} // std 200227825Stheraven 201227825Stheraven*/ 202227825Stheraven#include <__config> 203227825Stheraven#include <cstddef> 204227825Stheraven 205227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 206227825Stheraven#pragma GCC system_header 207227825Stheraven#endif 208227825Stheraven 209227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD 210227825Stheraven 211232950Stheraventemplate <bool _Bp, class _If, class _Then> 212261283Sdim struct _LIBCPP_TYPE_VIS_ONLY conditional {typedef _If type;}; 213227825Stheraventemplate <class _If, class _Then> 214261283Sdim struct _LIBCPP_TYPE_VIS_ONLY conditional<false, _If, _Then> {typedef _Then type;}; 215227825Stheraven 216253159Stheraven#if _LIBCPP_STD_VER > 11 217253159Stheraventemplate <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type; 218253159Stheraven#endif 219253159Stheraven 220261283Sdimtemplate <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS_ONLY enable_if {}; 221261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY enable_if<true, _Tp> {typedef _Tp type;}; 222227825Stheraven 223253159Stheraven#if _LIBCPP_STD_VER > 11 224253159Stheraventemplate <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type; 225253159Stheraven#endif 226253159Stheraven 227253159Stheraven 228242945Stheravenstruct __two {char __lx[2];}; 229227825Stheraven 230227825Stheraven// helper class: 231227825Stheraven 232227825Stheraventemplate <class _Tp, _Tp __v> 233261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY integral_constant 234227825Stheraven{ 235234976Stheraven static _LIBCPP_CONSTEXPR const _Tp value = __v; 236227825Stheraven typedef _Tp value_type; 237227825Stheraven typedef integral_constant type; 238227825Stheraven _LIBCPP_INLINE_VISIBILITY 239234976Stheraven _LIBCPP_CONSTEXPR operator value_type() const {return value;} 240261283Sdim#if _LIBCPP_STD_VER > 11 241261283Sdim _LIBCPP_INLINE_VISIBILITY 242261283Sdim constexpr value_type operator ()() const {return value;} 243261283Sdim#endif 244227825Stheraven}; 245227825Stheraven 246227825Stheraventemplate <class _Tp, _Tp __v> 247234976Stheraven_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value; 248227825Stheraven 249227825Stheraventypedef integral_constant<bool, true> true_type; 250227825Stheraventypedef integral_constant<bool, false> false_type; 251227825Stheraven 252227825Stheraven// is_const 253227825Stheraven 254261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const : public false_type {}; 255261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const<_Tp const> : public true_type {}; 256227825Stheraven 257227825Stheraven// is_volatile 258227825Stheraven 259261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile : public false_type {}; 260261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile<_Tp volatile> : public true_type {}; 261227825Stheraven 262227825Stheraven// remove_const 263227825Stheraven 264261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const {typedef _Tp type;}; 265261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const<const _Tp> {typedef _Tp type;}; 266253159Stheraven#if _LIBCPP_STD_VER > 11 267253159Stheraventemplate <class _Tp> using remove_const_t = typename remove_const<_Tp>::type; 268253159Stheraven#endif 269227825Stheraven 270227825Stheraven// remove_volatile 271227825Stheraven 272261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile {typedef _Tp type;}; 273261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile<volatile _Tp> {typedef _Tp type;}; 274253159Stheraven#if _LIBCPP_STD_VER > 11 275253159Stheraventemplate <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type; 276253159Stheraven#endif 277227825Stheraven 278227825Stheraven// remove_cv 279227825Stheraven 280261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_cv 281227825Stheraven{typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;}; 282253159Stheraven#if _LIBCPP_STD_VER > 11 283253159Stheraventemplate <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type; 284253159Stheraven#endif 285227825Stheraven 286227825Stheraven// is_void 287227825Stheraven 288260015Sdimtemplate <class _Tp> struct __libcpp_is_void : public false_type {}; 289260015Sdimtemplate <> struct __libcpp_is_void<void> : public true_type {}; 290227825Stheraven 291261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void 292260015Sdim : public __libcpp_is_void<typename remove_cv<_Tp>::type> {}; 293227825Stheraven 294227825Stheraven// __is_nullptr_t 295227825Stheraven 296260015Sdimtemplate <class _Tp> struct __libcpp___is_nullptr : public false_type {}; 297260015Sdimtemplate <> struct __libcpp___is_nullptr<nullptr_t> : public true_type {}; 298227825Stheraven 299261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t 300260015Sdim : public __libcpp___is_nullptr<typename remove_cv<_Tp>::type> {}; 301227825Stheraven 302261283Sdim#if _LIBCPP_STD_VER > 11 303261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer 304270416Sdim : public __libcpp___is_nullptr<typename remove_cv<_Tp>::type> {}; 305261283Sdim#endif 306261283Sdim 307227825Stheraven// is_integral 308227825Stheraven 309260015Sdimtemplate <class _Tp> struct __libcpp_is_integral : public false_type {}; 310260015Sdimtemplate <> struct __libcpp_is_integral<bool> : public true_type {}; 311260015Sdimtemplate <> struct __libcpp_is_integral<char> : public true_type {}; 312260015Sdimtemplate <> struct __libcpp_is_integral<signed char> : public true_type {}; 313260015Sdimtemplate <> struct __libcpp_is_integral<unsigned char> : public true_type {}; 314260015Sdimtemplate <> struct __libcpp_is_integral<wchar_t> : public true_type {}; 315227825Stheraven#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS 316260015Sdimtemplate <> struct __libcpp_is_integral<char16_t> : public true_type {}; 317260015Sdimtemplate <> struct __libcpp_is_integral<char32_t> : public true_type {}; 318227825Stheraven#endif // _LIBCPP_HAS_NO_UNICODE_CHARS 319260015Sdimtemplate <> struct __libcpp_is_integral<short> : public true_type {}; 320260015Sdimtemplate <> struct __libcpp_is_integral<unsigned short> : public true_type {}; 321260015Sdimtemplate <> struct __libcpp_is_integral<int> : public true_type {}; 322260015Sdimtemplate <> struct __libcpp_is_integral<unsigned int> : public true_type {}; 323260015Sdimtemplate <> struct __libcpp_is_integral<long> : public true_type {}; 324260015Sdimtemplate <> struct __libcpp_is_integral<unsigned long> : public true_type {}; 325260015Sdimtemplate <> struct __libcpp_is_integral<long long> : public true_type {}; 326260015Sdimtemplate <> struct __libcpp_is_integral<unsigned long long> : public true_type {}; 327227825Stheraven 328261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral 329260015Sdim : public __libcpp_is_integral<typename remove_cv<_Tp>::type> {}; 330227825Stheraven 331227825Stheraven// is_floating_point 332227825Stheraven 333260015Sdimtemplate <class _Tp> struct __libcpp_is_floating_point : public false_type {}; 334260015Sdimtemplate <> struct __libcpp_is_floating_point<float> : public true_type {}; 335260015Sdimtemplate <> struct __libcpp_is_floating_point<double> : public true_type {}; 336260015Sdimtemplate <> struct __libcpp_is_floating_point<long double> : public true_type {}; 337227825Stheraven 338261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_floating_point 339260015Sdim : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {}; 340227825Stheraven 341227825Stheraven// is_array 342227825Stheraven 343261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array 344227825Stheraven : public false_type {}; 345261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[]> 346227825Stheraven : public true_type {}; 347261283Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]> 348227825Stheraven : public true_type {}; 349227825Stheraven 350227825Stheraven// is_pointer 351227825Stheraven 352260015Sdimtemplate <class _Tp> struct __libcpp_is_pointer : public false_type {}; 353260015Sdimtemplate <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {}; 354227825Stheraven 355261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pointer 356260015Sdim : public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {}; 357227825Stheraven 358227825Stheraven// is_reference 359227825Stheraven 360261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference : public false_type {}; 361261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference<_Tp&> : public true_type {}; 362227825Stheraven 363261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference : public false_type {}; 364227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 365261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference<_Tp&&> : public true_type {}; 366227825Stheraven#endif 367227825Stheraven 368261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference : public false_type {}; 369261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&> : public true_type {}; 370227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 371261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public true_type {}; 372227825Stheraven#endif 373227825Stheraven 374227825Stheraven#if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 375227825Stheraven#define _LIBCPP_HAS_TYPE_TRAITS 376227825Stheraven#endif 377227825Stheraven 378227825Stheraven// is_union 379227825Stheraven 380227825Stheraven#if __has_feature(is_union) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 381227825Stheraven 382261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union 383227825Stheraven : public integral_constant<bool, __is_union(_Tp)> {}; 384227825Stheraven 385227825Stheraven#else 386227825Stheraven 387227825Stheraventemplate <class _Tp> struct __libcpp_union : public false_type {}; 388261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union 389227825Stheraven : public __libcpp_union<typename remove_cv<_Tp>::type> {}; 390227825Stheraven 391227825Stheraven#endif 392227825Stheraven 393227825Stheraven// is_class 394227825Stheraven 395227825Stheraven#if __has_feature(is_class) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 396227825Stheraven 397261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class 398227825Stheraven : public integral_constant<bool, __is_class(_Tp)> {}; 399227825Stheraven 400227825Stheraven#else 401227825Stheraven 402227825Stheravennamespace __is_class_imp 403227825Stheraven{ 404227825Stheraventemplate <class _Tp> char __test(int _Tp::*); 405227825Stheraventemplate <class _Tp> __two __test(...); 406227825Stheraven} 407227825Stheraven 408261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class 409227825Stheraven : public integral_constant<bool, sizeof(__is_class_imp::__test<_Tp>(0)) == 1 && !is_union<_Tp>::value> {}; 410227825Stheraven 411227825Stheraven#endif 412227825Stheraven 413227825Stheraven// is_same 414227825Stheraven 415261283Sdimtemplate <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS_ONLY is_same : public false_type {}; 416261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> : public true_type {}; 417227825Stheraven 418227825Stheraven// is_function 419227825Stheraven 420227825Stheravennamespace __is_function_imp 421227825Stheraven{ 422227825Stheraventemplate <class _Tp> char __test(_Tp*); 423227825Stheraventemplate <class _Tp> __two __test(...); 424227825Stheraventemplate <class _Tp> _Tp& __source(); 425227825Stheraven} 426227825Stheraven 427227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value || 428227825Stheraven is_union<_Tp>::value || 429227825Stheraven is_void<_Tp>::value || 430227825Stheraven is_reference<_Tp>::value || 431261283Sdim __is_nullptr_t<_Tp>::value > 432260015Sdimstruct __libcpp_is_function 433227825Stheraven : public integral_constant<bool, sizeof(__is_function_imp::__test<_Tp>(__is_function_imp::__source<_Tp>())) == 1> 434227825Stheraven {}; 435260015Sdimtemplate <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type {}; 436227825Stheraven 437261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function 438260015Sdim : public __libcpp_is_function<_Tp> {}; 439227825Stheraven 440227825Stheraven// is_member_function_pointer 441227825Stheraven 442275366Sdim// template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {}; 443275366Sdim// template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {}; 444275366Sdim// 445227825Stheraven 446275366Sdimtemplate <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr> 447275366Sdimstruct __member_pointer_traits_imp 448275366Sdim{ // forward declaration; specializations later 449275366Sdim}; 450275366Sdim 451275366Sdim 452275366Sdimnamespace __libcpp_is_member_function_pointer_imp { 453275366Sdim template <typename _Tp> 454275366Sdim char __test(typename std::__member_pointer_traits_imp<_Tp, true, false>::_FnType *); 455275366Sdim 456275366Sdim template <typename> 457275366Sdim std::__two __test(...); 458275366Sdim}; 459275366Sdim 460275366Sdimtemplate <class _Tp> struct __libcpp_is_member_function_pointer 461275366Sdim : public integral_constant<bool, sizeof(__libcpp_is_member_function_pointer_imp::__test<_Tp>(nullptr)) == 1> {}; 462275366Sdim 463261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer 464260015Sdim : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type> {}; 465227825Stheraven 466227825Stheraven// is_member_pointer 467227825Stheraven 468260015Sdimtemplate <class _Tp> struct __libcpp_is_member_pointer : public false_type {}; 469260015Sdimtemplate <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> : public true_type {}; 470227825Stheraven 471261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer 472260015Sdim : public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {}; 473227825Stheraven 474227825Stheraven// is_member_object_pointer 475227825Stheraven 476261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer 477227825Stheraven : public integral_constant<bool, is_member_pointer<_Tp>::value && 478227825Stheraven !is_member_function_pointer<_Tp>::value> {}; 479227825Stheraven 480227825Stheraven// is_enum 481227825Stheraven 482227825Stheraven#if __has_feature(is_enum) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 483227825Stheraven 484261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum 485227825Stheraven : public integral_constant<bool, __is_enum(_Tp)> {}; 486227825Stheraven 487227825Stheraven#else 488227825Stheraven 489261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum 490227825Stheraven : public integral_constant<bool, !is_void<_Tp>::value && 491227825Stheraven !is_integral<_Tp>::value && 492227825Stheraven !is_floating_point<_Tp>::value && 493227825Stheraven !is_array<_Tp>::value && 494227825Stheraven !is_pointer<_Tp>::value && 495227825Stheraven !is_reference<_Tp>::value && 496227825Stheraven !is_member_pointer<_Tp>::value && 497227825Stheraven !is_union<_Tp>::value && 498227825Stheraven !is_class<_Tp>::value && 499227825Stheraven !is_function<_Tp>::value > {}; 500227825Stheraven 501227825Stheraven#endif 502227825Stheraven 503227825Stheraven// is_arithmetic 504227825Stheraven 505261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_arithmetic 506227825Stheraven : public integral_constant<bool, is_integral<_Tp>::value || 507227825Stheraven is_floating_point<_Tp>::value> {}; 508227825Stheraven 509227825Stheraven// is_fundamental 510227825Stheraven 511261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental 512227825Stheraven : public integral_constant<bool, is_void<_Tp>::value || 513227825Stheraven __is_nullptr_t<_Tp>::value || 514227825Stheraven is_arithmetic<_Tp>::value> {}; 515227825Stheraven 516227825Stheraven// is_scalar 517227825Stheraven 518261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar 519227825Stheraven : public integral_constant<bool, is_arithmetic<_Tp>::value || 520227825Stheraven is_member_pointer<_Tp>::value || 521227825Stheraven is_pointer<_Tp>::value || 522227825Stheraven __is_nullptr_t<_Tp>::value || 523227825Stheraven is_enum<_Tp>::value > {}; 524227825Stheraven 525261283Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar<nullptr_t> : public true_type {}; 526227825Stheraven 527227825Stheraven// is_object 528227825Stheraven 529261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object 530227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 531227825Stheraven is_array<_Tp>::value || 532227825Stheraven is_union<_Tp>::value || 533227825Stheraven is_class<_Tp>::value > {}; 534227825Stheraven 535227825Stheraven// is_compound 536227825Stheraven 537261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_compound 538227825Stheraven : public integral_constant<bool, !is_fundamental<_Tp>::value> {}; 539227825Stheraven 540227825Stheraven// add_const 541227825Stheraven 542227825Stheraventemplate <class _Tp, bool = is_reference<_Tp>::value || 543227825Stheraven is_function<_Tp>::value || 544227825Stheraven is_const<_Tp>::value > 545227825Stheravenstruct __add_const {typedef _Tp type;}; 546227825Stheraven 547227825Stheraventemplate <class _Tp> 548227825Stheravenstruct __add_const<_Tp, false> {typedef const _Tp type;}; 549227825Stheraven 550261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_const 551227825Stheraven {typedef typename __add_const<_Tp>::type type;}; 552227825Stheraven 553253159Stheraven#if _LIBCPP_STD_VER > 11 554253159Stheraventemplate <class _Tp> using add_const_t = typename add_const<_Tp>::type; 555253159Stheraven#endif 556253159Stheraven 557227825Stheraven// add_volatile 558227825Stheraven 559227825Stheraventemplate <class _Tp, bool = is_reference<_Tp>::value || 560227825Stheraven is_function<_Tp>::value || 561227825Stheraven is_volatile<_Tp>::value > 562227825Stheravenstruct __add_volatile {typedef _Tp type;}; 563227825Stheraven 564227825Stheraventemplate <class _Tp> 565227825Stheravenstruct __add_volatile<_Tp, false> {typedef volatile _Tp type;}; 566227825Stheraven 567261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_volatile 568227825Stheraven {typedef typename __add_volatile<_Tp>::type type;}; 569227825Stheraven 570253159Stheraven#if _LIBCPP_STD_VER > 11 571253159Stheraventemplate <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type; 572253159Stheraven#endif 573253159Stheraven 574227825Stheraven// add_cv 575227825Stheraven 576261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_cv 577227825Stheraven {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;}; 578227825Stheraven 579253159Stheraven#if _LIBCPP_STD_VER > 11 580253159Stheraventemplate <class _Tp> using add_cv_t = typename add_cv<_Tp>::type; 581253159Stheraven#endif 582253159Stheraven 583227825Stheraven// remove_reference 584227825Stheraven 585261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference {typedef _Tp type;}; 586261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&> {typedef _Tp type;}; 587227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 588261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&&> {typedef _Tp type;}; 589227825Stheraven#endif 590227825Stheraven 591253159Stheraven#if _LIBCPP_STD_VER > 11 592253159Stheraventemplate <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type; 593253159Stheraven#endif 594253159Stheraven 595227825Stheraven// add_lvalue_reference 596227825Stheraven 597261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference {typedef _Tp& type;}; 598261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<_Tp&> {typedef _Tp& type;}; // for older compiler 599261283Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<void> {typedef void type;}; 600261283Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const void> {typedef const void type;}; 601261283Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<volatile void> {typedef volatile void type;}; 602261283Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const volatile void> {typedef const volatile void type;}; 603227825Stheraven 604253159Stheraven#if _LIBCPP_STD_VER > 11 605253159Stheraventemplate <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; 606253159Stheraven#endif 607253159Stheraven 608227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 609227825Stheraven 610261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference {typedef _Tp&& type;}; 611261283Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<void> {typedef void type;}; 612261283Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const void> {typedef const void type;}; 613261283Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<volatile void> {typedef volatile void type;}; 614261283Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const volatile void> {typedef const volatile void type;}; 615227825Stheraven 616253159Stheraven#if _LIBCPP_STD_VER > 11 617253159Stheraventemplate <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; 618253159Stheraven#endif 619253159Stheraven 620227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 621227825Stheraven 622227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 623227825Stheraven 624227825Stheraventemplate <class _Tp> 625227825Stheraventypename add_rvalue_reference<_Tp>::type 626227825Stheravendeclval() _NOEXCEPT; 627227825Stheraven 628227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 629227825Stheraven 630227825Stheraventemplate <class _Tp> 631227825Stheraventypename add_lvalue_reference<_Tp>::type 632227825Stheravendeclval(); 633227825Stheraven 634227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 635227825Stheraven 636227825Stheravenstruct __any 637227825Stheraven{ 638227825Stheraven __any(...); 639227825Stheraven}; 640227825Stheraven 641227825Stheraven// remove_pointer 642227825Stheraven 643261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer {typedef _Tp type;}; 644261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp*> {typedef _Tp type;}; 645261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const> {typedef _Tp type;}; 646261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* volatile> {typedef _Tp type;}; 647261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const volatile> {typedef _Tp type;}; 648227825Stheraven 649253159Stheraven#if _LIBCPP_STD_VER > 11 650253159Stheraventemplate <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type; 651253159Stheraven#endif 652253159Stheraven 653227825Stheraven// add_pointer 654227825Stheraven 655261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_pointer 656227825Stheraven {typedef typename remove_reference<_Tp>::type* type;}; 657227825Stheraven 658253159Stheraven#if _LIBCPP_STD_VER > 11 659253159Stheraventemplate <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; 660253159Stheraven#endif 661253159Stheraven 662227825Stheraven// is_signed 663227825Stheraven 664227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value> 665227825Stheravenstruct ___is_signed : public integral_constant<bool, _Tp(-1) < _Tp(0)> {}; 666227825Stheraven 667227825Stheraventemplate <class _Tp> 668227825Stheravenstruct ___is_signed<_Tp, false> : public true_type {}; // floating point 669227825Stheraven 670227825Stheraventemplate <class _Tp, bool = is_arithmetic<_Tp>::value> 671260015Sdimstruct __libcpp_is_signed : public ___is_signed<_Tp> {}; 672227825Stheraven 673260015Sdimtemplate <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {}; 674227825Stheraven 675261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {}; 676227825Stheraven 677227825Stheraven// is_unsigned 678227825Stheraven 679227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value> 680227825Stheravenstruct ___is_unsigned : public integral_constant<bool, _Tp(0) < _Tp(-1)> {}; 681227825Stheraven 682227825Stheraventemplate <class _Tp> 683227825Stheravenstruct ___is_unsigned<_Tp, false> : public false_type {}; // floating point 684227825Stheraven 685227825Stheraventemplate <class _Tp, bool = is_arithmetic<_Tp>::value> 686260015Sdimstruct __libcpp_is_unsigned : public ___is_unsigned<_Tp> {}; 687227825Stheraven 688260015Sdimtemplate <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {}; 689227825Stheraven 690261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {}; 691227825Stheraven 692227825Stheraven// rank 693227825Stheraven 694261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank 695227825Stheraven : public integral_constant<size_t, 0> {}; 696261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[]> 697227825Stheraven : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 698261283Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[_Np]> 699227825Stheraven : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 700227825Stheraven 701227825Stheraven// extent 702227825Stheraven 703261283Sdimtemplate <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TYPE_VIS_ONLY extent 704227825Stheraven : public integral_constant<size_t, 0> {}; 705261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], 0> 706227825Stheraven : public integral_constant<size_t, 0> {}; 707261283Sdimtemplate <class _Tp, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], _Ip> 708227825Stheraven : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 709261283Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], 0> 710227825Stheraven : public integral_constant<size_t, _Np> {}; 711261283Sdimtemplate <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], _Ip> 712227825Stheraven : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 713227825Stheraven 714227825Stheraven// remove_extent 715227825Stheraven 716261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent 717227825Stheraven {typedef _Tp type;}; 718261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[]> 719227825Stheraven {typedef _Tp type;}; 720261283Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[_Np]> 721227825Stheraven {typedef _Tp type;}; 722227825Stheraven 723253159Stheraven#if _LIBCPP_STD_VER > 11 724253159Stheraventemplate <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type; 725253159Stheraven#endif 726253159Stheraven 727227825Stheraven// remove_all_extents 728227825Stheraven 729261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents 730227825Stheraven {typedef _Tp type;}; 731261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[]> 732227825Stheraven {typedef typename remove_all_extents<_Tp>::type type;}; 733261283Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[_Np]> 734227825Stheraven {typedef typename remove_all_extents<_Tp>::type type;}; 735227825Stheraven 736253159Stheraven#if _LIBCPP_STD_VER > 11 737253159Stheraventemplate <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type; 738253159Stheraven#endif 739253159Stheraven 740261283Sdim// decay 741261283Sdim 742261283Sdimtemplate <class _Tp> 743261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY decay 744261283Sdim{ 745261283Sdimprivate: 746261283Sdim typedef typename remove_reference<_Tp>::type _Up; 747261283Sdimpublic: 748261283Sdim typedef typename conditional 749261283Sdim < 750261283Sdim is_array<_Up>::value, 751261283Sdim typename remove_extent<_Up>::type*, 752261283Sdim typename conditional 753261283Sdim < 754261283Sdim is_function<_Up>::value, 755261283Sdim typename add_pointer<_Up>::type, 756261283Sdim typename remove_cv<_Up>::type 757261283Sdim >::type 758261283Sdim >::type type; 759261283Sdim}; 760261283Sdim 761261283Sdim#if _LIBCPP_STD_VER > 11 762261283Sdimtemplate <class _Tp> using decay_t = typename decay<_Tp>::type; 763261283Sdim#endif 764261283Sdim 765227825Stheraven// is_abstract 766227825Stheraven 767227825Stheravennamespace __is_abstract_imp 768227825Stheraven{ 769227825Stheraventemplate <class _Tp> char __test(_Tp (*)[1]); 770227825Stheraventemplate <class _Tp> __two __test(...); 771227825Stheraven} 772227825Stheraven 773227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value> 774227825Stheravenstruct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {}; 775227825Stheraven 776227825Stheraventemplate <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {}; 777227825Stheraven 778261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {}; 779227825Stheraven 780241903Sdim// is_base_of 781241903Sdim 782261283Sdim#ifdef _LIBCPP_HAS_IS_BASE_OF 783241903Sdim 784241903Sdimtemplate <class _Bp, class _Dp> 785261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_base_of 786241903Sdim : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; 787241903Sdim 788241903Sdim#else // __has_feature(is_base_of) 789241903Sdim 790246487Stheravennamespace __is_base_of_imp 791246487Stheraven{ 792246487Stheraventemplate <class _Tp> 793246487Stheravenstruct _Dst 794246487Stheraven{ 795246487Stheraven _Dst(const volatile _Tp &); 796246487Stheraven}; 797246487Stheraventemplate <class _Tp> 798246487Stheravenstruct _Src 799246487Stheraven{ 800246487Stheraven operator const volatile _Tp &(); 801246487Stheraven template <class _Up> operator const _Dst<_Up> &(); 802246487Stheraven}; 803246487Stheraventemplate <size_t> struct __one { typedef char type; }; 804246487Stheraventemplate <class _Bp, class _Dp> typename __one<sizeof(_Dst<_Bp>(declval<_Src<_Dp> >()))>::type __test(int); 805246487Stheraventemplate <class _Bp, class _Dp> __two __test(...); 806246487Stheraven} 807241903Sdim 808246487Stheraventemplate <class _Bp, class _Dp> 809261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_base_of 810246487Stheraven : public integral_constant<bool, is_class<_Bp>::value && 811246487Stheraven sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {}; 812246487Stheraven 813241903Sdim#endif // __has_feature(is_base_of) 814241903Sdim 815227825Stheraven// is_convertible 816227825Stheraven 817227825Stheraven#if __has_feature(is_convertible_to) 818227825Stheraven 819261283Sdimtemplate <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible 820241903Sdim : public integral_constant<bool, __is_convertible_to(_T1, _T2) && 821241903Sdim !is_abstract<_T2>::value> {}; 822227825Stheraven 823227825Stheraven#else // __has_feature(is_convertible_to) 824227825Stheraven 825227825Stheravennamespace __is_convertible_imp 826227825Stheraven{ 827227825Stheraventemplate <class _Tp> char __test(_Tp); 828227825Stheraventemplate <class _Tp> __two __test(...); 829227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 830227825Stheraventemplate <class _Tp> _Tp&& __source(); 831227825Stheraven#else 832227825Stheraventemplate <class _Tp> typename remove_reference<_Tp>::type& __source(); 833227825Stheraven#endif 834227825Stheraven 835227825Stheraventemplate <class _Tp, bool _IsArray = is_array<_Tp>::value, 836227825Stheraven bool _IsFunction = is_function<_Tp>::value, 837227825Stheraven bool _IsVoid = is_void<_Tp>::value> 838227825Stheraven struct __is_array_function_or_void {enum {value = 0};}; 839227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};}; 840227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};}; 841227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};}; 842227825Stheraven} 843227825Stheraven 844227825Stheraventemplate <class _Tp, 845227825Stheraven unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value> 846227825Stheravenstruct __is_convertible_check 847227825Stheraven{ 848227825Stheraven static const size_t __v = 0; 849227825Stheraven}; 850227825Stheraven 851227825Stheraventemplate <class _Tp> 852227825Stheravenstruct __is_convertible_check<_Tp, 0> 853227825Stheraven{ 854227825Stheraven static const size_t __v = sizeof(_Tp); 855227825Stheraven}; 856227825Stheraven 857227825Stheraventemplate <class _T1, class _T2, 858227825Stheraven unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value, 859227825Stheraven unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value> 860227825Stheravenstruct __is_convertible 861227825Stheraven : public integral_constant<bool, 862241903Sdim#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 863227825Stheraven sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 864241903Sdim#else 865241903Sdim sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 866241903Sdim && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value 867241903Sdim && (!is_const<typename remove_reference<_T2>::type>::value 868241903Sdim || is_volatile<typename remove_reference<_T2>::type>::value) 869241903Sdim && (is_same<typename remove_cv<_T1>::type, 870241903Sdim typename remove_cv<typename remove_reference<_T2>::type>::type>::value 871241903Sdim || is_base_of<typename remove_reference<_T2>::type, _T1>::value)) 872241903Sdim#endif 873227825Stheraven > 874227825Stheraven{}; 875227825Stheraven 876227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {}; 877227825Stheraven 878227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {}; 879227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 880227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {}; 881227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {}; 882227825Stheraventemplate <class _T1> struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {}; 883227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {}; 884227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 885227825Stheraven 886227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2*, 1, 0> 887227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*>::value> {}; 888227825Stheraven 889227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* const, 1, 0> 890227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const>::value> {}; 891227825Stheraven 892227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* volatile, 1, 0> 893227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*volatile>::value> {}; 894227825Stheraven 895227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* const volatile, 1, 0> 896227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const volatile>::value> {}; 897227825Stheraven 898227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0> : public false_type {}; 899227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 900227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1&&, 2, 0> : public true_type {}; 901227825Stheraven#endif 902241903Sdimtemplate <class _T1> struct __is_convertible<_T1, _T1&, 2, 0> : public true_type {}; 903227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*, 2, 0> : public true_type {}; 904227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*const, 2, 0> : public true_type {}; 905227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {}; 906227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {}; 907227825Stheraven 908227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 0> : public false_type {}; 909227825Stheraven 910227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {}; 911227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {}; 912227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {}; 913227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {}; 914227825Stheraven 915227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {}; 916227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {}; 917227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {}; 918227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {}; 919227825Stheraven 920227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {}; 921227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {}; 922227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {}; 923227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {}; 924227825Stheraven 925261283Sdimtemplate <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible 926227825Stheraven : public __is_convertible<_T1, _T2> 927227825Stheraven{ 928227825Stheraven static const size_t __complete_check1 = __is_convertible_check<_T1>::__v; 929227825Stheraven static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; 930227825Stheraven}; 931227825Stheraven 932227825Stheraven#endif // __has_feature(is_convertible_to) 933227825Stheraven 934227825Stheraven// is_empty 935227825Stheraven 936232950Stheraven#if __has_feature(is_empty) 937232950Stheraven 938227825Stheraventemplate <class _Tp> 939261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_empty 940232950Stheraven : public integral_constant<bool, __is_empty(_Tp)> {}; 941232950Stheraven 942232950Stheraven#else // __has_feature(is_empty) 943232950Stheraven 944232950Stheraventemplate <class _Tp> 945227825Stheravenstruct __is_empty1 946227825Stheraven : public _Tp 947227825Stheraven{ 948242945Stheraven double __lx; 949227825Stheraven}; 950227825Stheraven 951227825Stheravenstruct __is_empty2 952227825Stheraven{ 953242945Stheraven double __lx; 954227825Stheraven}; 955227825Stheraven 956227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value> 957227825Stheravenstruct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {}; 958227825Stheraven 959227825Stheraventemplate <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {}; 960227825Stheraven 961261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_empty : public __libcpp_empty<_Tp> {}; 962227825Stheraven 963232950Stheraven#endif // __has_feature(is_empty) 964232950Stheraven 965227825Stheraven// is_polymorphic 966227825Stheraven 967232950Stheraven#if __has_feature(is_polymorphic) 968232950Stheraven 969232950Stheraventemplate <class _Tp> 970261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_polymorphic 971232950Stheraven : public integral_constant<bool, __is_polymorphic(_Tp)> {}; 972232950Stheraven 973232950Stheraven#else 974232950Stheraven 975249998Sdimtemplate<typename _Tp> char &__is_polymorphic_impl( 976249998Sdim typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0, 977249998Sdim int>::type); 978249998Sdimtemplate<typename _Tp> __two &__is_polymorphic_impl(...); 979227825Stheraven 980261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic 981249998Sdim : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {}; 982227825Stheraven 983232950Stheraven#endif // __has_feature(is_polymorphic) 984232950Stheraven 985227825Stheraven// has_virtual_destructor 986227825Stheraven 987227825Stheraven#if __has_feature(has_virtual_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 988227825Stheraven 989261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor 990227825Stheraven : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; 991227825Stheraven 992227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 993227825Stheraven 994261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor 995227825Stheraven : public false_type {}; 996227825Stheraven 997227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 998227825Stheraven 999227825Stheraven// alignment_of 1000227825Stheraven 1001261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY alignment_of 1002249998Sdim : public integral_constant<size_t, __alignof__(_Tp)> {}; 1003227825Stheraven 1004227825Stheraven// aligned_storage 1005227825Stheraven 1006227825Stheraventemplate <class _Hp, class _Tp> 1007227825Stheravenstruct __type_list 1008227825Stheraven{ 1009227825Stheraven typedef _Hp _Head; 1010227825Stheraven typedef _Tp _Tail; 1011227825Stheraven}; 1012227825Stheraven 1013227825Stheravenstruct __nat 1014227825Stheraven{ 1015227825Stheraven#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS 1016227825Stheraven __nat() = delete; 1017227825Stheraven __nat(const __nat&) = delete; 1018227825Stheraven __nat& operator=(const __nat&) = delete; 1019227825Stheraven ~__nat() = delete; 1020227825Stheraven#endif 1021227825Stheraven}; 1022227825Stheraven 1023227825Stheraventemplate <class _Tp> 1024227825Stheravenstruct __align_type 1025227825Stheraven{ 1026227825Stheraven static const size_t value = alignment_of<_Tp>::value; 1027227825Stheraven typedef _Tp type; 1028227825Stheraven}; 1029227825Stheraven 1030242945Stheravenstruct __struct_double {long double __lx;}; 1031242945Stheravenstruct __struct_double4 {double __lx[4];}; 1032227825Stheraven 1033227825Stheraventypedef 1034227825Stheraven __type_list<__align_type<unsigned char>, 1035227825Stheraven __type_list<__align_type<unsigned short>, 1036227825Stheraven __type_list<__align_type<unsigned int>, 1037227825Stheraven __type_list<__align_type<unsigned long>, 1038227825Stheraven __type_list<__align_type<unsigned long long>, 1039227825Stheraven __type_list<__align_type<double>, 1040227825Stheraven __type_list<__align_type<long double>, 1041227825Stheraven __type_list<__align_type<__struct_double>, 1042227825Stheraven __type_list<__align_type<__struct_double4>, 1043227825Stheraven __type_list<__align_type<int*>, 1044227825Stheraven __nat 1045227825Stheraven > > > > > > > > > > __all_types; 1046227825Stheraven 1047227825Stheraventemplate <class _TL, size_t _Align> struct __find_pod; 1048227825Stheraven 1049227825Stheraventemplate <class _Hp, size_t _Align> 1050227825Stheravenstruct __find_pod<__type_list<_Hp, __nat>, _Align> 1051227825Stheraven{ 1052227825Stheraven typedef typename conditional< 1053227825Stheraven _Align == _Hp::value, 1054227825Stheraven typename _Hp::type, 1055227825Stheraven void 1056227825Stheraven >::type type; 1057227825Stheraven}; 1058227825Stheraven 1059227825Stheraventemplate <class _Hp, class _Tp, size_t _Align> 1060227825Stheravenstruct __find_pod<__type_list<_Hp, _Tp>, _Align> 1061227825Stheraven{ 1062227825Stheraven typedef typename conditional< 1063227825Stheraven _Align == _Hp::value, 1064227825Stheraven typename _Hp::type, 1065227825Stheraven typename __find_pod<_Tp, _Align>::type 1066227825Stheraven >::type type; 1067227825Stheraven}; 1068227825Stheraven 1069227825Stheraventemplate <class _TL, size_t _Len> struct __find_max_align; 1070227825Stheraven 1071227825Stheraventemplate <class _Hp, size_t _Len> 1072227825Stheravenstruct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {}; 1073227825Stheraven 1074227825Stheraventemplate <size_t _Len, size_t _A1, size_t _A2> 1075227825Stheravenstruct __select_align 1076227825Stheraven{ 1077227825Stheravenprivate: 1078227825Stheraven static const size_t __min = _A2 < _A1 ? _A2 : _A1; 1079227825Stheraven static const size_t __max = _A1 < _A2 ? _A2 : _A1; 1080227825Stheravenpublic: 1081227825Stheraven static const size_t value = _Len < __max ? __min : __max; 1082227825Stheraven}; 1083227825Stheraven 1084227825Stheraventemplate <class _Hp, class _Tp, size_t _Len> 1085227825Stheravenstruct __find_max_align<__type_list<_Hp, _Tp>, _Len> 1086227825Stheraven : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {}; 1087227825Stheraven 1088253159Stheraventemplate <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> 1089261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY aligned_storage 1090227825Stheraven{ 1091227825Stheraven typedef typename __find_pod<__all_types, _Align>::type _Aligner; 1092227825Stheraven static_assert(!is_void<_Aligner>::value, ""); 1093227825Stheraven union type 1094227825Stheraven { 1095227825Stheraven _Aligner __align; 1096227825Stheraven unsigned char __data[_Len]; 1097227825Stheraven }; 1098227825Stheraven}; 1099227825Stheraven 1100253159Stheraven#if _LIBCPP_STD_VER > 11 1101253159Stheraventemplate <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> 1102253159Stheraven using aligned_storage_t = typename aligned_storage<_Len, _Align>::type; 1103253159Stheraven#endif 1104253159Stheraven 1105227825Stheraven#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ 1106227825Stheraventemplate <size_t _Len>\ 1107261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY aligned_storage<_Len, n>\ 1108227825Stheraven{\ 1109227825Stheraven struct _ALIGNAS(n) type\ 1110227825Stheraven {\ 1111242945Stheraven unsigned char __lx[_Len];\ 1112227825Stheraven };\ 1113227825Stheraven} 1114227825Stheraven 1115227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1); 1116227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2); 1117227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4); 1118227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8); 1119227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10); 1120227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20); 1121227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40); 1122227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80); 1123227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100); 1124227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200); 1125227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400); 1126227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800); 1127227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000); 1128227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000); 1129227825Stheraven// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000) 1130261283Sdim#if !defined(_LIBCPP_MSVC) 1131227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); 1132261283Sdim#endif // !_LIBCPP_MSVC 1133227825Stheraven 1134227825Stheraven#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION 1135227825Stheraven 1136249998Sdim#ifndef _LIBCPP_HAS_NO_VARIADICS 1137249998Sdim 1138249998Sdim// aligned_union 1139249998Sdim 1140249998Sdimtemplate <size_t _I0, size_t ..._In> 1141249998Sdimstruct __static_max; 1142249998Sdim 1143249998Sdimtemplate <size_t _I0> 1144249998Sdimstruct __static_max<_I0> 1145249998Sdim{ 1146249998Sdim static const size_t value = _I0; 1147249998Sdim}; 1148249998Sdim 1149249998Sdimtemplate <size_t _I0, size_t _I1, size_t ..._In> 1150249998Sdimstruct __static_max<_I0, _I1, _In...> 1151249998Sdim{ 1152249998Sdim static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value : 1153249998Sdim __static_max<_I1, _In...>::value; 1154249998Sdim}; 1155249998Sdim 1156249998Sdimtemplate <size_t _Len, class _Type0, class ..._Types> 1157249998Sdimstruct aligned_union 1158249998Sdim{ 1159249998Sdim static const size_t alignment_value = __static_max<__alignof__(_Type0), 1160249998Sdim __alignof__(_Types)...>::value; 1161249998Sdim static const size_t __len = __static_max<_Len, sizeof(_Type0), 1162249998Sdim sizeof(_Types)...>::value; 1163249998Sdim typedef typename aligned_storage<__len, alignment_value>::type type; 1164249998Sdim}; 1165249998Sdim 1166253159Stheraven#if _LIBCPP_STD_VER > 11 1167253159Stheraventemplate <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type; 1168253159Stheraven#endif 1169253159Stheraven 1170249998Sdim#endif // _LIBCPP_HAS_NO_VARIADICS 1171249998Sdim 1172227825Stheraven// __promote 1173227825Stheraven 1174227825Stheraventemplate <class _A1, class _A2 = void, class _A3 = void, 1175227825Stheraven bool = (is_arithmetic<_A1>::value || is_void<_A1>::value) && 1176227825Stheraven (is_arithmetic<_A2>::value || is_void<_A2>::value) && 1177227825Stheraven (is_arithmetic<_A3>::value || is_void<_A3>::value)> 1178227825Stheravenclass __promote {}; 1179227825Stheraven 1180227825Stheraventemplate <class _A1, class _A2, class _A3> 1181227825Stheravenclass __promote<_A1, _A2, _A3, true> 1182227825Stheraven{ 1183227825Stheravenprivate: 1184227825Stheraven typedef typename __promote<_A1>::type __type1; 1185227825Stheraven typedef typename __promote<_A2>::type __type2; 1186227825Stheraven typedef typename __promote<_A3>::type __type3; 1187227825Stheravenpublic: 1188227825Stheraven typedef decltype(__type1() + __type2() + __type3()) type; 1189227825Stheraven}; 1190227825Stheraven 1191227825Stheraventemplate <class _A1, class _A2> 1192227825Stheravenclass __promote<_A1, _A2, void, true> 1193227825Stheraven{ 1194227825Stheravenprivate: 1195227825Stheraven typedef typename __promote<_A1>::type __type1; 1196227825Stheraven typedef typename __promote<_A2>::type __type2; 1197227825Stheravenpublic: 1198227825Stheraven typedef decltype(__type1() + __type2()) type; 1199227825Stheraven}; 1200227825Stheraven 1201227825Stheraventemplate <class _A1> 1202227825Stheravenclass __promote<_A1, void, void, true> 1203227825Stheraven{ 1204227825Stheravenpublic: 1205227825Stheraven typedef typename conditional<is_arithmetic<_A1>::value, 1206227825Stheraven typename conditional<is_integral<_A1>::value, double, _A1>::type, 1207227825Stheraven void 1208227825Stheraven >::type type; 1209227825Stheraven}; 1210227825Stheraven 1211227825Stheraven#ifdef _LIBCPP_STORE_AS_OPTIMIZATION 1212227825Stheraven 1213227825Stheraven// __transform 1214227825Stheraven 1215227825Stheraventemplate <class _Tp, size_t = sizeof(_Tp), bool = is_scalar<_Tp>::value> struct __transform {typedef _Tp type;}; 1216227825Stheraventemplate <class _Tp> struct __transform<_Tp, 1, true> {typedef unsigned char type;}; 1217227825Stheraventemplate <class _Tp> struct __transform<_Tp, 2, true> {typedef unsigned short type;}; 1218227825Stheraventemplate <class _Tp> struct __transform<_Tp, 4, true> {typedef unsigned int type;}; 1219227825Stheraventemplate <class _Tp> struct __transform<_Tp, 8, true> {typedef unsigned long long type;}; 1220227825Stheraven 1221227825Stheraven#endif // _LIBCPP_STORE_AS_OPTIMIZATION 1222227825Stheraven 1223227825Stheraven// make_signed / make_unsigned 1224227825Stheraven 1225227825Stheraventypedef 1226227825Stheraven __type_list<signed char, 1227227825Stheraven __type_list<signed short, 1228227825Stheraven __type_list<signed int, 1229227825Stheraven __type_list<signed long, 1230227825Stheraven __type_list<signed long long, 1231227825Stheraven __nat 1232227825Stheraven > > > > > __signed_types; 1233227825Stheraven 1234227825Stheraventypedef 1235227825Stheraven __type_list<unsigned char, 1236227825Stheraven __type_list<unsigned short, 1237227825Stheraven __type_list<unsigned int, 1238227825Stheraven __type_list<unsigned long, 1239227825Stheraven __type_list<unsigned long long, 1240227825Stheraven __nat 1241227825Stheraven > > > > > __unsigned_types; 1242227825Stheraven 1243227825Stheraventemplate <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first; 1244227825Stheraven 1245227825Stheraventemplate <class _Hp, class _Tp, size_t _Size> 1246227825Stheravenstruct __find_first<__type_list<_Hp, _Tp>, _Size, true> 1247227825Stheraven{ 1248227825Stheraven typedef _Hp type; 1249227825Stheraven}; 1250227825Stheraven 1251227825Stheraventemplate <class _Hp, class _Tp, size_t _Size> 1252227825Stheravenstruct __find_first<__type_list<_Hp, _Tp>, _Size, false> 1253227825Stheraven{ 1254227825Stheraven typedef typename __find_first<_Tp, _Size>::type type; 1255227825Stheraven}; 1256227825Stheraven 1257227825Stheraventemplate <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, 1258227825Stheraven bool = is_volatile<typename remove_reference<_Tp>::type>::value> 1259227825Stheravenstruct __apply_cv 1260227825Stheraven{ 1261227825Stheraven typedef _Up type; 1262227825Stheraven}; 1263227825Stheraven 1264227825Stheraventemplate <class _Tp, class _Up> 1265227825Stheravenstruct __apply_cv<_Tp, _Up, true, false> 1266227825Stheraven{ 1267227825Stheraven typedef const _Up type; 1268227825Stheraven}; 1269227825Stheraven 1270227825Stheraventemplate <class _Tp, class _Up> 1271227825Stheravenstruct __apply_cv<_Tp, _Up, false, true> 1272227825Stheraven{ 1273227825Stheraven typedef volatile _Up type; 1274227825Stheraven}; 1275227825Stheraven 1276227825Stheraventemplate <class _Tp, class _Up> 1277227825Stheravenstruct __apply_cv<_Tp, _Up, true, true> 1278227825Stheraven{ 1279227825Stheraven typedef const volatile _Up type; 1280227825Stheraven}; 1281227825Stheraven 1282227825Stheraventemplate <class _Tp, class _Up> 1283227825Stheravenstruct __apply_cv<_Tp&, _Up, false, false> 1284227825Stheraven{ 1285227825Stheraven typedef _Up& type; 1286227825Stheraven}; 1287227825Stheraven 1288227825Stheraventemplate <class _Tp, class _Up> 1289227825Stheravenstruct __apply_cv<_Tp&, _Up, true, false> 1290227825Stheraven{ 1291227825Stheraven typedef const _Up& type; 1292227825Stheraven}; 1293227825Stheraven 1294227825Stheraventemplate <class _Tp, class _Up> 1295227825Stheravenstruct __apply_cv<_Tp&, _Up, false, true> 1296227825Stheraven{ 1297227825Stheraven typedef volatile _Up& type; 1298227825Stheraven}; 1299227825Stheraven 1300227825Stheraventemplate <class _Tp, class _Up> 1301227825Stheravenstruct __apply_cv<_Tp&, _Up, true, true> 1302227825Stheraven{ 1303227825Stheraven typedef const volatile _Up& type; 1304227825Stheraven}; 1305227825Stheraven 1306227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1307227825Stheravenstruct __make_signed {}; 1308227825Stheraven 1309227825Stheraventemplate <class _Tp> 1310227825Stheravenstruct __make_signed<_Tp, true> 1311227825Stheraven{ 1312227825Stheraven typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type; 1313227825Stheraven}; 1314227825Stheraven 1315227825Stheraventemplate <> struct __make_signed<bool, true> {}; 1316227825Stheraventemplate <> struct __make_signed< signed short, true> {typedef short type;}; 1317227825Stheraventemplate <> struct __make_signed<unsigned short, true> {typedef short type;}; 1318227825Stheraventemplate <> struct __make_signed< signed int, true> {typedef int type;}; 1319227825Stheraventemplate <> struct __make_signed<unsigned int, true> {typedef int type;}; 1320227825Stheraventemplate <> struct __make_signed< signed long, true> {typedef long type;}; 1321227825Stheraventemplate <> struct __make_signed<unsigned long, true> {typedef long type;}; 1322227825Stheraventemplate <> struct __make_signed< signed long long, true> {typedef long long type;}; 1323227825Stheraventemplate <> struct __make_signed<unsigned long long, true> {typedef long long type;}; 1324227825Stheraven 1325227825Stheraventemplate <class _Tp> 1326261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY make_signed 1327227825Stheraven{ 1328227825Stheraven typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type; 1329227825Stheraven}; 1330227825Stheraven 1331253159Stheraven#if _LIBCPP_STD_VER > 11 1332253159Stheraventemplate <class _Tp> using make_signed_t = typename make_signed<_Tp>::type; 1333253159Stheraven#endif 1334253159Stheraven 1335227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1336227825Stheravenstruct __make_unsigned {}; 1337227825Stheraven 1338227825Stheraventemplate <class _Tp> 1339227825Stheravenstruct __make_unsigned<_Tp, true> 1340227825Stheraven{ 1341227825Stheraven typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type; 1342227825Stheraven}; 1343227825Stheraven 1344227825Stheraventemplate <> struct __make_unsigned<bool, true> {}; 1345227825Stheraventemplate <> struct __make_unsigned< signed short, true> {typedef unsigned short type;}; 1346227825Stheraventemplate <> struct __make_unsigned<unsigned short, true> {typedef unsigned short type;}; 1347227825Stheraventemplate <> struct __make_unsigned< signed int, true> {typedef unsigned int type;}; 1348227825Stheraventemplate <> struct __make_unsigned<unsigned int, true> {typedef unsigned int type;}; 1349227825Stheraventemplate <> struct __make_unsigned< signed long, true> {typedef unsigned long type;}; 1350227825Stheraventemplate <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;}; 1351227825Stheraventemplate <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;}; 1352227825Stheraventemplate <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;}; 1353227825Stheraven 1354227825Stheraventemplate <class _Tp> 1355261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY make_unsigned 1356227825Stheraven{ 1357227825Stheraven typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type; 1358227825Stheraven}; 1359227825Stheraven 1360253159Stheraven#if _LIBCPP_STD_VER > 11 1361253159Stheraventemplate <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type; 1362253159Stheraven#endif 1363253159Stheraven 1364227825Stheraven#ifdef _LIBCPP_HAS_NO_VARIADICS 1365227825Stheraven 1366227825Stheraventemplate <class _Tp, class _Up = void, class V = void> 1367261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type 1368227825Stheraven{ 1369227825Stheravenpublic: 1370227825Stheraven typedef typename common_type<typename common_type<_Tp, _Up>::type, V>::type type; 1371227825Stheraven}; 1372227825Stheraven 1373227825Stheraventemplate <class _Tp> 1374261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, void, void> 1375227825Stheraven{ 1376227825Stheravenpublic: 1377227825Stheraven typedef _Tp type; 1378227825Stheraven}; 1379227825Stheraven 1380227825Stheraventemplate <class _Tp, class _Up> 1381261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, void> 1382227825Stheraven{ 1383227825Stheravenprivate: 1384227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1385227825Stheraven static _Tp&& __t(); 1386227825Stheraven static _Up&& __u(); 1387227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1388227825Stheraven static _Tp __t(); 1389227825Stheraven static _Up __u(); 1390227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1391227825Stheravenpublic: 1392232950Stheraven typedef typename remove_reference<decltype(true ? __t() : __u())>::type type; 1393227825Stheraven}; 1394227825Stheraven 1395227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1396227825Stheraven 1397227825Stheraventemplate <class ..._Tp> struct common_type; 1398227825Stheraven 1399227825Stheraventemplate <class _Tp> 1400261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp> 1401227825Stheraven{ 1402261283Sdim typedef typename decay<_Tp>::type type; 1403227825Stheraven}; 1404227825Stheraven 1405227825Stheraventemplate <class _Tp, class _Up> 1406261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up> 1407227825Stheraven{ 1408227825Stheravenprivate: 1409227825Stheraven static _Tp&& __t(); 1410227825Stheraven static _Up&& __u(); 1411227825Stheraven static bool __f(); 1412227825Stheravenpublic: 1413261283Sdim typedef typename decay<decltype(__f() ? __t() : __u())>::type type; 1414227825Stheraven}; 1415227825Stheraven 1416227825Stheraventemplate <class _Tp, class _Up, class ..._Vp> 1417261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, _Vp...> 1418227825Stheraven{ 1419227825Stheraven typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type; 1420227825Stheraven}; 1421227825Stheraven 1422253159Stheraven#if _LIBCPP_STD_VER > 11 1423253159Stheraventemplate <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type; 1424253159Stheraven#endif 1425253159Stheraven 1426227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 1427227825Stheraven 1428227825Stheraven// is_assignable 1429227825Stheraven 1430261283Sdimtemplate<typename, typename _Tp> struct __select_2nd { typedef _Tp type; }; 1431261283Sdim 1432227825Stheraventemplate <class _Tp, class _Arg> 1433261283Sdimtypename __select_2nd<decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>())), true_type>::type 1434227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1435227825Stheraven__is_assignable_test(_Tp&&, _Arg&&); 1436227825Stheraven#else 1437227825Stheraven__is_assignable_test(_Tp, _Arg&); 1438227825Stheraven#endif 1439227825Stheraven 1440227825Stheraventemplate <class _Arg> 1441227825Stheravenfalse_type 1442227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1443227825Stheraven__is_assignable_test(__any, _Arg&&); 1444227825Stheraven#else 1445227825Stheraven__is_assignable_test(__any, _Arg&); 1446227825Stheraven#endif 1447227825Stheraven 1448227825Stheraventemplate <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value> 1449227825Stheravenstruct __is_assignable_imp 1450227825Stheraven : public common_type 1451227825Stheraven < 1452227825Stheraven decltype(__is_assignable_test(declval<_Tp>(), declval<_Arg>())) 1453227825Stheraven >::type {}; 1454227825Stheraven 1455227825Stheraventemplate <class _Tp, class _Arg> 1456227825Stheravenstruct __is_assignable_imp<_Tp, _Arg, true> 1457227825Stheraven : public false_type 1458227825Stheraven{ 1459227825Stheraven}; 1460227825Stheraven 1461227825Stheraventemplate <class _Tp, class _Arg> 1462227825Stheravenstruct is_assignable 1463227825Stheraven : public __is_assignable_imp<_Tp, _Arg> {}; 1464227825Stheraven 1465227825Stheraven// is_copy_assignable 1466227825Stheraven 1467261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_copy_assignable 1468227825Stheraven : public is_assignable<typename add_lvalue_reference<_Tp>::type, 1469227825Stheraven const typename add_lvalue_reference<_Tp>::type> {}; 1470227825Stheraven 1471227825Stheraven// is_move_assignable 1472227825Stheraven 1473261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_move_assignable 1474227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1475227825Stheraven : public is_assignable<typename add_lvalue_reference<_Tp>::type, 1476227825Stheraven const typename add_rvalue_reference<_Tp>::type> {}; 1477227825Stheraven#else 1478227825Stheraven : public is_copy_assignable<_Tp> {}; 1479227825Stheraven#endif 1480227825Stheraven 1481227825Stheraven// is_destructible 1482227825Stheraven 1483227825Stheraventemplate <class _Tp> 1484227825Stheravenstruct __destructible_test 1485227825Stheraven{ 1486227825Stheraven _Tp __t; 1487227825Stheraven}; 1488227825Stheraven 1489227825Stheraventemplate <class _Tp> 1490227825Stheravendecltype((_VSTD::declval<__destructible_test<_Tp> >().~__destructible_test<_Tp>(), true_type())) 1491227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1492227825Stheraven__is_destructible_test(_Tp&&); 1493227825Stheraven#else 1494227825Stheraven__is_destructible_test(_Tp&); 1495227825Stheraven#endif 1496227825Stheraven 1497227825Stheravenfalse_type 1498227825Stheraven__is_destructible_test(__any); 1499227825Stheraven 1500261283Sdimtemplate <class _Tp, bool = is_void<_Tp>::value || is_abstract<_Tp>::value 1501261283Sdim || is_function<_Tp>::value> 1502227825Stheravenstruct __destructible_imp 1503227825Stheraven : public common_type 1504227825Stheraven < 1505227825Stheraven decltype(__is_destructible_test(declval<_Tp>())) 1506227825Stheraven >::type {}; 1507227825Stheraven 1508227825Stheraventemplate <class _Tp> 1509227825Stheravenstruct __destructible_imp<_Tp, true> 1510227825Stheraven : public false_type {}; 1511227825Stheraven 1512227825Stheraventemplate <class _Tp> 1513227825Stheravenstruct is_destructible 1514227825Stheraven : public __destructible_imp<_Tp> {}; 1515227825Stheraven 1516261283Sdimtemplate <class _Tp> 1517261283Sdimstruct is_destructible<_Tp[]> 1518261283Sdim : public false_type {}; 1519261283Sdim 1520227825Stheraven// move 1521227825Stheraven 1522227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1523227825Stheraven 1524227825Stheraventemplate <class _Tp> 1525261283Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1526227825Stheraventypename remove_reference<_Tp>::type&& 1527227825Stheravenmove(_Tp&& __t) _NOEXCEPT 1528227825Stheraven{ 1529227825Stheraven typedef typename remove_reference<_Tp>::type _Up; 1530227825Stheraven return static_cast<_Up&&>(__t); 1531227825Stheraven} 1532227825Stheraven 1533227825Stheraventemplate <class _Tp> 1534261283Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1535227825Stheraven_Tp&& 1536227825Stheravenforward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT 1537227825Stheraven{ 1538227825Stheraven return static_cast<_Tp&&>(__t); 1539227825Stheraven} 1540227825Stheraven 1541227825Stheraventemplate <class _Tp> 1542261283Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1543227825Stheraven_Tp&& 1544227825Stheravenforward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT 1545227825Stheraven{ 1546227825Stheraven static_assert(!std::is_lvalue_reference<_Tp>::value, 1547227825Stheraven "Can not forward an rvalue as an lvalue."); 1548227825Stheraven return static_cast<_Tp&&>(__t); 1549227825Stheraven} 1550227825Stheraven 1551227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1552227825Stheraven 1553227825Stheraventemplate <class _Tp> 1554227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1555234976Stheraven_Tp& 1556227825Stheravenmove(_Tp& __t) 1557227825Stheraven{ 1558227825Stheraven return __t; 1559227825Stheraven} 1560227825Stheraven 1561227825Stheraventemplate <class _Tp> 1562227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1563234976Stheravenconst _Tp& 1564232950Stheravenmove(const _Tp& __t) 1565232950Stheraven{ 1566232950Stheraven return __t; 1567232950Stheraven} 1568232950Stheraven 1569232950Stheraventemplate <class _Tp> 1570232950Stheraveninline _LIBCPP_INLINE_VISIBILITY 1571234976Stheraven_Tp& 1572234976Stheravenforward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT 1573227825Stheraven{ 1574227825Stheraven return __t; 1575227825Stheraven} 1576227825Stheraven 1577227825Stheraven 1578234976Stheraventemplate <class _Tp> 1579234976Stheravenclass __rv 1580227825Stheraven{ 1581234976Stheraven typedef typename remove_reference<_Tp>::type _Trr; 1582234976Stheraven _Trr& t_; 1583234976Stheravenpublic: 1584234976Stheraven _LIBCPP_INLINE_VISIBILITY 1585234976Stheraven _Trr* operator->() {return &t_;} 1586234976Stheraven _LIBCPP_INLINE_VISIBILITY 1587234976Stheraven explicit __rv(_Trr& __t) : t_(__t) {} 1588234976Stheraven}; 1589227825Stheraven 1590227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1591227825Stheraven 1592227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1593227825Stheraven 1594227825Stheraventemplate <class _Tp> 1595227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1596227825Stheraventypename decay<_Tp>::type 1597227825Stheraven__decay_copy(_Tp&& __t) 1598227825Stheraven{ 1599227825Stheraven return _VSTD::forward<_Tp>(__t); 1600227825Stheraven} 1601227825Stheraven 1602227825Stheraven#else 1603227825Stheraven 1604227825Stheraventemplate <class _Tp> 1605227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1606227825Stheraventypename decay<_Tp>::type 1607227825Stheraven__decay_copy(const _Tp& __t) 1608227825Stheraven{ 1609227825Stheraven return _VSTD::forward<_Tp>(__t); 1610227825Stheraven} 1611227825Stheraven 1612227825Stheraven#endif 1613227825Stheraven 1614227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 1615227825Stheraven 1616232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1617232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> 1618227825Stheraven{ 1619227825Stheraven typedef _Class _ClassType; 1620232950Stheraven typedef _Rp _ReturnType; 1621275366Sdim typedef _Rp (_FnType) (_Param...); 1622227825Stheraven}; 1623227825Stheraven 1624232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1625232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> 1626227825Stheraven{ 1627227825Stheraven typedef _Class const _ClassType; 1628232950Stheraven typedef _Rp _ReturnType; 1629275366Sdim typedef _Rp (_FnType) (_Param...); 1630227825Stheraven}; 1631227825Stheraven 1632232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1633232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> 1634227825Stheraven{ 1635227825Stheraven typedef _Class volatile _ClassType; 1636232950Stheraven typedef _Rp _ReturnType; 1637275366Sdim typedef _Rp (_FnType) (_Param...); 1638227825Stheraven}; 1639227825Stheraven 1640232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1641232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> 1642227825Stheraven{ 1643227825Stheraven typedef _Class const volatile _ClassType; 1644232950Stheraven typedef _Rp _ReturnType; 1645275366Sdim typedef _Rp (_FnType) (_Param...); 1646227825Stheraven}; 1647227825Stheraven 1648227825Stheraven#if __has_feature(cxx_reference_qualified_functions) 1649227825Stheraven 1650232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1651232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> 1652227825Stheraven{ 1653227825Stheraven typedef _Class& _ClassType; 1654232950Stheraven typedef _Rp _ReturnType; 1655275366Sdim typedef _Rp (_FnType) (_Param...); 1656227825Stheraven}; 1657227825Stheraven 1658232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1659232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> 1660227825Stheraven{ 1661227825Stheraven typedef _Class const& _ClassType; 1662232950Stheraven typedef _Rp _ReturnType; 1663275366Sdim typedef _Rp (_FnType) (_Param...); 1664227825Stheraven}; 1665227825Stheraven 1666232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1667232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> 1668227825Stheraven{ 1669227825Stheraven typedef _Class volatile& _ClassType; 1670232950Stheraven typedef _Rp _ReturnType; 1671275366Sdim typedef _Rp (_FnType) (_Param...); 1672227825Stheraven}; 1673227825Stheraven 1674232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1675232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> 1676227825Stheraven{ 1677227825Stheraven typedef _Class const volatile& _ClassType; 1678232950Stheraven typedef _Rp _ReturnType; 1679275366Sdim typedef _Rp (_FnType) (_Param...); 1680227825Stheraven}; 1681227825Stheraven 1682232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1683232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> 1684227825Stheraven{ 1685227825Stheraven typedef _Class&& _ClassType; 1686232950Stheraven typedef _Rp _ReturnType; 1687275366Sdim typedef _Rp (_FnType) (_Param...); 1688227825Stheraven}; 1689227825Stheraven 1690232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1691232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> 1692227825Stheraven{ 1693227825Stheraven typedef _Class const&& _ClassType; 1694232950Stheraven typedef _Rp _ReturnType; 1695275366Sdim typedef _Rp (_FnType) (_Param...); 1696227825Stheraven}; 1697227825Stheraven 1698232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1699232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> 1700227825Stheraven{ 1701227825Stheraven typedef _Class volatile&& _ClassType; 1702232950Stheraven typedef _Rp _ReturnType; 1703275366Sdim typedef _Rp (_FnType) (_Param...); 1704227825Stheraven}; 1705227825Stheraven 1706232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1707232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> 1708227825Stheraven{ 1709227825Stheraven typedef _Class const volatile&& _ClassType; 1710232950Stheraven typedef _Rp _ReturnType; 1711275366Sdim typedef _Rp (_FnType) (_Param...); 1712227825Stheraven}; 1713227825Stheraven 1714227825Stheraven#endif // __has_feature(cxx_reference_qualified_functions) 1715227825Stheraven 1716227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1717227825Stheraven 1718232950Stheraventemplate <class _Rp, class _Class> 1719232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false> 1720227825Stheraven{ 1721227825Stheraven typedef _Class _ClassType; 1722232950Stheraven typedef _Rp _ReturnType; 1723275366Sdim typedef _Rp (_FnType) (); 1724227825Stheraven}; 1725227825Stheraven 1726232950Stheraventemplate <class _Rp, class _Class, class _P0> 1727232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> 1728227825Stheraven{ 1729227825Stheraven typedef _Class _ClassType; 1730232950Stheraven typedef _Rp _ReturnType; 1731275366Sdim typedef _Rp (_FnType) (_P0); 1732227825Stheraven}; 1733227825Stheraven 1734232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1735232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> 1736227825Stheraven{ 1737227825Stheraven typedef _Class _ClassType; 1738232950Stheraven typedef _Rp _ReturnType; 1739275366Sdim typedef _Rp (_FnType) (_P0, _P1); 1740227825Stheraven}; 1741227825Stheraven 1742232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1743232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> 1744227825Stheraven{ 1745227825Stheraven typedef _Class _ClassType; 1746232950Stheraven typedef _Rp _ReturnType; 1747275366Sdim typedef _Rp (_FnType) (_P0, _P1, _P2); 1748227825Stheraven}; 1749227825Stheraven 1750232950Stheraventemplate <class _Rp, class _Class> 1751232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> 1752227825Stheraven{ 1753227825Stheraven typedef _Class const _ClassType; 1754232950Stheraven typedef _Rp _ReturnType; 1755275366Sdim typedef _Rp (_FnType) (); 1756227825Stheraven}; 1757227825Stheraven 1758232950Stheraventemplate <class _Rp, class _Class, class _P0> 1759232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> 1760227825Stheraven{ 1761227825Stheraven typedef _Class const _ClassType; 1762232950Stheraven typedef _Rp _ReturnType; 1763275366Sdim typedef _Rp (_FnType) (_P0); 1764227825Stheraven}; 1765227825Stheraven 1766232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1767232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> 1768227825Stheraven{ 1769227825Stheraven typedef _Class const _ClassType; 1770232950Stheraven typedef _Rp _ReturnType; 1771275366Sdim typedef _Rp (_FnType) (_P0, _P1); 1772227825Stheraven}; 1773227825Stheraven 1774232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1775232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false> 1776227825Stheraven{ 1777227825Stheraven typedef _Class const _ClassType; 1778232950Stheraven typedef _Rp _ReturnType; 1779275366Sdim typedef _Rp (_FnType) (_P0, _P1, _P2); 1780227825Stheraven}; 1781227825Stheraven 1782232950Stheraventemplate <class _Rp, class _Class> 1783232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> 1784227825Stheraven{ 1785227825Stheraven typedef _Class volatile _ClassType; 1786232950Stheraven typedef _Rp _ReturnType; 1787275366Sdim typedef _Rp (_FnType) (); 1788227825Stheraven}; 1789227825Stheraven 1790232950Stheraventemplate <class _Rp, class _Class, class _P0> 1791232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> 1792227825Stheraven{ 1793227825Stheraven typedef _Class volatile _ClassType; 1794232950Stheraven typedef _Rp _ReturnType; 1795275366Sdim typedef _Rp (_FnType) (_P0); 1796227825Stheraven}; 1797227825Stheraven 1798232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1799232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false> 1800227825Stheraven{ 1801227825Stheraven typedef _Class volatile _ClassType; 1802232950Stheraven typedef _Rp _ReturnType; 1803275366Sdim typedef _Rp (_FnType) (_P0, _P1); 1804227825Stheraven}; 1805227825Stheraven 1806232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1807232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false> 1808227825Stheraven{ 1809227825Stheraven typedef _Class volatile _ClassType; 1810232950Stheraven typedef _Rp _ReturnType; 1811275366Sdim typedef _Rp (_FnType) (_P0, _P1, _P2); 1812227825Stheraven}; 1813227825Stheraven 1814232950Stheraventemplate <class _Rp, class _Class> 1815232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false> 1816227825Stheraven{ 1817227825Stheraven typedef _Class const volatile _ClassType; 1818232950Stheraven typedef _Rp _ReturnType; 1819275366Sdim typedef _Rp (_FnType) (); 1820227825Stheraven}; 1821227825Stheraven 1822232950Stheraventemplate <class _Rp, class _Class, class _P0> 1823232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false> 1824227825Stheraven{ 1825227825Stheraven typedef _Class const volatile _ClassType; 1826232950Stheraven typedef _Rp _ReturnType; 1827275366Sdim typedef _Rp (_FnType) (_P0); 1828227825Stheraven}; 1829227825Stheraven 1830232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1831232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false> 1832227825Stheraven{ 1833227825Stheraven typedef _Class const volatile _ClassType; 1834232950Stheraven typedef _Rp _ReturnType; 1835275366Sdim typedef _Rp (_FnType) (_P0, _P1); 1836227825Stheraven}; 1837227825Stheraven 1838232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1839232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false> 1840227825Stheraven{ 1841227825Stheraven typedef _Class const volatile _ClassType; 1842232950Stheraven typedef _Rp _ReturnType; 1843275366Sdim typedef _Rp (_FnType) (_P0, _P1, _P2); 1844227825Stheraven}; 1845227825Stheraven 1846227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 1847227825Stheraven 1848232950Stheraventemplate <class _Rp, class _Class> 1849232950Stheravenstruct __member_pointer_traits_imp<_Rp _Class::*, false, true> 1850227825Stheraven{ 1851227825Stheraven typedef _Class _ClassType; 1852232950Stheraven typedef _Rp _ReturnType; 1853227825Stheraven}; 1854227825Stheraven 1855227825Stheraventemplate <class _MP> 1856227825Stheravenstruct __member_pointer_traits 1857253159Stheraven : public __member_pointer_traits_imp<typename remove_cv<_MP>::type, 1858227825Stheraven is_member_function_pointer<_MP>::value, 1859227825Stheraven is_member_object_pointer<_MP>::value> 1860227825Stheraven{ 1861227825Stheraven// typedef ... _ClassType; 1862227825Stheraven// typedef ... _ReturnType; 1863275366Sdim// typedef ... _FnType; 1864227825Stheraven}; 1865227825Stheraven 1866227825Stheraven// result_of 1867227825Stheraven 1868227825Stheraventemplate <class _Callable> class result_of; 1869227825Stheraven 1870241903Sdim#ifdef _LIBCPP_HAS_NO_VARIADICS 1871241903Sdim 1872227825Stheraventemplate <class _Fn, bool, bool> 1873227825Stheravenclass __result_of 1874227825Stheraven{ 1875227825Stheraven}; 1876227825Stheraven 1877227825Stheraventemplate <class _Fn> 1878227825Stheravenclass __result_of<_Fn(), true, false> 1879227825Stheraven{ 1880227825Stheravenpublic: 1881227825Stheraven typedef decltype(declval<_Fn>()()) type; 1882227825Stheraven}; 1883227825Stheraven 1884227825Stheraventemplate <class _Fn, class _A0> 1885227825Stheravenclass __result_of<_Fn(_A0), true, false> 1886227825Stheraven{ 1887227825Stheravenpublic: 1888227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>())) type; 1889227825Stheraven}; 1890227825Stheraven 1891227825Stheraventemplate <class _Fn, class _A0, class _A1> 1892227825Stheravenclass __result_of<_Fn(_A0, _A1), true, false> 1893227825Stheraven{ 1894227825Stheravenpublic: 1895227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type; 1896227825Stheraven}; 1897227825Stheraven 1898227825Stheraventemplate <class _Fn, class _A0, class _A1, class _A2> 1899227825Stheravenclass __result_of<_Fn(_A0, _A1, _A2), true, false> 1900227825Stheraven{ 1901227825Stheravenpublic: 1902227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type; 1903227825Stheraven}; 1904227825Stheraven 1905227825Stheraventemplate <class _MP, class _Tp, bool _IsMemberFunctionPtr> 1906227825Stheravenstruct __result_of_mp; 1907227825Stheraven 1908227825Stheraven// member function pointer 1909227825Stheraven 1910227825Stheraventemplate <class _MP, class _Tp> 1911227825Stheravenstruct __result_of_mp<_MP, _Tp, true> 1912227825Stheraven : public common_type<typename __member_pointer_traits<_MP>::_ReturnType> 1913227825Stheraven{ 1914227825Stheraven}; 1915227825Stheraven 1916227825Stheraven// member data pointer 1917227825Stheraven 1918227825Stheraventemplate <class _MP, class _Tp, bool> 1919227825Stheravenstruct __result_of_mdp; 1920227825Stheraven 1921232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1922232950Stheravenstruct __result_of_mdp<_Rp _Class::*, _Tp, false> 1923227825Stheraven{ 1924232950Stheraven typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type; 1925227825Stheraven}; 1926227825Stheraven 1927232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1928232950Stheravenstruct __result_of_mdp<_Rp _Class::*, _Tp, true> 1929227825Stheraven{ 1930232950Stheraven typedef typename __apply_cv<_Tp, _Rp>::type& type; 1931227825Stheraven}; 1932227825Stheraven 1933232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1934232950Stheravenstruct __result_of_mp<_Rp _Class::*, _Tp, false> 1935232950Stheraven : public __result_of_mdp<_Rp _Class::*, _Tp, 1936227825Stheraven is_base_of<_Class, typename remove_reference<_Tp>::type>::value> 1937227825Stheraven{ 1938227825Stheraven}; 1939227825Stheraven 1940227825Stheraven 1941227825Stheraven 1942227825Stheraventemplate <class _Fn, class _Tp> 1943227825Stheravenclass __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer 1944227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1945227825Stheraven _Tp, 1946227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1947227825Stheraven{ 1948227825Stheraven}; 1949227825Stheraven 1950227825Stheraventemplate <class _Fn, class _Tp, class _A0> 1951227825Stheravenclass __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer 1952227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1953227825Stheraven _Tp, 1954227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1955227825Stheraven{ 1956227825Stheraven}; 1957227825Stheraven 1958227825Stheraventemplate <class _Fn, class _Tp, class _A0, class _A1> 1959227825Stheravenclass __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer 1960227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1961227825Stheraven _Tp, 1962227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1963227825Stheraven{ 1964227825Stheraven}; 1965227825Stheraven 1966227825Stheraventemplate <class _Fn, class _Tp, class _A0, class _A1, class _A2> 1967227825Stheravenclass __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer 1968227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1969227825Stheraven _Tp, 1970227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1971227825Stheraven{ 1972227825Stheraven}; 1973227825Stheraven 1974227825Stheraven// result_of 1975227825Stheraven 1976227825Stheraventemplate <class _Fn> 1977261283Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fn()> 1978227825Stheraven : public __result_of<_Fn(), 1979227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1980227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1981227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1982227825Stheraven > 1983227825Stheraven{ 1984227825Stheraven}; 1985227825Stheraven 1986227825Stheraventemplate <class _Fn, class _A0> 1987261283Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0)> 1988227825Stheraven : public __result_of<_Fn(_A0), 1989227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1990227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1991227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1992227825Stheraven > 1993227825Stheraven{ 1994227825Stheraven}; 1995227825Stheraven 1996227825Stheraventemplate <class _Fn, class _A0, class _A1> 1997261283Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1)> 1998227825Stheraven : public __result_of<_Fn(_A0, _A1), 1999227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 2000227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 2001227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 2002227825Stheraven > 2003227825Stheraven{ 2004227825Stheraven}; 2005227825Stheraven 2006227825Stheraventemplate <class _Fn, class _A0, class _A1, class _A2> 2007261283Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1, _A2)> 2008227825Stheraven : public __result_of<_Fn(_A0, _A1, _A2), 2009227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 2010227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 2011227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 2012227825Stheraven > 2013227825Stheraven{ 2014227825Stheraven}; 2015227825Stheraven 2016227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2017227825Stheraven 2018276517Sdim// template <class T, class... Args> struct is_constructible; 2019276517Sdim 2020276517Sdimnamespace __is_construct 2021276517Sdim{ 2022276517Sdimstruct __nat {}; 2023276517Sdim} 2024276517Sdim 2025276517Sdim#if __has_feature(is_constructible) 2026276517Sdim 2027276517Sdimtemplate <class _Tp, class ..._Args> 2028276517Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible 2029276517Sdim : public integral_constant<bool, __is_constructible(_Tp, _Args...)> 2030276517Sdim {}; 2031276517Sdim 2032276517Sdim#else 2033276517Sdim 2034227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2035227825Stheraven 2036227825Stheraven// main is_constructible test 2037227825Stheraven 2038227825Stheraventemplate <class _Tp, class ..._Args> 2039242945Stheraventypename __select_2nd<decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...))), true_type>::type 2040227825Stheraven__is_constructible_test(_Tp&&, _Args&& ...); 2041227825Stheraven 2042227825Stheraventemplate <class ..._Args> 2043227825Stheravenfalse_type 2044227825Stheraven__is_constructible_test(__any, _Args&& ...); 2045227825Stheraven 2046227825Stheraventemplate <bool, class _Tp, class... _Args> 2047276517Sdimstruct __libcpp_is_constructible // false, _Tp is not a scalar 2048227825Stheraven : public common_type 2049227825Stheraven < 2050227825Stheraven decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...)) 2051227825Stheraven >::type 2052227825Stheraven {}; 2053227825Stheraven 2054227825Stheraven// function types are not constructible 2055227825Stheraven 2056232950Stheraventemplate <class _Rp, class... _A1, class... _A2> 2057276517Sdimstruct __libcpp_is_constructible<false, _Rp(_A1...), _A2...> 2058227825Stheraven : public false_type 2059227825Stheraven {}; 2060227825Stheraven 2061227825Stheraven// handle scalars and reference types 2062227825Stheraven 2063227825Stheraven// Scalars are default constructible, references are not 2064227825Stheraven 2065227825Stheraventemplate <class _Tp> 2066276517Sdimstruct __libcpp_is_constructible<true, _Tp> 2067227825Stheraven : public is_scalar<_Tp> 2068227825Stheraven {}; 2069227825Stheraven 2070227825Stheraven// Scalars and references are constructible from one arg if that arg is 2071227825Stheraven// implicitly convertible to the scalar or reference. 2072227825Stheraven 2073227825Stheraventemplate <class _Tp> 2074227825Stheravenstruct __is_constructible_ref 2075227825Stheraven{ 2076242945Stheraven true_type static __lxx(_Tp); 2077242945Stheraven false_type static __lxx(...); 2078227825Stheraven}; 2079227825Stheraven 2080227825Stheraventemplate <class _Tp, class _A0> 2081276517Sdimstruct __libcpp_is_constructible<true, _Tp, _A0> 2082227825Stheraven : public common_type 2083227825Stheraven < 2084242945Stheraven decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>())) 2085227825Stheraven >::type 2086227825Stheraven {}; 2087227825Stheraven 2088227825Stheraven// Scalars and references are not constructible from multiple args. 2089227825Stheraven 2090227825Stheraventemplate <class _Tp, class _A0, class ..._Args> 2091276517Sdimstruct __libcpp_is_constructible<true, _Tp, _A0, _Args...> 2092227825Stheraven : public false_type 2093227825Stheraven {}; 2094227825Stheraven 2095227825Stheraven// Treat scalars and reference types separately 2096227825Stheraven 2097227825Stheraventemplate <bool, class _Tp, class... _Args> 2098227825Stheravenstruct __is_constructible_void_check 2099276517Sdim : public __libcpp_is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2100227825Stheraven _Tp, _Args...> 2101227825Stheraven {}; 2102227825Stheraven 2103227825Stheraven// If any of T or Args is void, is_constructible should be false 2104227825Stheraven 2105227825Stheraventemplate <class _Tp, class... _Args> 2106227825Stheravenstruct __is_constructible_void_check<true, _Tp, _Args...> 2107227825Stheraven : public false_type 2108227825Stheraven {}; 2109227825Stheraven 2110227825Stheraventemplate <class ..._Args> struct __contains_void; 2111227825Stheraven 2112227825Stheraventemplate <> struct __contains_void<> : false_type {}; 2113227825Stheraven 2114227825Stheraventemplate <class _A0, class ..._Args> 2115227825Stheravenstruct __contains_void<_A0, _Args...> 2116227825Stheraven{ 2117227825Stheraven static const bool value = is_void<_A0>::value || 2118227825Stheraven __contains_void<_Args...>::value; 2119227825Stheraven}; 2120227825Stheraven 2121227825Stheraven// is_constructible entry point 2122227825Stheraven 2123227825Stheraventemplate <class _Tp, class... _Args> 2124261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible 2125227825Stheraven : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value 2126227825Stheraven || is_abstract<_Tp>::value, 2127227825Stheraven _Tp, _Args...> 2128227825Stheraven {}; 2129227825Stheraven 2130227825Stheraven// Array types are default constructible if their element type 2131227825Stheraven// is default constructible 2132227825Stheraven 2133232950Stheraventemplate <class _Ap, size_t _Np> 2134276517Sdimstruct __libcpp_is_constructible<false, _Ap[_Np]> 2135232950Stheraven : public is_constructible<typename remove_all_extents<_Ap>::type> 2136227825Stheraven {}; 2137227825Stheraven 2138227825Stheraven// Otherwise array types are not constructible by this syntax 2139227825Stheraven 2140232950Stheraventemplate <class _Ap, size_t _Np, class ..._Args> 2141276517Sdimstruct __libcpp_is_constructible<false, _Ap[_Np], _Args...> 2142227825Stheraven : public false_type 2143227825Stheraven {}; 2144227825Stheraven 2145227825Stheraven// Incomplete array types are not constructible 2146227825Stheraven 2147232950Stheraventemplate <class _Ap, class ..._Args> 2148276517Sdimstruct __libcpp_is_constructible<false, _Ap[], _Args...> 2149227825Stheraven : public false_type 2150227825Stheraven {}; 2151227825Stheraven 2152227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2153227825Stheraven 2154227825Stheraven// template <class T> struct is_constructible0; 2155227825Stheraven 2156227825Stheraven// main is_constructible0 test 2157227825Stheraven 2158227825Stheraventemplate <class _Tp> 2159227825Stheravendecltype((_Tp(), true_type())) 2160227825Stheraven__is_constructible0_test(_Tp&); 2161227825Stheraven 2162227825Stheravenfalse_type 2163227825Stheraven__is_constructible0_test(__any); 2164227825Stheraven 2165227825Stheraventemplate <class _Tp, class _A0> 2166227825Stheravendecltype((_Tp(_VSTD::declval<_A0>()), true_type())) 2167227825Stheraven__is_constructible1_test(_Tp&, _A0&); 2168227825Stheraven 2169227825Stheraventemplate <class _A0> 2170227825Stheravenfalse_type 2171227825Stheraven__is_constructible1_test(__any, _A0&); 2172227825Stheraven 2173227825Stheraventemplate <class _Tp, class _A0, class _A1> 2174227825Stheravendecltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type())) 2175227825Stheraven__is_constructible2_test(_Tp&, _A0&, _A1&); 2176227825Stheraven 2177227825Stheraventemplate <class _A0, class _A1> 2178227825Stheravenfalse_type 2179227825Stheraven__is_constructible2_test(__any, _A0&, _A1&); 2180227825Stheraven 2181227825Stheraventemplate <bool, class _Tp> 2182227825Stheravenstruct __is_constructible0_imp // false, _Tp is not a scalar 2183227825Stheraven : public common_type 2184227825Stheraven < 2185227825Stheraven decltype(__is_constructible0_test(declval<_Tp&>())) 2186227825Stheraven >::type 2187227825Stheraven {}; 2188227825Stheraven 2189227825Stheraventemplate <bool, class _Tp, class _A0> 2190227825Stheravenstruct __is_constructible1_imp // false, _Tp is not a scalar 2191227825Stheraven : public common_type 2192227825Stheraven < 2193227825Stheraven decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>())) 2194227825Stheraven >::type 2195227825Stheraven {}; 2196227825Stheraven 2197227825Stheraventemplate <bool, class _Tp, class _A0, class _A1> 2198227825Stheravenstruct __is_constructible2_imp // false, _Tp is not a scalar 2199227825Stheraven : public common_type 2200227825Stheraven < 2201227825Stheraven decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>())) 2202227825Stheraven >::type 2203227825Stheraven {}; 2204227825Stheraven 2205227825Stheraven// handle scalars and reference types 2206227825Stheraven 2207227825Stheraven// Scalars are default constructible, references are not 2208227825Stheraven 2209227825Stheraventemplate <class _Tp> 2210227825Stheravenstruct __is_constructible0_imp<true, _Tp> 2211227825Stheraven : public is_scalar<_Tp> 2212227825Stheraven {}; 2213227825Stheraven 2214227825Stheraventemplate <class _Tp, class _A0> 2215227825Stheravenstruct __is_constructible1_imp<true, _Tp, _A0> 2216227825Stheraven : public is_convertible<_A0, _Tp> 2217227825Stheraven {}; 2218227825Stheraven 2219227825Stheraventemplate <class _Tp, class _A0, class _A1> 2220227825Stheravenstruct __is_constructible2_imp<true, _Tp, _A0, _A1> 2221227825Stheraven : public false_type 2222227825Stheraven {}; 2223227825Stheraven 2224227825Stheraven// Treat scalars and reference types separately 2225227825Stheraven 2226227825Stheraventemplate <bool, class _Tp> 2227227825Stheravenstruct __is_constructible0_void_check 2228227825Stheraven : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2229227825Stheraven _Tp> 2230227825Stheraven {}; 2231227825Stheraven 2232227825Stheraventemplate <bool, class _Tp, class _A0> 2233227825Stheravenstruct __is_constructible1_void_check 2234227825Stheraven : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2235227825Stheraven _Tp, _A0> 2236227825Stheraven {}; 2237227825Stheraven 2238227825Stheraventemplate <bool, class _Tp, class _A0, class _A1> 2239227825Stheravenstruct __is_constructible2_void_check 2240227825Stheraven : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2241227825Stheraven _Tp, _A0, _A1> 2242227825Stheraven {}; 2243227825Stheraven 2244227825Stheraven// If any of T or Args is void, is_constructible should be false 2245227825Stheraven 2246227825Stheraventemplate <class _Tp> 2247227825Stheravenstruct __is_constructible0_void_check<true, _Tp> 2248227825Stheraven : public false_type 2249227825Stheraven {}; 2250227825Stheraven 2251227825Stheraventemplate <class _Tp, class _A0> 2252227825Stheravenstruct __is_constructible1_void_check<true, _Tp, _A0> 2253227825Stheraven : public false_type 2254227825Stheraven {}; 2255227825Stheraven 2256227825Stheraventemplate <class _Tp, class _A0, class _A1> 2257227825Stheravenstruct __is_constructible2_void_check<true, _Tp, _A0, _A1> 2258227825Stheraven : public false_type 2259227825Stheraven {}; 2260227825Stheraven 2261227825Stheraven// is_constructible entry point 2262227825Stheraven 2263227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2264227825Stheraven class _A1 = __is_construct::__nat> 2265261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible 2266227825Stheraven : public __is_constructible2_void_check<is_void<_Tp>::value 2267227825Stheraven || is_abstract<_Tp>::value 2268227825Stheraven || is_function<_Tp>::value 2269227825Stheraven || is_void<_A0>::value 2270227825Stheraven || is_void<_A1>::value, 2271227825Stheraven _Tp, _A0, _A1> 2272227825Stheraven {}; 2273227825Stheraven 2274227825Stheraventemplate <class _Tp> 2275261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> 2276227825Stheraven : public __is_constructible0_void_check<is_void<_Tp>::value 2277227825Stheraven || is_abstract<_Tp>::value 2278227825Stheraven || is_function<_Tp>::value, 2279227825Stheraven _Tp> 2280227825Stheraven {}; 2281227825Stheraven 2282227825Stheraventemplate <class _Tp, class _A0> 2283261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, _A0, __is_construct::__nat> 2284227825Stheraven : public __is_constructible1_void_check<is_void<_Tp>::value 2285227825Stheraven || is_abstract<_Tp>::value 2286227825Stheraven || is_function<_Tp>::value 2287227825Stheraven || is_void<_A0>::value, 2288227825Stheraven _Tp, _A0> 2289227825Stheraven {}; 2290227825Stheraven 2291227825Stheraven// Array types are default constructible if their element type 2292227825Stheraven// is default constructible 2293227825Stheraven 2294232950Stheraventemplate <class _Ap, size_t _Np> 2295232950Stheravenstruct __is_constructible0_imp<false, _Ap[_Np]> 2296232950Stheraven : public is_constructible<typename remove_all_extents<_Ap>::type> 2297227825Stheraven {}; 2298227825Stheraven 2299232950Stheraventemplate <class _Ap, size_t _Np, class _A0> 2300232950Stheravenstruct __is_constructible1_imp<false, _Ap[_Np], _A0> 2301227825Stheraven : public false_type 2302227825Stheraven {}; 2303227825Stheraven 2304232950Stheraventemplate <class _Ap, size_t _Np, class _A0, class _A1> 2305232950Stheravenstruct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1> 2306227825Stheraven : public false_type 2307227825Stheraven {}; 2308227825Stheraven 2309227825Stheraven// Incomplete array types are not constructible 2310227825Stheraven 2311232950Stheraventemplate <class _Ap> 2312232950Stheravenstruct __is_constructible0_imp<false, _Ap[]> 2313227825Stheraven : public false_type 2314227825Stheraven {}; 2315227825Stheraven 2316232950Stheraventemplate <class _Ap, class _A0> 2317232950Stheravenstruct __is_constructible1_imp<false, _Ap[], _A0> 2318227825Stheraven : public false_type 2319227825Stheraven {}; 2320227825Stheraven 2321232950Stheraventemplate <class _Ap, class _A0, class _A1> 2322232950Stheravenstruct __is_constructible2_imp<false, _Ap[], _A0, _A1> 2323227825Stheraven : public false_type 2324227825Stheraven {}; 2325227825Stheraven 2326227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2327276517Sdim#endif // __has_feature(is_constructible) 2328227825Stheraven 2329227825Stheraven// is_default_constructible 2330227825Stheraven 2331227825Stheraventemplate <class _Tp> 2332261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_default_constructible 2333227825Stheraven : public is_constructible<_Tp> 2334227825Stheraven {}; 2335227825Stheraven 2336227825Stheraven// is_copy_constructible 2337227825Stheraven 2338227825Stheraventemplate <class _Tp> 2339261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_copy_constructible 2340227825Stheraven : public is_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> 2341227825Stheraven {}; 2342227825Stheraven 2343227825Stheraven// is_move_constructible 2344227825Stheraven 2345227825Stheraventemplate <class _Tp> 2346261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_move_constructible 2347227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2348227825Stheraven : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2349227825Stheraven#else 2350227825Stheraven : public is_copy_constructible<_Tp> 2351227825Stheraven#endif 2352227825Stheraven {}; 2353227825Stheraven 2354227825Stheraven// is_trivially_constructible 2355227825Stheraven 2356227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2357227825Stheraven 2358232950Stheraven#if __has_feature(is_trivially_constructible) 2359232950Stheraven 2360227825Stheraventemplate <class _Tp, class... _Args> 2361261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2362232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> 2363232950Stheraven{ 2364232950Stheraven}; 2365232950Stheraven 2366232950Stheraven#else // !__has_feature(is_trivially_constructible) 2367232950Stheraven 2368232950Stheraventemplate <class _Tp, class... _Args> 2369261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2370227825Stheraven : false_type 2371227825Stheraven{ 2372227825Stheraven}; 2373227825Stheraven 2374227825Stheraventemplate <class _Tp> 2375261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp> 2376227825Stheraven#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2377227825Stheraven : integral_constant<bool, __has_trivial_constructor(_Tp)> 2378227825Stheraven#else 2379227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2380227825Stheraven#endif 2381227825Stheraven{ 2382227825Stheraven}; 2383227825Stheraven 2384227825Stheraventemplate <class _Tp> 2385227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2386261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&&> 2387227825Stheraven#else 2388261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp> 2389227825Stheraven#endif 2390227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2391227825Stheraven{ 2392227825Stheraven}; 2393227825Stheraven 2394227825Stheraventemplate <class _Tp> 2395261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&> 2396227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2397227825Stheraven{ 2398227825Stheraven}; 2399227825Stheraven 2400227825Stheraventemplate <class _Tp> 2401261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&> 2402227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2403227825Stheraven{ 2404227825Stheraven}; 2405227825Stheraven 2406232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2407232950Stheraven 2408227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2409227825Stheraven 2410227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2411227825Stheraven class _A1 = __is_construct::__nat> 2412261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2413227825Stheraven : false_type 2414227825Stheraven{ 2415227825Stheraven}; 2416227825Stheraven 2417232950Stheraven#if __has_feature(is_trivially_constructible) 2418232950Stheraven 2419227825Stheraventemplate <class _Tp> 2420261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, 2421227825Stheraven __is_construct::__nat> 2422232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp)> 2423232950Stheraven{ 2424232950Stheraven}; 2425232950Stheraven 2426232950Stheraventemplate <class _Tp> 2427261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp, 2428232950Stheraven __is_construct::__nat> 2429232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)> 2430232950Stheraven{ 2431232950Stheraven}; 2432232950Stheraven 2433232950Stheraventemplate <class _Tp> 2434261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&, 2435232950Stheraven __is_construct::__nat> 2436232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)> 2437232950Stheraven{ 2438232950Stheraven}; 2439232950Stheraven 2440232950Stheraventemplate <class _Tp> 2441261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&, 2442232950Stheraven __is_construct::__nat> 2443232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)> 2444232950Stheraven{ 2445232950Stheraven}; 2446232950Stheraven 2447232950Stheraven#else // !__has_feature(is_trivially_constructible) 2448232950Stheraven 2449232950Stheraventemplate <class _Tp> 2450261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, 2451232950Stheraven __is_construct::__nat> 2452227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2453227825Stheraven{ 2454227825Stheraven}; 2455227825Stheraven 2456227825Stheraventemplate <class _Tp> 2457261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp, 2458227825Stheraven __is_construct::__nat> 2459227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2460227825Stheraven{ 2461227825Stheraven}; 2462227825Stheraven 2463227825Stheraventemplate <class _Tp> 2464261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&, 2465227825Stheraven __is_construct::__nat> 2466227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2467227825Stheraven{ 2468227825Stheraven}; 2469227825Stheraven 2470227825Stheraventemplate <class _Tp> 2471261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&, 2472227825Stheraven __is_construct::__nat> 2473227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2474227825Stheraven{ 2475227825Stheraven}; 2476227825Stheraven 2477232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2478232950Stheraven 2479227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2480227825Stheraven 2481227825Stheraven// is_trivially_default_constructible 2482227825Stheraven 2483261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_default_constructible 2484227825Stheraven : public is_trivially_constructible<_Tp> 2485227825Stheraven {}; 2486227825Stheraven 2487227825Stheraven// is_trivially_copy_constructible 2488227825Stheraven 2489261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_constructible 2490261283Sdim : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type> 2491227825Stheraven {}; 2492227825Stheraven 2493227825Stheraven// is_trivially_move_constructible 2494227825Stheraven 2495261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructible 2496227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2497227825Stheraven : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2498227825Stheraven#else 2499227825Stheraven : public is_trivially_copy_constructible<_Tp> 2500227825Stheraven#endif 2501227825Stheraven {}; 2502227825Stheraven 2503227825Stheraven// is_trivially_assignable 2504227825Stheraven 2505232950Stheraven#if __has_feature(is_trivially_constructible) 2506232950Stheraven 2507227825Stheraventemplate <class _Tp, class _Arg> 2508227825Stheravenstruct is_trivially_assignable 2509232950Stheraven : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> 2510232950Stheraven{ 2511232950Stheraven}; 2512232950Stheraven 2513232950Stheraven#else // !__has_feature(is_trivially_constructible) 2514232950Stheraven 2515232950Stheraventemplate <class _Tp, class _Arg> 2516232950Stheravenstruct is_trivially_assignable 2517227825Stheraven : public false_type {}; 2518227825Stheraven 2519227825Stheraventemplate <class _Tp> 2520227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp> 2521227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2522227825Stheraven 2523227825Stheraventemplate <class _Tp> 2524227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp&> 2525227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2526227825Stheraven 2527227825Stheraventemplate <class _Tp> 2528227825Stheravenstruct is_trivially_assignable<_Tp&, const _Tp&> 2529227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2530227825Stheraven 2531227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2532227825Stheraven 2533227825Stheraventemplate <class _Tp> 2534227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp&&> 2535227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2536227825Stheraven 2537227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2538227825Stheraven 2539232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2540232950Stheraven 2541227825Stheraven// is_trivially_copy_assignable 2542227825Stheraven 2543261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_assignable 2544227825Stheraven : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2545227825Stheraven const typename add_lvalue_reference<_Tp>::type> 2546227825Stheraven {}; 2547227825Stheraven 2548227825Stheraven// is_trivially_move_assignable 2549227825Stheraven 2550261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable 2551227825Stheraven : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2552227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2553227825Stheraven typename add_rvalue_reference<_Tp>::type> 2554227825Stheraven#else 2555227825Stheraven typename add_lvalue_reference<_Tp>::type> 2556227825Stheraven#endif 2557227825Stheraven {}; 2558227825Stheraven 2559227825Stheraven// is_trivially_destructible 2560227825Stheraven 2561227825Stheraven#if __has_feature(has_trivial_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2562227825Stheraven 2563261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible 2564227825Stheraven : public integral_constant<bool, __has_trivial_destructor(_Tp)> {}; 2565227825Stheraven 2566227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 2567227825Stheraven 2568227825Stheraventemplate <class _Tp> struct __libcpp_trivial_destructor 2569227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 2570227825Stheraven is_reference<_Tp>::value> {}; 2571227825Stheraven 2572261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible 2573227825Stheraven : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {}; 2574227825Stheraven 2575227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 2576227825Stheraven 2577227825Stheraven// is_nothrow_constructible 2578227825Stheraven 2579275366Sdim#if 0 2580275366Sdimtemplate <class _Tp, class... _Args> 2581275366Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2582275366Sdim : public integral_constant<bool, __is_nothrow_constructible(_Tp(_Args...))> 2583275366Sdim{ 2584275366Sdim}; 2585275366Sdim 2586275366Sdim#else 2587275366Sdim 2588227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2589227825Stheraven 2590227825Stheraven#if __has_feature(cxx_noexcept) 2591227825Stheraven 2592276517Sdimtemplate <bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible; 2593227825Stheraven 2594227825Stheraventemplate <class _Tp, class... _Args> 2595276517Sdimstruct __libcpp_is_nothrow_constructible<true, _Tp, _Args...> 2596227825Stheraven : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> 2597227825Stheraven{ 2598227825Stheraven}; 2599227825Stheraven 2600227825Stheraventemplate <class _Tp, class... _Args> 2601276517Sdimstruct __libcpp_is_nothrow_constructible<false, _Tp, _Args...> 2602227825Stheraven : public false_type 2603227825Stheraven{ 2604227825Stheraven}; 2605227825Stheraven 2606227825Stheraventemplate <class _Tp, class... _Args> 2607261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2608276517Sdim : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...> 2609227825Stheraven{ 2610227825Stheraven}; 2611227825Stheraven 2612227825Stheraventemplate <class _Tp, size_t _Ns> 2613261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]> 2614276517Sdim : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, _Tp> 2615227825Stheraven{ 2616227825Stheraven}; 2617227825Stheraven 2618227825Stheraven#else // __has_feature(cxx_noexcept) 2619227825Stheraven 2620227825Stheraventemplate <class _Tp, class... _Args> 2621261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2622227825Stheraven : false_type 2623227825Stheraven{ 2624227825Stheraven}; 2625227825Stheraven 2626227825Stheraventemplate <class _Tp> 2627261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp> 2628227825Stheraven#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2629227825Stheraven : integral_constant<bool, __has_nothrow_constructor(_Tp)> 2630227825Stheraven#else 2631227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2632227825Stheraven#endif 2633227825Stheraven{ 2634227825Stheraven}; 2635227825Stheraven 2636227825Stheraventemplate <class _Tp> 2637227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2638261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&&> 2639227825Stheraven#else 2640261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp> 2641227825Stheraven#endif 2642227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2643227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2644227825Stheraven#else 2645227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2646227825Stheraven#endif 2647227825Stheraven{ 2648227825Stheraven}; 2649227825Stheraven 2650227825Stheraventemplate <class _Tp> 2651261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&> 2652227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2653227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2654227825Stheraven#else 2655227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2656227825Stheraven#endif 2657227825Stheraven{ 2658227825Stheraven}; 2659227825Stheraven 2660227825Stheraventemplate <class _Tp> 2661261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&> 2662227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2663227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2664227825Stheraven#else 2665227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2666227825Stheraven#endif 2667227825Stheraven{ 2668227825Stheraven}; 2669227825Stheraven 2670227825Stheraven#endif // __has_feature(cxx_noexcept) 2671227825Stheraven 2672227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2673227825Stheraven 2674227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2675227825Stheraven class _A1 = __is_construct::__nat> 2676261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2677227825Stheraven : false_type 2678227825Stheraven{ 2679227825Stheraven}; 2680227825Stheraven 2681227825Stheraventemplate <class _Tp> 2682261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat, 2683227825Stheraven __is_construct::__nat> 2684227825Stheraven#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2685227825Stheraven : integral_constant<bool, __has_nothrow_constructor(_Tp)> 2686227825Stheraven#else 2687227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2688227825Stheraven#endif 2689227825Stheraven{ 2690227825Stheraven}; 2691227825Stheraven 2692227825Stheraventemplate <class _Tp> 2693261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp, 2694227825Stheraven __is_construct::__nat> 2695227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2696227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2697227825Stheraven#else 2698227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2699227825Stheraven#endif 2700227825Stheraven{ 2701227825Stheraven}; 2702227825Stheraven 2703227825Stheraventemplate <class _Tp> 2704261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&, 2705227825Stheraven __is_construct::__nat> 2706227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2707227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2708227825Stheraven#else 2709227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2710227825Stheraven#endif 2711227825Stheraven{ 2712227825Stheraven}; 2713227825Stheraven 2714227825Stheraventemplate <class _Tp> 2715261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&, 2716227825Stheraven __is_construct::__nat> 2717227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2718227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2719227825Stheraven#else 2720227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2721227825Stheraven#endif 2722227825Stheraven{ 2723227825Stheraven}; 2724227825Stheraven 2725227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2726275366Sdim#endif // __has_feature(is_nothrow_constructible) 2727227825Stheraven 2728227825Stheraven// is_nothrow_default_constructible 2729227825Stheraven 2730261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_default_constructible 2731227825Stheraven : public is_nothrow_constructible<_Tp> 2732227825Stheraven {}; 2733227825Stheraven 2734227825Stheraven// is_nothrow_copy_constructible 2735227825Stheraven 2736261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_constructible 2737227825Stheraven : public is_nothrow_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> 2738227825Stheraven {}; 2739227825Stheraven 2740227825Stheraven// is_nothrow_move_constructible 2741227825Stheraven 2742261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible 2743227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2744227825Stheraven : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2745227825Stheraven#else 2746227825Stheraven : public is_nothrow_copy_constructible<_Tp> 2747227825Stheraven#endif 2748227825Stheraven {}; 2749227825Stheraven 2750227825Stheraven// is_nothrow_assignable 2751227825Stheraven 2752227825Stheraven#if __has_feature(cxx_noexcept) 2753227825Stheraven 2754276517Sdimtemplate <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable; 2755227825Stheraven 2756227825Stheraventemplate <class _Tp, class _Arg> 2757276517Sdimstruct __libcpp_is_nothrow_assignable<false, _Tp, _Arg> 2758227825Stheraven : public false_type 2759227825Stheraven{ 2760227825Stheraven}; 2761227825Stheraven 2762227825Stheraventemplate <class _Tp, class _Arg> 2763276517Sdimstruct __libcpp_is_nothrow_assignable<true, _Tp, _Arg> 2764227825Stheraven : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) > 2765227825Stheraven{ 2766227825Stheraven}; 2767227825Stheraven 2768227825Stheraventemplate <class _Tp, class _Arg> 2769261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable 2770276517Sdim : public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg> 2771227825Stheraven{ 2772227825Stheraven}; 2773227825Stheraven 2774227825Stheraven#else // __has_feature(cxx_noexcept) 2775227825Stheraven 2776227825Stheraventemplate <class _Tp, class _Arg> 2777261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable 2778227825Stheraven : public false_type {}; 2779227825Stheraven 2780227825Stheraventemplate <class _Tp> 2781261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp> 2782227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2783227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2784227825Stheraven#else 2785227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2786227825Stheraven#endif 2787227825Stheraven 2788227825Stheraventemplate <class _Tp> 2789261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp&> 2790227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2791227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2792227825Stheraven#else 2793227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2794227825Stheraven#endif 2795227825Stheraven 2796227825Stheraventemplate <class _Tp> 2797261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _Tp&> 2798227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2799227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2800227825Stheraven#else 2801227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2802227825Stheraven#endif 2803227825Stheraven 2804227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2805227825Stheraven 2806227825Stheraventemplate <class _Tp> 2807227825Stheravenstruct is_nothrow_assignable<_Tp&, _Tp&&> 2808227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2809227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2810227825Stheraven#else 2811227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2812227825Stheraven#endif 2813227825Stheraven 2814227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2815227825Stheraven 2816227825Stheraven#endif // __has_feature(cxx_noexcept) 2817227825Stheraven 2818227825Stheraven// is_nothrow_copy_assignable 2819227825Stheraven 2820261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable 2821227825Stheraven : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 2822227825Stheraven const typename add_lvalue_reference<_Tp>::type> 2823227825Stheraven {}; 2824227825Stheraven 2825227825Stheraven// is_nothrow_move_assignable 2826227825Stheraven 2827261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable 2828227825Stheraven : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 2829227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2830227825Stheraven typename add_rvalue_reference<_Tp>::type> 2831227825Stheraven#else 2832227825Stheraven typename add_lvalue_reference<_Tp>::type> 2833227825Stheraven#endif 2834227825Stheraven {}; 2835227825Stheraven 2836227825Stheraven// is_nothrow_destructible 2837227825Stheraven 2838227825Stheraven#if __has_feature(cxx_noexcept) 2839227825Stheraven 2840276517Sdimtemplate <bool, class _Tp> struct __libcpp_is_nothrow_destructible; 2841227825Stheraven 2842227825Stheraventemplate <class _Tp> 2843276517Sdimstruct __libcpp_is_nothrow_destructible<false, _Tp> 2844227825Stheraven : public false_type 2845227825Stheraven{ 2846227825Stheraven}; 2847227825Stheraven 2848227825Stheraventemplate <class _Tp> 2849276517Sdimstruct __libcpp_is_nothrow_destructible<true, _Tp> 2850227825Stheraven : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) > 2851227825Stheraven{ 2852227825Stheraven}; 2853227825Stheraven 2854227825Stheraventemplate <class _Tp> 2855261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible 2856276517Sdim : public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> 2857227825Stheraven{ 2858227825Stheraven}; 2859227825Stheraven 2860227825Stheraventemplate <class _Tp, size_t _Ns> 2861261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[_Ns]> 2862227825Stheraven : public is_nothrow_destructible<_Tp> 2863227825Stheraven{ 2864227825Stheraven}; 2865227825Stheraven 2866227825Stheraventemplate <class _Tp> 2867261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&> 2868227825Stheraven : public true_type 2869227825Stheraven{ 2870227825Stheraven}; 2871227825Stheraven 2872227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2873227825Stheraven 2874227825Stheraventemplate <class _Tp> 2875261283Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&&> 2876227825Stheraven : public true_type 2877227825Stheraven{ 2878227825Stheraven}; 2879227825Stheraven 2880227825Stheraven#endif 2881227825Stheraven 2882227825Stheraven#else 2883227825Stheraven 2884227825Stheraventemplate <class _Tp> struct __libcpp_nothrow_destructor 2885227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 2886227825Stheraven is_reference<_Tp>::value> {}; 2887227825Stheraven 2888261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible 2889227825Stheraven : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {}; 2890227825Stheraven 2891227825Stheraven#endif 2892227825Stheraven 2893227825Stheraven// is_pod 2894227825Stheraven 2895227825Stheraven#if __has_feature(is_pod) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2896227825Stheraven 2897261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod 2898227825Stheraven : public integral_constant<bool, __is_pod(_Tp)> {}; 2899227825Stheraven 2900227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 2901227825Stheraven 2902261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod 2903227825Stheraven : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value && 2904227825Stheraven is_trivially_copy_constructible<_Tp>::value && 2905227825Stheraven is_trivially_copy_assignable<_Tp>::value && 2906227825Stheraven is_trivially_destructible<_Tp>::value> {}; 2907227825Stheraven 2908227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 2909227825Stheraven 2910227825Stheraven// is_literal_type; 2911227825Stheraven 2912261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type 2913227825Stheraven#if __has_feature(is_literal) 2914227825Stheraven : public integral_constant<bool, __is_literal(_Tp)> 2915227825Stheraven#else 2916227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value || 2917227825Stheraven is_reference<typename remove_all_extents<_Tp>::type>::value> 2918227825Stheraven#endif 2919227825Stheraven {}; 2920227825Stheraven 2921227825Stheraven// is_standard_layout; 2922227825Stheraven 2923261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout 2924227825Stheraven#if __has_feature(is_standard_layout) 2925227825Stheraven : public integral_constant<bool, __is_standard_layout(_Tp)> 2926227825Stheraven#else 2927227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 2928227825Stheraven#endif 2929227825Stheraven {}; 2930227825Stheraven 2931227825Stheraven// is_trivially_copyable; 2932227825Stheraven 2933261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable 2934227825Stheraven#if __has_feature(is_trivially_copyable) 2935227825Stheraven : public integral_constant<bool, __is_trivially_copyable(_Tp)> 2936227825Stheraven#else 2937227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 2938227825Stheraven#endif 2939227825Stheraven {}; 2940227825Stheraven 2941227825Stheraven// is_trivial; 2942227825Stheraven 2943261283Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial 2944227825Stheraven#if __has_feature(is_trivial) 2945227825Stheraven : public integral_constant<bool, __is_trivial(_Tp)> 2946227825Stheraven#else 2947227825Stheraven : integral_constant<bool, is_trivially_copyable<_Tp>::value && 2948227825Stheraven is_trivially_default_constructible<_Tp>::value> 2949227825Stheraven#endif 2950227825Stheraven {}; 2951227825Stheraven 2952227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2953227825Stheraven 2954227825Stheraven// Check for complete types 2955227825Stheraven 2956232950Stheraventemplate <class ..._Tp> struct __check_complete; 2957227825Stheraven 2958227825Stheraventemplate <> 2959227825Stheravenstruct __check_complete<> 2960227825Stheraven{ 2961227825Stheraven}; 2962227825Stheraven 2963232950Stheraventemplate <class _Hp, class _T0, class ..._Tp> 2964232950Stheravenstruct __check_complete<_Hp, _T0, _Tp...> 2965232950Stheraven : private __check_complete<_Hp>, 2966232950Stheraven private __check_complete<_T0, _Tp...> 2967227825Stheraven{ 2968227825Stheraven}; 2969227825Stheraven 2970232950Stheraventemplate <class _Hp> 2971232950Stheravenstruct __check_complete<_Hp, _Hp> 2972232950Stheraven : private __check_complete<_Hp> 2973227825Stheraven{ 2974227825Stheraven}; 2975227825Stheraven 2976232950Stheraventemplate <class _Tp> 2977232950Stheravenstruct __check_complete<_Tp> 2978227825Stheraven{ 2979232950Stheraven static_assert(sizeof(_Tp) > 0, "Type must be complete."); 2980227825Stheraven}; 2981227825Stheraven 2982232950Stheraventemplate <class _Tp> 2983232950Stheravenstruct __check_complete<_Tp&> 2984232950Stheraven : private __check_complete<_Tp> 2985227825Stheraven{ 2986227825Stheraven}; 2987227825Stheraven 2988232950Stheraventemplate <class _Tp> 2989232950Stheravenstruct __check_complete<_Tp&&> 2990232950Stheraven : private __check_complete<_Tp> 2991227825Stheraven{ 2992227825Stheraven}; 2993227825Stheraven 2994232950Stheraventemplate <class _Rp, class ..._Param> 2995232950Stheravenstruct __check_complete<_Rp (*)(_Param...)> 2996241903Sdim : private __check_complete<_Rp> 2997227825Stheraven{ 2998227825Stheraven}; 2999227825Stheraven 3000261283Sdimtemplate <class ..._Param> 3001261283Sdimstruct __check_complete<void (*)(_Param...)> 3002261283Sdim{ 3003261283Sdim}; 3004261283Sdim 3005232950Stheraventemplate <class _Rp, class ..._Param> 3006232950Stheravenstruct __check_complete<_Rp (_Param...)> 3007241903Sdim : private __check_complete<_Rp> 3008227825Stheraven{ 3009227825Stheraven}; 3010227825Stheraven 3011261283Sdimtemplate <class ..._Param> 3012261283Sdimstruct __check_complete<void (_Param...)> 3013261283Sdim{ 3014261283Sdim}; 3015261283Sdim 3016232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3017232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...)> 3018241903Sdim : private __check_complete<_Class> 3019227825Stheraven{ 3020227825Stheraven}; 3021227825Stheraven 3022232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3023232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const> 3024241903Sdim : private __check_complete<_Class> 3025227825Stheraven{ 3026227825Stheraven}; 3027227825Stheraven 3028232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3029232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile> 3030241903Sdim : private __check_complete<_Class> 3031227825Stheraven{ 3032227825Stheraven}; 3033227825Stheraven 3034232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3035232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile> 3036241903Sdim : private __check_complete<_Class> 3037227825Stheraven{ 3038227825Stheraven}; 3039227825Stheraven 3040227825Stheraven#if __has_feature(cxx_reference_qualified_functions) 3041227825Stheraven 3042232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3043232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) &> 3044241903Sdim : private __check_complete<_Class> 3045227825Stheraven{ 3046227825Stheraven}; 3047227825Stheraven 3048232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3049232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const&> 3050241903Sdim : private __check_complete<_Class> 3051227825Stheraven{ 3052227825Stheraven}; 3053227825Stheraven 3054232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3055232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile&> 3056241903Sdim : private __check_complete<_Class> 3057227825Stheraven{ 3058227825Stheraven}; 3059227825Stheraven 3060232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3061232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> 3062241903Sdim : private __check_complete<_Class> 3063227825Stheraven{ 3064227825Stheraven}; 3065227825Stheraven 3066232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3067232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) &&> 3068241903Sdim : private __check_complete<_Class> 3069227825Stheraven{ 3070227825Stheraven}; 3071227825Stheraven 3072232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3073232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const&&> 3074241903Sdim : private __check_complete<_Class> 3075227825Stheraven{ 3076227825Stheraven}; 3077227825Stheraven 3078232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3079232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> 3080241903Sdim : private __check_complete<_Class> 3081227825Stheraven{ 3082227825Stheraven}; 3083227825Stheraven 3084232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3085232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> 3086241903Sdim : private __check_complete<_Class> 3087227825Stheraven{ 3088227825Stheraven}; 3089227825Stheraven 3090227825Stheraven#endif 3091227825Stheraven 3092232950Stheraventemplate <class _Rp, class _Class> 3093232950Stheravenstruct __check_complete<_Rp _Class::*> 3094227825Stheraven : private __check_complete<_Class> 3095227825Stheraven{ 3096227825Stheraven}; 3097227825Stheraven 3098227825Stheraven// __invoke forward declarations 3099227825Stheraven 3100227825Stheraven// fall back - none of the bullets 3101227825Stheraven 3102227825Stheraventemplate <class ..._Args> 3103227825Stheravenauto 3104227825Stheraven__invoke(__any, _Args&& ...__args) 3105227825Stheraven -> __nat; 3106227825Stheraven 3107227825Stheraven// bullets 1 and 2 3108227825Stheraven 3109253159Stheraventemplate <class _Fp, class _A0, class ..._Args, 3110253159Stheraven class = typename enable_if 3111253159Stheraven < 3112253159Stheraven is_member_function_pointer<typename remove_reference<_Fp>::type>::value && 3113253159Stheraven is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3114253159Stheraven typename remove_reference<_A0>::type>::value 3115253159Stheraven >::type 3116253159Stheraven > 3117241903Sdim_LIBCPP_INLINE_VISIBILITY 3118227825Stheravenauto 3119232950Stheraven__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 3120227825Stheraven -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)); 3121227825Stheraven 3122253159Stheraventemplate <class _Fp, class _A0, class ..._Args, 3123253159Stheraven class = typename enable_if 3124253159Stheraven < 3125253159Stheraven is_member_function_pointer<typename remove_reference<_Fp>::type>::value && 3126253159Stheraven !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3127253159Stheraven typename remove_reference<_A0>::type>::value 3128253159Stheraven >::type 3129253159Stheraven > 3130241903Sdim_LIBCPP_INLINE_VISIBILITY 3131227825Stheravenauto 3132232950Stheraven__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 3133227825Stheraven -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)); 3134227825Stheraven 3135227825Stheraven// bullets 3 and 4 3136227825Stheraven 3137253159Stheraventemplate <class _Fp, class _A0, 3138253159Stheraven class = typename enable_if 3139253159Stheraven < 3140253159Stheraven is_member_object_pointer<typename remove_reference<_Fp>::type>::value && 3141253159Stheraven is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3142253159Stheraven typename remove_reference<_A0>::type>::value 3143253159Stheraven >::type 3144253159Stheraven > 3145241903Sdim_LIBCPP_INLINE_VISIBILITY 3146227825Stheravenauto 3147232950Stheraven__invoke(_Fp&& __f, _A0&& __a0) 3148227825Stheraven -> decltype(_VSTD::forward<_A0>(__a0).*__f); 3149227825Stheraven 3150253159Stheraventemplate <class _Fp, class _A0, 3151253159Stheraven class = typename enable_if 3152253159Stheraven < 3153253159Stheraven is_member_object_pointer<typename remove_reference<_Fp>::type>::value && 3154253159Stheraven !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3155253159Stheraven typename remove_reference<_A0>::type>::value 3156253159Stheraven >::type 3157253159Stheraven > 3158241903Sdim_LIBCPP_INLINE_VISIBILITY 3159227825Stheravenauto 3160232950Stheraven__invoke(_Fp&& __f, _A0&& __a0) 3161227825Stheraven -> decltype((*_VSTD::forward<_A0>(__a0)).*__f); 3162227825Stheraven 3163227825Stheraven// bullet 5 3164227825Stheraven 3165232950Stheraventemplate <class _Fp, class ..._Args> 3166241903Sdim_LIBCPP_INLINE_VISIBILITY 3167227825Stheravenauto 3168232950Stheraven__invoke(_Fp&& __f, _Args&& ...__args) 3169232950Stheraven -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)); 3170227825Stheraven 3171227825Stheraven// __invokable 3172227825Stheraven 3173232950Stheraventemplate <class _Fp, class ..._Args> 3174227825Stheravenstruct __invokable_imp 3175241903Sdim : private __check_complete<_Fp> 3176227825Stheraven{ 3177227825Stheraven typedef decltype( 3178232950Stheraven __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...) 3179227825Stheraven ) type; 3180227825Stheraven static const bool value = !is_same<type, __nat>::value; 3181227825Stheraven}; 3182227825Stheraven 3183232950Stheraventemplate <class _Fp, class ..._Args> 3184227825Stheravenstruct __invokable 3185227825Stheraven : public integral_constant<bool, 3186232950Stheraven __invokable_imp<_Fp, _Args...>::value> 3187227825Stheraven{ 3188227825Stheraven}; 3189227825Stheraven 3190227825Stheraven// __invoke_of 3191227825Stheraven 3192232950Stheraventemplate <bool _Invokable, class _Fp, class ..._Args> 3193227825Stheravenstruct __invoke_of_imp // false 3194227825Stheraven{ 3195227825Stheraven}; 3196227825Stheraven 3197232950Stheraventemplate <class _Fp, class ..._Args> 3198232950Stheravenstruct __invoke_of_imp<true, _Fp, _Args...> 3199227825Stheraven{ 3200232950Stheraven typedef typename __invokable_imp<_Fp, _Args...>::type type; 3201227825Stheraven}; 3202227825Stheraven 3203232950Stheraventemplate <class _Fp, class ..._Args> 3204227825Stheravenstruct __invoke_of 3205232950Stheraven : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...> 3206227825Stheraven{ 3207227825Stheraven}; 3208227825Stheraven 3209241903Sdimtemplate <class _Fp, class ..._Args> 3210261283Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fp(_Args...)> 3211241903Sdim : public __invoke_of<_Fp, _Args...> 3212241903Sdim{ 3213241903Sdim}; 3214241903Sdim 3215253159Stheraven#if _LIBCPP_STD_VER > 11 3216253159Stheraventemplate <class _Tp> using result_of_t = typename result_of<_Tp>::type; 3217253159Stheraven#endif 3218253159Stheraven 3219227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 3220227825Stheraven 3221227825Stheraventemplate <class _Tp> 3222227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3223227825Stheraven#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE 3224227825Stheraventypename enable_if 3225227825Stheraven< 3226227825Stheraven is_move_constructible<_Tp>::value && 3227227825Stheraven is_move_assignable<_Tp>::value 3228227825Stheraven>::type 3229227825Stheraven#else 3230227825Stheravenvoid 3231227825Stheraven#endif 3232227825Stheravenswap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && 3233227825Stheraven is_nothrow_move_assignable<_Tp>::value) 3234227825Stheraven{ 3235227825Stheraven _Tp __t(_VSTD::move(__x)); 3236227825Stheraven __x = _VSTD::move(__y); 3237227825Stheraven __y = _VSTD::move(__t); 3238227825Stheraven} 3239227825Stheraven 3240227825Stheraventemplate <class _ForwardIterator1, class _ForwardIterator2> 3241227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3242227825Stheravenvoid 3243227825Stheraveniter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) 3244227825Stheraven // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b))) 3245227825Stheraven _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(), 3246227825Stheraven *_VSTD::declval<_ForwardIterator2>()))) 3247227825Stheraven{ 3248227825Stheraven swap(*__a, *__b); 3249227825Stheraven} 3250227825Stheraven 3251227825Stheraven// __swappable 3252227825Stheraven 3253227825Stheravennamespace __detail 3254227825Stheraven{ 3255227825Stheraven 3256227825Stheravenusing _VSTD::swap; 3257227825Stheraven__nat swap(__any, __any); 3258227825Stheraven 3259227825Stheraventemplate <class _Tp> 3260227825Stheravenstruct __swappable 3261227825Stheraven{ 3262227825Stheraven typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type; 3263227825Stheraven static const bool value = !is_same<type, __nat>::value; 3264227825Stheraven}; 3265227825Stheraven 3266227825Stheraven} // __detail 3267227825Stheraven 3268227825Stheraventemplate <class _Tp> 3269227825Stheravenstruct __is_swappable 3270227825Stheraven : public integral_constant<bool, __detail::__swappable<_Tp>::value> 3271227825Stheraven{ 3272227825Stheraven}; 3273227825Stheraven 3274227825Stheraven#if __has_feature(cxx_noexcept) 3275227825Stheraven 3276227825Stheraventemplate <bool, class _Tp> 3277227825Stheravenstruct __is_nothrow_swappable_imp 3278227825Stheraven : public integral_constant<bool, noexcept(swap(_VSTD::declval<_Tp&>(), 3279227825Stheraven _VSTD::declval<_Tp&>()))> 3280227825Stheraven{ 3281227825Stheraven}; 3282227825Stheraven 3283227825Stheraventemplate <class _Tp> 3284227825Stheravenstruct __is_nothrow_swappable_imp<false, _Tp> 3285227825Stheraven : public false_type 3286227825Stheraven{ 3287227825Stheraven}; 3288227825Stheraven 3289227825Stheraventemplate <class _Tp> 3290227825Stheravenstruct __is_nothrow_swappable 3291227825Stheraven : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp> 3292227825Stheraven{ 3293227825Stheraven}; 3294227825Stheraven 3295227825Stheraven#else // __has_feature(cxx_noexcept) 3296227825Stheraven 3297227825Stheraventemplate <class _Tp> 3298227825Stheravenstruct __is_nothrow_swappable 3299227825Stheraven : public false_type 3300227825Stheraven{ 3301227825Stheraven}; 3302227825Stheraven 3303227825Stheraven#endif // __has_feature(cxx_noexcept) 3304227825Stheraven 3305227825Stheraven#ifdef _LIBCXX_UNDERLYING_TYPE 3306227825Stheraven 3307227825Stheraventemplate <class _Tp> 3308227825Stheravenstruct underlying_type 3309227825Stheraven{ 3310227825Stheraven typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type; 3311227825Stheraven}; 3312227825Stheraven 3313253159Stheraven#if _LIBCPP_STD_VER > 11 3314253159Stheraventemplate <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type; 3315253159Stheraven#endif 3316253159Stheraven 3317227825Stheraven#else // _LIBCXX_UNDERLYING_TYPE 3318227825Stheraven 3319227825Stheraventemplate <class _Tp, bool _Support = false> 3320227825Stheravenstruct underlying_type 3321227825Stheraven{ 3322227825Stheraven static_assert(_Support, "The underyling_type trait requires compiler " 3323227825Stheraven "support. Either no such support exists or " 3324227825Stheraven "libc++ does not know how to use it."); 3325227825Stheraven}; 3326227825Stheraven 3327227825Stheraven#endif // _LIBCXX_UNDERLYING_TYPE 3328227825Stheraven 3329261283Sdim#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE 3330261283Sdim 3331261283Sdimtemplate <class _Tp> 3332261283Sdimstruct __has_operator_addressof_imp 3333261283Sdim{ 3334261283Sdim template <class> 3335261283Sdim static auto __test(__any) -> false_type; 3336261283Sdim template <class _Up> 3337261283Sdim static auto __test(_Up* __u) 3338261283Sdim -> typename __select_2nd<decltype(__u->operator&()), true_type>::type; 3339261283Sdim 3340261283Sdim static const bool value = decltype(__test<_Tp>(nullptr))::value; 3341261283Sdim}; 3342261283Sdim 3343261283Sdimtemplate <class _Tp> 3344261283Sdimstruct __has_operator_addressof 3345261283Sdim : public integral_constant<bool, __has_operator_addressof_imp<_Tp>::value> 3346261283Sdim{}; 3347261283Sdim 3348261283Sdim#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE 3349261283Sdim 3350227825Stheraven_LIBCPP_END_NAMESPACE_STD 3351227825Stheraven 3352227825Stheraven#endif // _LIBCPP_TYPE_TRAITS 3353