type_traits revision 275472
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; 31262801Sdim 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> 212262801Sdim struct _LIBCPP_TYPE_VIS_ONLY conditional {typedef _If type;}; 213227825Stheraventemplate <class _If, class _Then> 214262801Sdim 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 220262801Sdimtemplate <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS_ONLY enable_if {}; 221262801Sdimtemplate <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> 233262801Sdimstruct _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;} 240262801Sdim#if _LIBCPP_STD_VER > 11 241262801Sdim _LIBCPP_INLINE_VISIBILITY 242262801Sdim constexpr value_type operator ()() const {return value;} 243262801Sdim#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 254262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const : public false_type {}; 255262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const<_Tp const> : public true_type {}; 256227825Stheraven 257227825Stheraven// is_volatile 258227825Stheraven 259262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile : public false_type {}; 260262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile<_Tp volatile> : public true_type {}; 261227825Stheraven 262227825Stheraven// remove_const 263227825Stheraven 264262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const {typedef _Tp type;}; 265262801Sdimtemplate <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 272262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile {typedef _Tp type;}; 273262801Sdimtemplate <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 280262801Sdimtemplate <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 288260263Sdimtemplate <class _Tp> struct __libcpp_is_void : public false_type {}; 289260263Sdimtemplate <> struct __libcpp_is_void<void> : public true_type {}; 290227825Stheraven 291262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void 292260263Sdim : public __libcpp_is_void<typename remove_cv<_Tp>::type> {}; 293227825Stheraven 294227825Stheraven// __is_nullptr_t 295227825Stheraven 296260263Sdimtemplate <class _Tp> struct __libcpp___is_nullptr : public false_type {}; 297260263Sdimtemplate <> struct __libcpp___is_nullptr<nullptr_t> : public true_type {}; 298227825Stheraven 299262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t 300260263Sdim : public __libcpp___is_nullptr<typename remove_cv<_Tp>::type> {}; 301227825Stheraven 302262801Sdim#if _LIBCPP_STD_VER > 11 303262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer 304270646Sdim : public __libcpp___is_nullptr<typename remove_cv<_Tp>::type> {}; 305262801Sdim#endif 306262801Sdim 307227825Stheraven// is_integral 308227825Stheraven 309260263Sdimtemplate <class _Tp> struct __libcpp_is_integral : public false_type {}; 310260263Sdimtemplate <> struct __libcpp_is_integral<bool> : public true_type {}; 311260263Sdimtemplate <> struct __libcpp_is_integral<char> : public true_type {}; 312260263Sdimtemplate <> struct __libcpp_is_integral<signed char> : public true_type {}; 313260263Sdimtemplate <> struct __libcpp_is_integral<unsigned char> : public true_type {}; 314260263Sdimtemplate <> struct __libcpp_is_integral<wchar_t> : public true_type {}; 315227825Stheraven#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS 316260263Sdimtemplate <> struct __libcpp_is_integral<char16_t> : public true_type {}; 317260263Sdimtemplate <> struct __libcpp_is_integral<char32_t> : public true_type {}; 318227825Stheraven#endif // _LIBCPP_HAS_NO_UNICODE_CHARS 319260263Sdimtemplate <> struct __libcpp_is_integral<short> : public true_type {}; 320260263Sdimtemplate <> struct __libcpp_is_integral<unsigned short> : public true_type {}; 321260263Sdimtemplate <> struct __libcpp_is_integral<int> : public true_type {}; 322260263Sdimtemplate <> struct __libcpp_is_integral<unsigned int> : public true_type {}; 323260263Sdimtemplate <> struct __libcpp_is_integral<long> : public true_type {}; 324260263Sdimtemplate <> struct __libcpp_is_integral<unsigned long> : public true_type {}; 325260263Sdimtemplate <> struct __libcpp_is_integral<long long> : public true_type {}; 326260263Sdimtemplate <> struct __libcpp_is_integral<unsigned long long> : public true_type {}; 327227825Stheraven 328262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral 329260263Sdim : public __libcpp_is_integral<typename remove_cv<_Tp>::type> {}; 330227825Stheraven 331227825Stheraven// is_floating_point 332227825Stheraven 333260263Sdimtemplate <class _Tp> struct __libcpp_is_floating_point : public false_type {}; 334260263Sdimtemplate <> struct __libcpp_is_floating_point<float> : public true_type {}; 335260263Sdimtemplate <> struct __libcpp_is_floating_point<double> : public true_type {}; 336260263Sdimtemplate <> struct __libcpp_is_floating_point<long double> : public true_type {}; 337227825Stheraven 338262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_floating_point 339260263Sdim : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {}; 340227825Stheraven 341227825Stheraven// is_array 342227825Stheraven 343262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array 344227825Stheraven : public false_type {}; 345262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[]> 346227825Stheraven : public true_type {}; 347262801Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]> 348227825Stheraven : public true_type {}; 349227825Stheraven 350227825Stheraven// is_pointer 351227825Stheraven 352260263Sdimtemplate <class _Tp> struct __libcpp_is_pointer : public false_type {}; 353260263Sdimtemplate <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {}; 354227825Stheraven 355262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pointer 356260263Sdim : public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {}; 357227825Stheraven 358227825Stheraven// is_reference 359227825Stheraven 360262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference : public false_type {}; 361262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference<_Tp&> : public true_type {}; 362227825Stheraven 363262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference : public false_type {}; 364227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 365262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference<_Tp&&> : public true_type {}; 366227825Stheraven#endif 367227825Stheraven 368262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference : public false_type {}; 369262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&> : public true_type {}; 370227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 371262801Sdimtemplate <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 382262801Sdimtemplate <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 {}; 388262801Sdimtemplate <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 397262801Sdimtemplate <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 408262801Sdimtemplate <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 415262801Sdimtemplate <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS_ONLY is_same : public false_type {}; 416262801Sdimtemplate <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 || 431262801Sdim __is_nullptr_t<_Tp>::value > 432260263Sdimstruct __libcpp_is_function 433227825Stheraven : public integral_constant<bool, sizeof(__is_function_imp::__test<_Tp>(__is_function_imp::__source<_Tp>())) == 1> 434227825Stheraven {}; 435260263Sdimtemplate <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type {}; 436227825Stheraven 437262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function 438260263Sdim : public __libcpp_is_function<_Tp> {}; 439227825Stheraven 440227825Stheraven// is_member_function_pointer 441227825Stheraven 442275472Sdim// template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {}; 443275472Sdim// template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {}; 444275472Sdim// 445227825Stheraven 446275472Sdimtemplate <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr> 447275472Sdimstruct __member_pointer_traits_imp 448275472Sdim{ // forward declaration; specializations later 449275472Sdim}; 450275472Sdim 451275472Sdim 452275472Sdimnamespace __libcpp_is_member_function_pointer_imp { 453275472Sdim template <typename _Tp> 454275472Sdim char __test(typename std::__member_pointer_traits_imp<_Tp, true, false>::_FnType *); 455275472Sdim 456275472Sdim template <typename> 457275472Sdim std::__two __test(...); 458275472Sdim}; 459275472Sdim 460275472Sdimtemplate <class _Tp> struct __libcpp_is_member_function_pointer 461275472Sdim : public integral_constant<bool, sizeof(__libcpp_is_member_function_pointer_imp::__test<_Tp>(nullptr)) == 1> {}; 462275472Sdim 463262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer 464260263Sdim : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type> {}; 465227825Stheraven 466227825Stheraven// is_member_pointer 467227825Stheraven 468260263Sdimtemplate <class _Tp> struct __libcpp_is_member_pointer : public false_type {}; 469260263Sdimtemplate <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> : public true_type {}; 470227825Stheraven 471262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer 472260263Sdim : public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {}; 473227825Stheraven 474227825Stheraven// is_member_object_pointer 475227825Stheraven 476262801Sdimtemplate <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 484262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum 485227825Stheraven : public integral_constant<bool, __is_enum(_Tp)> {}; 486227825Stheraven 487227825Stheraven#else 488227825Stheraven 489262801Sdimtemplate <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 505262801Sdimtemplate <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 511262801Sdimtemplate <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 518262801Sdimtemplate <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 525262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar<nullptr_t> : public true_type {}; 526227825Stheraven 527227825Stheraven// is_object 528227825Stheraven 529262801Sdimtemplate <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 537262801Sdimtemplate <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 550262801Sdimtemplate <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 567262801Sdimtemplate <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 576262801Sdimtemplate <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 585262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference {typedef _Tp type;}; 586262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&> {typedef _Tp type;}; 587227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 588262801Sdimtemplate <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 597262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference {typedef _Tp& type;}; 598262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<_Tp&> {typedef _Tp& type;}; // for older compiler 599262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<void> {typedef void type;}; 600262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const void> {typedef const void type;}; 601262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<volatile void> {typedef volatile void type;}; 602262801Sdimtemplate <> 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 610262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference {typedef _Tp&& type;}; 611262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<void> {typedef void type;}; 612262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const void> {typedef const void type;}; 613262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<volatile void> {typedef volatile void type;}; 614262801Sdimtemplate <> 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 643262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer {typedef _Tp type;}; 644262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp*> {typedef _Tp type;}; 645262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const> {typedef _Tp type;}; 646262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* volatile> {typedef _Tp type;}; 647262801Sdimtemplate <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 655262801Sdimtemplate <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> 671260263Sdimstruct __libcpp_is_signed : public ___is_signed<_Tp> {}; 672227825Stheraven 673260263Sdimtemplate <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {}; 674227825Stheraven 675262801Sdimtemplate <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> 686260263Sdimstruct __libcpp_is_unsigned : public ___is_unsigned<_Tp> {}; 687227825Stheraven 688260263Sdimtemplate <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {}; 689227825Stheraven 690262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {}; 691227825Stheraven 692227825Stheraven// rank 693227825Stheraven 694262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank 695227825Stheraven : public integral_constant<size_t, 0> {}; 696262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[]> 697227825Stheraven : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 698262801Sdimtemplate <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 703262801Sdimtemplate <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TYPE_VIS_ONLY extent 704227825Stheraven : public integral_constant<size_t, 0> {}; 705262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], 0> 706227825Stheraven : public integral_constant<size_t, 0> {}; 707262801Sdimtemplate <class _Tp, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], _Ip> 708227825Stheraven : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 709262801Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], 0> 710227825Stheraven : public integral_constant<size_t, _Np> {}; 711262801Sdimtemplate <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 716262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent 717227825Stheraven {typedef _Tp type;}; 718262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[]> 719227825Stheraven {typedef _Tp type;}; 720262801Sdimtemplate <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 729262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents 730227825Stheraven {typedef _Tp type;}; 731262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[]> 732227825Stheraven {typedef typename remove_all_extents<_Tp>::type type;}; 733262801Sdimtemplate <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 740262801Sdim// decay 741262801Sdim 742262801Sdimtemplate <class _Tp> 743262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY decay 744262801Sdim{ 745262801Sdimprivate: 746262801Sdim typedef typename remove_reference<_Tp>::type _Up; 747262801Sdimpublic: 748262801Sdim typedef typename conditional 749262801Sdim < 750262801Sdim is_array<_Up>::value, 751262801Sdim typename remove_extent<_Up>::type*, 752262801Sdim typename conditional 753262801Sdim < 754262801Sdim is_function<_Up>::value, 755262801Sdim typename add_pointer<_Up>::type, 756262801Sdim typename remove_cv<_Up>::type 757262801Sdim >::type 758262801Sdim >::type type; 759262801Sdim}; 760262801Sdim 761262801Sdim#if _LIBCPP_STD_VER > 11 762262801Sdimtemplate <class _Tp> using decay_t = typename decay<_Tp>::type; 763262801Sdim#endif 764262801Sdim 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 778262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {}; 779227825Stheraven 780241903Sdim// is_base_of 781241903Sdim 782262801Sdim#ifdef _LIBCPP_HAS_IS_BASE_OF 783241903Sdim 784241903Sdimtemplate <class _Bp, class _Dp> 785262801Sdimstruct _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> 809262801Sdimstruct _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 819262801Sdimtemplate <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 925262801Sdimtemplate <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> 939262801Sdimstruct _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 961262801Sdimtemplate <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> 970262801Sdimstruct _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 980262801Sdimtemplate <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 989262801Sdimtemplate <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 994262801Sdimtemplate <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 1001262801Sdimtemplate <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> 1089262801Sdimstruct _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>\ 1107262801Sdimstruct _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) 1130262801Sdim#if !defined(_LIBCPP_MSVC) 1131227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); 1132262801Sdim#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> 1326262801Sdimstruct _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> 1355262801Sdimstruct _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> 1367262801Sdimstruct _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> 1374262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, void, void> 1375227825Stheraven{ 1376227825Stheravenpublic: 1377227825Stheraven typedef _Tp type; 1378227825Stheraven}; 1379227825Stheraven 1380227825Stheraventemplate <class _Tp, class _Up> 1381262801Sdimstruct _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> 1400262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp> 1401227825Stheraven{ 1402262801Sdim typedef typename decay<_Tp>::type type; 1403227825Stheraven}; 1404227825Stheraven 1405227825Stheraventemplate <class _Tp, class _Up> 1406262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up> 1407227825Stheraven{ 1408227825Stheravenprivate: 1409227825Stheraven static _Tp&& __t(); 1410227825Stheraven static _Up&& __u(); 1411227825Stheraven static bool __f(); 1412227825Stheravenpublic: 1413262801Sdim typedef typename decay<decltype(__f() ? __t() : __u())>::type type; 1414227825Stheraven}; 1415227825Stheraven 1416227825Stheraventemplate <class _Tp, class _Up, class ..._Vp> 1417262801Sdimstruct _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 1430262801Sdimtemplate<typename, typename _Tp> struct __select_2nd { typedef _Tp type; }; 1431262801Sdim 1432227825Stheraventemplate <class _Tp, class _Arg> 1433262801Sdimtypename __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 1467262801Sdimtemplate <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 1473262801Sdimtemplate <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 1500262801Sdimtemplate <class _Tp, bool = is_void<_Tp>::value || is_abstract<_Tp>::value 1501262801Sdim || 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 1516262801Sdimtemplate <class _Tp> 1517262801Sdimstruct is_destructible<_Tp[]> 1518262801Sdim : public false_type {}; 1519262801Sdim 1520227825Stheraven// move 1521227825Stheraven 1522227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1523227825Stheraven 1524227825Stheraventemplate <class _Tp> 1525262801Sdiminline _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> 1534262801Sdiminline _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> 1542262801Sdiminline _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; 1621275472Sdim 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; 1629275472Sdim 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; 1637275472Sdim 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; 1645275472Sdim 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; 1655275472Sdim 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; 1663275472Sdim 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; 1671275472Sdim 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; 1679275472Sdim 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; 1687275472Sdim 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; 1695275472Sdim 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; 1703275472Sdim 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; 1711275472Sdim 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; 1723275472Sdim 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; 1731275472Sdim 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; 1739275472Sdim 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; 1747275472Sdim 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; 1755275472Sdim 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; 1763275472Sdim 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; 1771275472Sdim 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; 1779275472Sdim 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; 1787275472Sdim 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; 1795275472Sdim 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; 1803275472Sdim 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; 1811275472Sdim 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; 1819275472Sdim 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; 1827275472Sdim 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; 1835275472Sdim 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; 1843275472Sdim 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; 1863275472Sdim// 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> 1977262801Sdimclass _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> 1987262801Sdimclass _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> 1997262801Sdimclass _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> 2007262801Sdimclass _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 2018227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2019227825Stheraven 2020227825Stheraven// template <class T, class... Args> struct is_constructible; 2021227825Stheraven 2022227825Stheraven// main is_constructible test 2023227825Stheraven 2024227825Stheraventemplate <class _Tp, class ..._Args> 2025242945Stheraventypename __select_2nd<decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...))), true_type>::type 2026227825Stheraven__is_constructible_test(_Tp&&, _Args&& ...); 2027227825Stheraven 2028227825Stheraventemplate <class ..._Args> 2029227825Stheravenfalse_type 2030227825Stheraven__is_constructible_test(__any, _Args&& ...); 2031227825Stheraven 2032227825Stheraventemplate <bool, class _Tp, class... _Args> 2033227825Stheravenstruct __is_constructible // false, _Tp is not a scalar 2034227825Stheraven : public common_type 2035227825Stheraven < 2036227825Stheraven decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...)) 2037227825Stheraven >::type 2038227825Stheraven {}; 2039227825Stheraven 2040227825Stheraven// function types are not constructible 2041227825Stheraven 2042232950Stheraventemplate <class _Rp, class... _A1, class... _A2> 2043232950Stheravenstruct __is_constructible<false, _Rp(_A1...), _A2...> 2044227825Stheraven : public false_type 2045227825Stheraven {}; 2046227825Stheraven 2047227825Stheraven// handle scalars and reference types 2048227825Stheraven 2049227825Stheraven// Scalars are default constructible, references are not 2050227825Stheraven 2051227825Stheraventemplate <class _Tp> 2052227825Stheravenstruct __is_constructible<true, _Tp> 2053227825Stheraven : public is_scalar<_Tp> 2054227825Stheraven {}; 2055227825Stheraven 2056227825Stheraven// Scalars and references are constructible from one arg if that arg is 2057227825Stheraven// implicitly convertible to the scalar or reference. 2058227825Stheraven 2059227825Stheraventemplate <class _Tp> 2060227825Stheravenstruct __is_constructible_ref 2061227825Stheraven{ 2062242945Stheraven true_type static __lxx(_Tp); 2063242945Stheraven false_type static __lxx(...); 2064227825Stheraven}; 2065227825Stheraven 2066227825Stheraventemplate <class _Tp, class _A0> 2067227825Stheravenstruct __is_constructible<true, _Tp, _A0> 2068227825Stheraven : public common_type 2069227825Stheraven < 2070242945Stheraven decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>())) 2071227825Stheraven >::type 2072227825Stheraven {}; 2073227825Stheraven 2074227825Stheraven// Scalars and references are not constructible from multiple args. 2075227825Stheraven 2076227825Stheraventemplate <class _Tp, class _A0, class ..._Args> 2077227825Stheravenstruct __is_constructible<true, _Tp, _A0, _Args...> 2078227825Stheraven : public false_type 2079227825Stheraven {}; 2080227825Stheraven 2081227825Stheraven// Treat scalars and reference types separately 2082227825Stheraven 2083227825Stheraventemplate <bool, class _Tp, class... _Args> 2084227825Stheravenstruct __is_constructible_void_check 2085227825Stheraven : public __is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2086227825Stheraven _Tp, _Args...> 2087227825Stheraven {}; 2088227825Stheraven 2089227825Stheraven// If any of T or Args is void, is_constructible should be false 2090227825Stheraven 2091227825Stheraventemplate <class _Tp, class... _Args> 2092227825Stheravenstruct __is_constructible_void_check<true, _Tp, _Args...> 2093227825Stheraven : public false_type 2094227825Stheraven {}; 2095227825Stheraven 2096227825Stheraventemplate <class ..._Args> struct __contains_void; 2097227825Stheraven 2098227825Stheraventemplate <> struct __contains_void<> : false_type {}; 2099227825Stheraven 2100227825Stheraventemplate <class _A0, class ..._Args> 2101227825Stheravenstruct __contains_void<_A0, _Args...> 2102227825Stheraven{ 2103227825Stheraven static const bool value = is_void<_A0>::value || 2104227825Stheraven __contains_void<_Args...>::value; 2105227825Stheraven}; 2106227825Stheraven 2107227825Stheraven// is_constructible entry point 2108227825Stheraven 2109227825Stheraventemplate <class _Tp, class... _Args> 2110262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible 2111227825Stheraven : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value 2112227825Stheraven || is_abstract<_Tp>::value, 2113227825Stheraven _Tp, _Args...> 2114227825Stheraven {}; 2115227825Stheraven 2116227825Stheraven// Array types are default constructible if their element type 2117227825Stheraven// is default constructible 2118227825Stheraven 2119232950Stheraventemplate <class _Ap, size_t _Np> 2120232950Stheravenstruct __is_constructible<false, _Ap[_Np]> 2121232950Stheraven : public is_constructible<typename remove_all_extents<_Ap>::type> 2122227825Stheraven {}; 2123227825Stheraven 2124227825Stheraven// Otherwise array types are not constructible by this syntax 2125227825Stheraven 2126232950Stheraventemplate <class _Ap, size_t _Np, class ..._Args> 2127232950Stheravenstruct __is_constructible<false, _Ap[_Np], _Args...> 2128227825Stheraven : public false_type 2129227825Stheraven {}; 2130227825Stheraven 2131227825Stheraven// Incomplete array types are not constructible 2132227825Stheraven 2133232950Stheraventemplate <class _Ap, class ..._Args> 2134232950Stheravenstruct __is_constructible<false, _Ap[], _Args...> 2135227825Stheraven : public false_type 2136227825Stheraven {}; 2137227825Stheraven 2138227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2139227825Stheraven 2140227825Stheraven// template <class T> struct is_constructible0; 2141227825Stheraven 2142227825Stheraven// main is_constructible0 test 2143227825Stheraven 2144227825Stheraventemplate <class _Tp> 2145227825Stheravendecltype((_Tp(), true_type())) 2146227825Stheraven__is_constructible0_test(_Tp&); 2147227825Stheraven 2148227825Stheravenfalse_type 2149227825Stheraven__is_constructible0_test(__any); 2150227825Stheraven 2151227825Stheraventemplate <class _Tp, class _A0> 2152227825Stheravendecltype((_Tp(_VSTD::declval<_A0>()), true_type())) 2153227825Stheraven__is_constructible1_test(_Tp&, _A0&); 2154227825Stheraven 2155227825Stheraventemplate <class _A0> 2156227825Stheravenfalse_type 2157227825Stheraven__is_constructible1_test(__any, _A0&); 2158227825Stheraven 2159227825Stheraventemplate <class _Tp, class _A0, class _A1> 2160227825Stheravendecltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type())) 2161227825Stheraven__is_constructible2_test(_Tp&, _A0&, _A1&); 2162227825Stheraven 2163227825Stheraventemplate <class _A0, class _A1> 2164227825Stheravenfalse_type 2165227825Stheraven__is_constructible2_test(__any, _A0&, _A1&); 2166227825Stheraven 2167227825Stheraventemplate <bool, class _Tp> 2168227825Stheravenstruct __is_constructible0_imp // false, _Tp is not a scalar 2169227825Stheraven : public common_type 2170227825Stheraven < 2171227825Stheraven decltype(__is_constructible0_test(declval<_Tp&>())) 2172227825Stheraven >::type 2173227825Stheraven {}; 2174227825Stheraven 2175227825Stheraventemplate <bool, class _Tp, class _A0> 2176227825Stheravenstruct __is_constructible1_imp // false, _Tp is not a scalar 2177227825Stheraven : public common_type 2178227825Stheraven < 2179227825Stheraven decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>())) 2180227825Stheraven >::type 2181227825Stheraven {}; 2182227825Stheraven 2183227825Stheraventemplate <bool, class _Tp, class _A0, class _A1> 2184227825Stheravenstruct __is_constructible2_imp // false, _Tp is not a scalar 2185227825Stheraven : public common_type 2186227825Stheraven < 2187227825Stheraven decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>())) 2188227825Stheraven >::type 2189227825Stheraven {}; 2190227825Stheraven 2191227825Stheraven// handle scalars and reference types 2192227825Stheraven 2193227825Stheraven// Scalars are default constructible, references are not 2194227825Stheraven 2195227825Stheraventemplate <class _Tp> 2196227825Stheravenstruct __is_constructible0_imp<true, _Tp> 2197227825Stheraven : public is_scalar<_Tp> 2198227825Stheraven {}; 2199227825Stheraven 2200227825Stheraventemplate <class _Tp, class _A0> 2201227825Stheravenstruct __is_constructible1_imp<true, _Tp, _A0> 2202227825Stheraven : public is_convertible<_A0, _Tp> 2203227825Stheraven {}; 2204227825Stheraven 2205227825Stheraventemplate <class _Tp, class _A0, class _A1> 2206227825Stheravenstruct __is_constructible2_imp<true, _Tp, _A0, _A1> 2207227825Stheraven : public false_type 2208227825Stheraven {}; 2209227825Stheraven 2210227825Stheraven// Treat scalars and reference types separately 2211227825Stheraven 2212227825Stheraventemplate <bool, class _Tp> 2213227825Stheravenstruct __is_constructible0_void_check 2214227825Stheraven : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2215227825Stheraven _Tp> 2216227825Stheraven {}; 2217227825Stheraven 2218227825Stheraventemplate <bool, class _Tp, class _A0> 2219227825Stheravenstruct __is_constructible1_void_check 2220227825Stheraven : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2221227825Stheraven _Tp, _A0> 2222227825Stheraven {}; 2223227825Stheraven 2224227825Stheraventemplate <bool, class _Tp, class _A0, class _A1> 2225227825Stheravenstruct __is_constructible2_void_check 2226227825Stheraven : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2227227825Stheraven _Tp, _A0, _A1> 2228227825Stheraven {}; 2229227825Stheraven 2230227825Stheraven// If any of T or Args is void, is_constructible should be false 2231227825Stheraven 2232227825Stheraventemplate <class _Tp> 2233227825Stheravenstruct __is_constructible0_void_check<true, _Tp> 2234227825Stheraven : public false_type 2235227825Stheraven {}; 2236227825Stheraven 2237227825Stheraventemplate <class _Tp, class _A0> 2238227825Stheravenstruct __is_constructible1_void_check<true, _Tp, _A0> 2239227825Stheraven : public false_type 2240227825Stheraven {}; 2241227825Stheraven 2242227825Stheraventemplate <class _Tp, class _A0, class _A1> 2243227825Stheravenstruct __is_constructible2_void_check<true, _Tp, _A0, _A1> 2244227825Stheraven : public false_type 2245227825Stheraven {}; 2246227825Stheraven 2247227825Stheraven// is_constructible entry point 2248227825Stheraven 2249227825Stheravennamespace __is_construct 2250227825Stheraven{ 2251227825Stheraven 2252227825Stheravenstruct __nat {}; 2253227825Stheraven 2254227825Stheraven} 2255227825Stheraven 2256227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2257227825Stheraven class _A1 = __is_construct::__nat> 2258262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible 2259227825Stheraven : public __is_constructible2_void_check<is_void<_Tp>::value 2260227825Stheraven || is_abstract<_Tp>::value 2261227825Stheraven || is_function<_Tp>::value 2262227825Stheraven || is_void<_A0>::value 2263227825Stheraven || is_void<_A1>::value, 2264227825Stheraven _Tp, _A0, _A1> 2265227825Stheraven {}; 2266227825Stheraven 2267227825Stheraventemplate <class _Tp> 2268262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> 2269227825Stheraven : public __is_constructible0_void_check<is_void<_Tp>::value 2270227825Stheraven || is_abstract<_Tp>::value 2271227825Stheraven || is_function<_Tp>::value, 2272227825Stheraven _Tp> 2273227825Stheraven {}; 2274227825Stheraven 2275227825Stheraventemplate <class _Tp, class _A0> 2276262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, _A0, __is_construct::__nat> 2277227825Stheraven : public __is_constructible1_void_check<is_void<_Tp>::value 2278227825Stheraven || is_abstract<_Tp>::value 2279227825Stheraven || is_function<_Tp>::value 2280227825Stheraven || is_void<_A0>::value, 2281227825Stheraven _Tp, _A0> 2282227825Stheraven {}; 2283227825Stheraven 2284227825Stheraven// Array types are default constructible if their element type 2285227825Stheraven// is default constructible 2286227825Stheraven 2287232950Stheraventemplate <class _Ap, size_t _Np> 2288232950Stheravenstruct __is_constructible0_imp<false, _Ap[_Np]> 2289232950Stheraven : public is_constructible<typename remove_all_extents<_Ap>::type> 2290227825Stheraven {}; 2291227825Stheraven 2292232950Stheraventemplate <class _Ap, size_t _Np, class _A0> 2293232950Stheravenstruct __is_constructible1_imp<false, _Ap[_Np], _A0> 2294227825Stheraven : public false_type 2295227825Stheraven {}; 2296227825Stheraven 2297232950Stheraventemplate <class _Ap, size_t _Np, class _A0, class _A1> 2298232950Stheravenstruct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1> 2299227825Stheraven : public false_type 2300227825Stheraven {}; 2301227825Stheraven 2302227825Stheraven// Incomplete array types are not constructible 2303227825Stheraven 2304232950Stheraventemplate <class _Ap> 2305232950Stheravenstruct __is_constructible0_imp<false, _Ap[]> 2306227825Stheraven : public false_type 2307227825Stheraven {}; 2308227825Stheraven 2309232950Stheraventemplate <class _Ap, class _A0> 2310232950Stheravenstruct __is_constructible1_imp<false, _Ap[], _A0> 2311227825Stheraven : public false_type 2312227825Stheraven {}; 2313227825Stheraven 2314232950Stheraventemplate <class _Ap, class _A0, class _A1> 2315232950Stheravenstruct __is_constructible2_imp<false, _Ap[], _A0, _A1> 2316227825Stheraven : public false_type 2317227825Stheraven {}; 2318227825Stheraven 2319227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2320227825Stheraven 2321227825Stheraven// is_default_constructible 2322227825Stheraven 2323227825Stheraventemplate <class _Tp> 2324262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_default_constructible 2325227825Stheraven : public is_constructible<_Tp> 2326227825Stheraven {}; 2327227825Stheraven 2328227825Stheraven// is_copy_constructible 2329227825Stheraven 2330227825Stheraventemplate <class _Tp> 2331262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_copy_constructible 2332227825Stheraven : public is_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> 2333227825Stheraven {}; 2334227825Stheraven 2335227825Stheraven// is_move_constructible 2336227825Stheraven 2337227825Stheraventemplate <class _Tp> 2338262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_move_constructible 2339227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2340227825Stheraven : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2341227825Stheraven#else 2342227825Stheraven : public is_copy_constructible<_Tp> 2343227825Stheraven#endif 2344227825Stheraven {}; 2345227825Stheraven 2346227825Stheraven// is_trivially_constructible 2347227825Stheraven 2348227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2349227825Stheraven 2350232950Stheraven#if __has_feature(is_trivially_constructible) 2351232950Stheraven 2352227825Stheraventemplate <class _Tp, class... _Args> 2353262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2354232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> 2355232950Stheraven{ 2356232950Stheraven}; 2357232950Stheraven 2358232950Stheraven#else // !__has_feature(is_trivially_constructible) 2359232950Stheraven 2360232950Stheraventemplate <class _Tp, class... _Args> 2361262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2362227825Stheraven : false_type 2363227825Stheraven{ 2364227825Stheraven}; 2365227825Stheraven 2366227825Stheraventemplate <class _Tp> 2367262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp> 2368227825Stheraven#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2369227825Stheraven : integral_constant<bool, __has_trivial_constructor(_Tp)> 2370227825Stheraven#else 2371227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2372227825Stheraven#endif 2373227825Stheraven{ 2374227825Stheraven}; 2375227825Stheraven 2376227825Stheraventemplate <class _Tp> 2377227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2378262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&&> 2379227825Stheraven#else 2380262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp> 2381227825Stheraven#endif 2382227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2383227825Stheraven{ 2384227825Stheraven}; 2385227825Stheraven 2386227825Stheraventemplate <class _Tp> 2387262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&> 2388227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2389227825Stheraven{ 2390227825Stheraven}; 2391227825Stheraven 2392227825Stheraventemplate <class _Tp> 2393262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&> 2394227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2395227825Stheraven{ 2396227825Stheraven}; 2397227825Stheraven 2398232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2399232950Stheraven 2400227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2401227825Stheraven 2402227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2403227825Stheraven class _A1 = __is_construct::__nat> 2404262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2405227825Stheraven : false_type 2406227825Stheraven{ 2407227825Stheraven}; 2408227825Stheraven 2409232950Stheraven#if __has_feature(is_trivially_constructible) 2410232950Stheraven 2411227825Stheraventemplate <class _Tp> 2412262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, 2413227825Stheraven __is_construct::__nat> 2414232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp)> 2415232950Stheraven{ 2416232950Stheraven}; 2417232950Stheraven 2418232950Stheraventemplate <class _Tp> 2419262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp, 2420232950Stheraven __is_construct::__nat> 2421232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)> 2422232950Stheraven{ 2423232950Stheraven}; 2424232950Stheraven 2425232950Stheraventemplate <class _Tp> 2426262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&, 2427232950Stheraven __is_construct::__nat> 2428232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)> 2429232950Stheraven{ 2430232950Stheraven}; 2431232950Stheraven 2432232950Stheraventemplate <class _Tp> 2433262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&, 2434232950Stheraven __is_construct::__nat> 2435232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)> 2436232950Stheraven{ 2437232950Stheraven}; 2438232950Stheraven 2439232950Stheraven#else // !__has_feature(is_trivially_constructible) 2440232950Stheraven 2441232950Stheraventemplate <class _Tp> 2442262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, 2443232950Stheraven __is_construct::__nat> 2444227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2445227825Stheraven{ 2446227825Stheraven}; 2447227825Stheraven 2448227825Stheraventemplate <class _Tp> 2449262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp, 2450227825Stheraven __is_construct::__nat> 2451227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2452227825Stheraven{ 2453227825Stheraven}; 2454227825Stheraven 2455227825Stheraventemplate <class _Tp> 2456262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&, 2457227825Stheraven __is_construct::__nat> 2458227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2459227825Stheraven{ 2460227825Stheraven}; 2461227825Stheraven 2462227825Stheraventemplate <class _Tp> 2463262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&, 2464227825Stheraven __is_construct::__nat> 2465227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2466227825Stheraven{ 2467227825Stheraven}; 2468227825Stheraven 2469232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2470232950Stheraven 2471227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2472227825Stheraven 2473227825Stheraven// is_trivially_default_constructible 2474227825Stheraven 2475262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_default_constructible 2476227825Stheraven : public is_trivially_constructible<_Tp> 2477227825Stheraven {}; 2478227825Stheraven 2479227825Stheraven// is_trivially_copy_constructible 2480227825Stheraven 2481262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_constructible 2482262801Sdim : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type> 2483227825Stheraven {}; 2484227825Stheraven 2485227825Stheraven// is_trivially_move_constructible 2486227825Stheraven 2487262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructible 2488227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2489227825Stheraven : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2490227825Stheraven#else 2491227825Stheraven : public is_trivially_copy_constructible<_Tp> 2492227825Stheraven#endif 2493227825Stheraven {}; 2494227825Stheraven 2495227825Stheraven// is_trivially_assignable 2496227825Stheraven 2497232950Stheraven#if __has_feature(is_trivially_constructible) 2498232950Stheraven 2499227825Stheraventemplate <class _Tp, class _Arg> 2500227825Stheravenstruct is_trivially_assignable 2501232950Stheraven : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> 2502232950Stheraven{ 2503232950Stheraven}; 2504232950Stheraven 2505232950Stheraven#else // !__has_feature(is_trivially_constructible) 2506232950Stheraven 2507232950Stheraventemplate <class _Tp, class _Arg> 2508232950Stheravenstruct is_trivially_assignable 2509227825Stheraven : public false_type {}; 2510227825Stheraven 2511227825Stheraventemplate <class _Tp> 2512227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp> 2513227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2514227825Stheraven 2515227825Stheraventemplate <class _Tp> 2516227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp&> 2517227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2518227825Stheraven 2519227825Stheraventemplate <class _Tp> 2520227825Stheravenstruct is_trivially_assignable<_Tp&, const _Tp&> 2521227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2522227825Stheraven 2523227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2524227825Stheraven 2525227825Stheraventemplate <class _Tp> 2526227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp&&> 2527227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2528227825Stheraven 2529227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2530227825Stheraven 2531232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2532232950Stheraven 2533227825Stheraven// is_trivially_copy_assignable 2534227825Stheraven 2535262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_assignable 2536227825Stheraven : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2537227825Stheraven const typename add_lvalue_reference<_Tp>::type> 2538227825Stheraven {}; 2539227825Stheraven 2540227825Stheraven// is_trivially_move_assignable 2541227825Stheraven 2542262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable 2543227825Stheraven : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2544227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2545227825Stheraven typename add_rvalue_reference<_Tp>::type> 2546227825Stheraven#else 2547227825Stheraven typename add_lvalue_reference<_Tp>::type> 2548227825Stheraven#endif 2549227825Stheraven {}; 2550227825Stheraven 2551227825Stheraven// is_trivially_destructible 2552227825Stheraven 2553227825Stheraven#if __has_feature(has_trivial_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2554227825Stheraven 2555262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible 2556227825Stheraven : public integral_constant<bool, __has_trivial_destructor(_Tp)> {}; 2557227825Stheraven 2558227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 2559227825Stheraven 2560227825Stheraventemplate <class _Tp> struct __libcpp_trivial_destructor 2561227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 2562227825Stheraven is_reference<_Tp>::value> {}; 2563227825Stheraven 2564262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible 2565227825Stheraven : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {}; 2566227825Stheraven 2567227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 2568227825Stheraven 2569227825Stheraven// is_nothrow_constructible 2570227825Stheraven 2571275472Sdim#if 0 2572275472Sdimtemplate <class _Tp, class... _Args> 2573275472Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2574275472Sdim : public integral_constant<bool, __is_nothrow_constructible(_Tp(_Args...))> 2575275472Sdim{ 2576275472Sdim}; 2577275472Sdim 2578275472Sdim#else 2579275472Sdim 2580227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2581227825Stheraven 2582227825Stheraven#if __has_feature(cxx_noexcept) 2583227825Stheraven 2584227825Stheraventemplate <bool, class _Tp, class... _Args> struct __is_nothrow_constructible; 2585227825Stheraven 2586227825Stheraventemplate <class _Tp, class... _Args> 2587227825Stheravenstruct __is_nothrow_constructible<true, _Tp, _Args...> 2588227825Stheraven : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> 2589227825Stheraven{ 2590227825Stheraven}; 2591227825Stheraven 2592227825Stheraventemplate <class _Tp, class... _Args> 2593227825Stheravenstruct __is_nothrow_constructible<false, _Tp, _Args...> 2594227825Stheraven : public false_type 2595227825Stheraven{ 2596227825Stheraven}; 2597227825Stheraven 2598227825Stheraventemplate <class _Tp, class... _Args> 2599262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2600227825Stheraven : __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...> 2601227825Stheraven{ 2602227825Stheraven}; 2603227825Stheraven 2604227825Stheraventemplate <class _Tp, size_t _Ns> 2605262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]> 2606227825Stheraven : __is_nothrow_constructible<is_constructible<_Tp>::value, _Tp> 2607227825Stheraven{ 2608227825Stheraven}; 2609227825Stheraven 2610227825Stheraven#else // __has_feature(cxx_noexcept) 2611227825Stheraven 2612227825Stheraventemplate <class _Tp, class... _Args> 2613262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2614227825Stheraven : false_type 2615227825Stheraven{ 2616227825Stheraven}; 2617227825Stheraven 2618227825Stheraventemplate <class _Tp> 2619262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp> 2620227825Stheraven#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2621227825Stheraven : integral_constant<bool, __has_nothrow_constructor(_Tp)> 2622227825Stheraven#else 2623227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2624227825Stheraven#endif 2625227825Stheraven{ 2626227825Stheraven}; 2627227825Stheraven 2628227825Stheraventemplate <class _Tp> 2629227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2630262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&&> 2631227825Stheraven#else 2632262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp> 2633227825Stheraven#endif 2634227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2635227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2636227825Stheraven#else 2637227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2638227825Stheraven#endif 2639227825Stheraven{ 2640227825Stheraven}; 2641227825Stheraven 2642227825Stheraventemplate <class _Tp> 2643262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&> 2644227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2645227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2646227825Stheraven#else 2647227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2648227825Stheraven#endif 2649227825Stheraven{ 2650227825Stheraven}; 2651227825Stheraven 2652227825Stheraventemplate <class _Tp> 2653262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&> 2654227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2655227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2656227825Stheraven#else 2657227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2658227825Stheraven#endif 2659227825Stheraven{ 2660227825Stheraven}; 2661227825Stheraven 2662227825Stheraven#endif // __has_feature(cxx_noexcept) 2663227825Stheraven 2664227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2665227825Stheraven 2666227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2667227825Stheraven class _A1 = __is_construct::__nat> 2668262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2669227825Stheraven : false_type 2670227825Stheraven{ 2671227825Stheraven}; 2672227825Stheraven 2673227825Stheraventemplate <class _Tp> 2674262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat, 2675227825Stheraven __is_construct::__nat> 2676227825Stheraven#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2677227825Stheraven : integral_constant<bool, __has_nothrow_constructor(_Tp)> 2678227825Stheraven#else 2679227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2680227825Stheraven#endif 2681227825Stheraven{ 2682227825Stheraven}; 2683227825Stheraven 2684227825Stheraventemplate <class _Tp> 2685262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp, 2686227825Stheraven __is_construct::__nat> 2687227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2688227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2689227825Stheraven#else 2690227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2691227825Stheraven#endif 2692227825Stheraven{ 2693227825Stheraven}; 2694227825Stheraven 2695227825Stheraventemplate <class _Tp> 2696262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&, 2697227825Stheraven __is_construct::__nat> 2698227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2699227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2700227825Stheraven#else 2701227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2702227825Stheraven#endif 2703227825Stheraven{ 2704227825Stheraven}; 2705227825Stheraven 2706227825Stheraventemplate <class _Tp> 2707262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&, 2708227825Stheraven __is_construct::__nat> 2709227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2710227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2711227825Stheraven#else 2712227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2713227825Stheraven#endif 2714227825Stheraven{ 2715227825Stheraven}; 2716227825Stheraven 2717227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2718275472Sdim#endif // __has_feature(is_nothrow_constructible) 2719227825Stheraven 2720227825Stheraven// is_nothrow_default_constructible 2721227825Stheraven 2722262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_default_constructible 2723227825Stheraven : public is_nothrow_constructible<_Tp> 2724227825Stheraven {}; 2725227825Stheraven 2726227825Stheraven// is_nothrow_copy_constructible 2727227825Stheraven 2728262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_constructible 2729227825Stheraven : public is_nothrow_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> 2730227825Stheraven {}; 2731227825Stheraven 2732227825Stheraven// is_nothrow_move_constructible 2733227825Stheraven 2734262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible 2735227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2736227825Stheraven : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2737227825Stheraven#else 2738227825Stheraven : public is_nothrow_copy_constructible<_Tp> 2739227825Stheraven#endif 2740227825Stheraven {}; 2741227825Stheraven 2742227825Stheraven// is_nothrow_assignable 2743227825Stheraven 2744227825Stheraven#if __has_feature(cxx_noexcept) 2745227825Stheraven 2746227825Stheraventemplate <bool, class _Tp, class _Arg> struct __is_nothrow_assignable; 2747227825Stheraven 2748227825Stheraventemplate <class _Tp, class _Arg> 2749227825Stheravenstruct __is_nothrow_assignable<false, _Tp, _Arg> 2750227825Stheraven : public false_type 2751227825Stheraven{ 2752227825Stheraven}; 2753227825Stheraven 2754227825Stheraventemplate <class _Tp, class _Arg> 2755227825Stheravenstruct __is_nothrow_assignable<true, _Tp, _Arg> 2756227825Stheraven : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) > 2757227825Stheraven{ 2758227825Stheraven}; 2759227825Stheraven 2760227825Stheraventemplate <class _Tp, class _Arg> 2761262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable 2762227825Stheraven : public __is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg> 2763227825Stheraven{ 2764227825Stheraven}; 2765227825Stheraven 2766227825Stheraven#else // __has_feature(cxx_noexcept) 2767227825Stheraven 2768227825Stheraventemplate <class _Tp, class _Arg> 2769262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable 2770227825Stheraven : public false_type {}; 2771227825Stheraven 2772227825Stheraventemplate <class _Tp> 2773262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp> 2774227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2775227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2776227825Stheraven#else 2777227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2778227825Stheraven#endif 2779227825Stheraven 2780227825Stheraventemplate <class _Tp> 2781262801Sdimstruct _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> 2789262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _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 2796227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2797227825Stheraven 2798227825Stheraventemplate <class _Tp> 2799227825Stheravenstruct is_nothrow_assignable<_Tp&, _Tp&&> 2800227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2801227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2802227825Stheraven#else 2803227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2804227825Stheraven#endif 2805227825Stheraven 2806227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2807227825Stheraven 2808227825Stheraven#endif // __has_feature(cxx_noexcept) 2809227825Stheraven 2810227825Stheraven// is_nothrow_copy_assignable 2811227825Stheraven 2812262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable 2813227825Stheraven : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 2814227825Stheraven const typename add_lvalue_reference<_Tp>::type> 2815227825Stheraven {}; 2816227825Stheraven 2817227825Stheraven// is_nothrow_move_assignable 2818227825Stheraven 2819262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable 2820227825Stheraven : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 2821227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2822227825Stheraven typename add_rvalue_reference<_Tp>::type> 2823227825Stheraven#else 2824227825Stheraven typename add_lvalue_reference<_Tp>::type> 2825227825Stheraven#endif 2826227825Stheraven {}; 2827227825Stheraven 2828227825Stheraven// is_nothrow_destructible 2829227825Stheraven 2830227825Stheraven#if __has_feature(cxx_noexcept) 2831227825Stheraven 2832227825Stheraventemplate <bool, class _Tp> struct __is_nothrow_destructible; 2833227825Stheraven 2834227825Stheraventemplate <class _Tp> 2835227825Stheravenstruct __is_nothrow_destructible<false, _Tp> 2836227825Stheraven : public false_type 2837227825Stheraven{ 2838227825Stheraven}; 2839227825Stheraven 2840227825Stheraventemplate <class _Tp> 2841227825Stheravenstruct __is_nothrow_destructible<true, _Tp> 2842227825Stheraven : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) > 2843227825Stheraven{ 2844227825Stheraven}; 2845227825Stheraven 2846227825Stheraventemplate <class _Tp> 2847262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible 2848227825Stheraven : public __is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> 2849227825Stheraven{ 2850227825Stheraven}; 2851227825Stheraven 2852227825Stheraventemplate <class _Tp, size_t _Ns> 2853262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[_Ns]> 2854227825Stheraven : public is_nothrow_destructible<_Tp> 2855227825Stheraven{ 2856227825Stheraven}; 2857227825Stheraven 2858227825Stheraventemplate <class _Tp> 2859262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&> 2860227825Stheraven : public true_type 2861227825Stheraven{ 2862227825Stheraven}; 2863227825Stheraven 2864227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2865227825Stheraven 2866227825Stheraventemplate <class _Tp> 2867262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&&> 2868227825Stheraven : public true_type 2869227825Stheraven{ 2870227825Stheraven}; 2871227825Stheraven 2872227825Stheraven#endif 2873227825Stheraven 2874227825Stheraven#else 2875227825Stheraven 2876227825Stheraventemplate <class _Tp> struct __libcpp_nothrow_destructor 2877227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 2878227825Stheraven is_reference<_Tp>::value> {}; 2879227825Stheraven 2880262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible 2881227825Stheraven : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {}; 2882227825Stheraven 2883227825Stheraven#endif 2884227825Stheraven 2885227825Stheraven// is_pod 2886227825Stheraven 2887227825Stheraven#if __has_feature(is_pod) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2888227825Stheraven 2889262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod 2890227825Stheraven : public integral_constant<bool, __is_pod(_Tp)> {}; 2891227825Stheraven 2892227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 2893227825Stheraven 2894262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod 2895227825Stheraven : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value && 2896227825Stheraven is_trivially_copy_constructible<_Tp>::value && 2897227825Stheraven is_trivially_copy_assignable<_Tp>::value && 2898227825Stheraven is_trivially_destructible<_Tp>::value> {}; 2899227825Stheraven 2900227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 2901227825Stheraven 2902227825Stheraven// is_literal_type; 2903227825Stheraven 2904262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type 2905227825Stheraven#if __has_feature(is_literal) 2906227825Stheraven : public integral_constant<bool, __is_literal(_Tp)> 2907227825Stheraven#else 2908227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value || 2909227825Stheraven is_reference<typename remove_all_extents<_Tp>::type>::value> 2910227825Stheraven#endif 2911227825Stheraven {}; 2912227825Stheraven 2913227825Stheraven// is_standard_layout; 2914227825Stheraven 2915262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout 2916227825Stheraven#if __has_feature(is_standard_layout) 2917227825Stheraven : public integral_constant<bool, __is_standard_layout(_Tp)> 2918227825Stheraven#else 2919227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 2920227825Stheraven#endif 2921227825Stheraven {}; 2922227825Stheraven 2923227825Stheraven// is_trivially_copyable; 2924227825Stheraven 2925262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable 2926227825Stheraven#if __has_feature(is_trivially_copyable) 2927227825Stheraven : public integral_constant<bool, __is_trivially_copyable(_Tp)> 2928227825Stheraven#else 2929227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 2930227825Stheraven#endif 2931227825Stheraven {}; 2932227825Stheraven 2933227825Stheraven// is_trivial; 2934227825Stheraven 2935262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial 2936227825Stheraven#if __has_feature(is_trivial) 2937227825Stheraven : public integral_constant<bool, __is_trivial(_Tp)> 2938227825Stheraven#else 2939227825Stheraven : integral_constant<bool, is_trivially_copyable<_Tp>::value && 2940227825Stheraven is_trivially_default_constructible<_Tp>::value> 2941227825Stheraven#endif 2942227825Stheraven {}; 2943227825Stheraven 2944227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2945227825Stheraven 2946227825Stheraven// Check for complete types 2947227825Stheraven 2948232950Stheraventemplate <class ..._Tp> struct __check_complete; 2949227825Stheraven 2950227825Stheraventemplate <> 2951227825Stheravenstruct __check_complete<> 2952227825Stheraven{ 2953227825Stheraven}; 2954227825Stheraven 2955232950Stheraventemplate <class _Hp, class _T0, class ..._Tp> 2956232950Stheravenstruct __check_complete<_Hp, _T0, _Tp...> 2957232950Stheraven : private __check_complete<_Hp>, 2958232950Stheraven private __check_complete<_T0, _Tp...> 2959227825Stheraven{ 2960227825Stheraven}; 2961227825Stheraven 2962232950Stheraventemplate <class _Hp> 2963232950Stheravenstruct __check_complete<_Hp, _Hp> 2964232950Stheraven : private __check_complete<_Hp> 2965227825Stheraven{ 2966227825Stheraven}; 2967227825Stheraven 2968232950Stheraventemplate <class _Tp> 2969232950Stheravenstruct __check_complete<_Tp> 2970227825Stheraven{ 2971232950Stheraven static_assert(sizeof(_Tp) > 0, "Type must be complete."); 2972227825Stheraven}; 2973227825Stheraven 2974232950Stheraventemplate <class _Tp> 2975232950Stheravenstruct __check_complete<_Tp&> 2976232950Stheraven : private __check_complete<_Tp> 2977227825Stheraven{ 2978227825Stheraven}; 2979227825Stheraven 2980232950Stheraventemplate <class _Tp> 2981232950Stheravenstruct __check_complete<_Tp&&> 2982232950Stheraven : private __check_complete<_Tp> 2983227825Stheraven{ 2984227825Stheraven}; 2985227825Stheraven 2986232950Stheraventemplate <class _Rp, class ..._Param> 2987232950Stheravenstruct __check_complete<_Rp (*)(_Param...)> 2988241903Sdim : private __check_complete<_Rp> 2989227825Stheraven{ 2990227825Stheraven}; 2991227825Stheraven 2992262801Sdimtemplate <class ..._Param> 2993262801Sdimstruct __check_complete<void (*)(_Param...)> 2994262801Sdim{ 2995262801Sdim}; 2996262801Sdim 2997232950Stheraventemplate <class _Rp, class ..._Param> 2998232950Stheravenstruct __check_complete<_Rp (_Param...)> 2999241903Sdim : private __check_complete<_Rp> 3000227825Stheraven{ 3001227825Stheraven}; 3002227825Stheraven 3003262801Sdimtemplate <class ..._Param> 3004262801Sdimstruct __check_complete<void (_Param...)> 3005262801Sdim{ 3006262801Sdim}; 3007262801Sdim 3008232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3009232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...)> 3010241903Sdim : private __check_complete<_Class> 3011227825Stheraven{ 3012227825Stheraven}; 3013227825Stheraven 3014232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3015232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const> 3016241903Sdim : private __check_complete<_Class> 3017227825Stheraven{ 3018227825Stheraven}; 3019227825Stheraven 3020232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3021232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile> 3022241903Sdim : private __check_complete<_Class> 3023227825Stheraven{ 3024227825Stheraven}; 3025227825Stheraven 3026232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3027232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile> 3028241903Sdim : private __check_complete<_Class> 3029227825Stheraven{ 3030227825Stheraven}; 3031227825Stheraven 3032227825Stheraven#if __has_feature(cxx_reference_qualified_functions) 3033227825Stheraven 3034232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3035232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) &> 3036241903Sdim : private __check_complete<_Class> 3037227825Stheraven{ 3038227825Stheraven}; 3039227825Stheraven 3040232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3041232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const&> 3042241903Sdim : private __check_complete<_Class> 3043227825Stheraven{ 3044227825Stheraven}; 3045227825Stheraven 3046232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3047232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile&> 3048241903Sdim : private __check_complete<_Class> 3049227825Stheraven{ 3050227825Stheraven}; 3051227825Stheraven 3052232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3053232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> 3054241903Sdim : private __check_complete<_Class> 3055227825Stheraven{ 3056227825Stheraven}; 3057227825Stheraven 3058232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3059232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) &&> 3060241903Sdim : private __check_complete<_Class> 3061227825Stheraven{ 3062227825Stheraven}; 3063227825Stheraven 3064232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3065232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const&&> 3066241903Sdim : private __check_complete<_Class> 3067227825Stheraven{ 3068227825Stheraven}; 3069227825Stheraven 3070232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3071232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> 3072241903Sdim : private __check_complete<_Class> 3073227825Stheraven{ 3074227825Stheraven}; 3075227825Stheraven 3076232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3077232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> 3078241903Sdim : private __check_complete<_Class> 3079227825Stheraven{ 3080227825Stheraven}; 3081227825Stheraven 3082227825Stheraven#endif 3083227825Stheraven 3084232950Stheraventemplate <class _Rp, class _Class> 3085232950Stheravenstruct __check_complete<_Rp _Class::*> 3086227825Stheraven : private __check_complete<_Class> 3087227825Stheraven{ 3088227825Stheraven}; 3089227825Stheraven 3090227825Stheraven// __invoke forward declarations 3091227825Stheraven 3092227825Stheraven// fall back - none of the bullets 3093227825Stheraven 3094227825Stheraventemplate <class ..._Args> 3095227825Stheravenauto 3096227825Stheraven__invoke(__any, _Args&& ...__args) 3097227825Stheraven -> __nat; 3098227825Stheraven 3099227825Stheraven// bullets 1 and 2 3100227825Stheraven 3101253159Stheraventemplate <class _Fp, class _A0, class ..._Args, 3102253159Stheraven class = typename enable_if 3103253159Stheraven < 3104253159Stheraven is_member_function_pointer<typename remove_reference<_Fp>::type>::value && 3105253159Stheraven is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3106253159Stheraven typename remove_reference<_A0>::type>::value 3107253159Stheraven >::type 3108253159Stheraven > 3109241903Sdim_LIBCPP_INLINE_VISIBILITY 3110227825Stheravenauto 3111232950Stheraven__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 3112227825Stheraven -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)); 3113227825Stheraven 3114253159Stheraventemplate <class _Fp, class _A0, class ..._Args, 3115253159Stheraven class = typename enable_if 3116253159Stheraven < 3117253159Stheraven is_member_function_pointer<typename remove_reference<_Fp>::type>::value && 3118253159Stheraven !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3119253159Stheraven typename remove_reference<_A0>::type>::value 3120253159Stheraven >::type 3121253159Stheraven > 3122241903Sdim_LIBCPP_INLINE_VISIBILITY 3123227825Stheravenauto 3124232950Stheraven__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 3125227825Stheraven -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)); 3126227825Stheraven 3127227825Stheraven// bullets 3 and 4 3128227825Stheraven 3129253159Stheraventemplate <class _Fp, class _A0, 3130253159Stheraven class = typename enable_if 3131253159Stheraven < 3132253159Stheraven is_member_object_pointer<typename remove_reference<_Fp>::type>::value && 3133253159Stheraven is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3134253159Stheraven typename remove_reference<_A0>::type>::value 3135253159Stheraven >::type 3136253159Stheraven > 3137241903Sdim_LIBCPP_INLINE_VISIBILITY 3138227825Stheravenauto 3139232950Stheraven__invoke(_Fp&& __f, _A0&& __a0) 3140227825Stheraven -> decltype(_VSTD::forward<_A0>(__a0).*__f); 3141227825Stheraven 3142253159Stheraventemplate <class _Fp, class _A0, 3143253159Stheraven class = typename enable_if 3144253159Stheraven < 3145253159Stheraven is_member_object_pointer<typename remove_reference<_Fp>::type>::value && 3146253159Stheraven !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3147253159Stheraven typename remove_reference<_A0>::type>::value 3148253159Stheraven >::type 3149253159Stheraven > 3150241903Sdim_LIBCPP_INLINE_VISIBILITY 3151227825Stheravenauto 3152232950Stheraven__invoke(_Fp&& __f, _A0&& __a0) 3153227825Stheraven -> decltype((*_VSTD::forward<_A0>(__a0)).*__f); 3154227825Stheraven 3155227825Stheraven// bullet 5 3156227825Stheraven 3157232950Stheraventemplate <class _Fp, class ..._Args> 3158241903Sdim_LIBCPP_INLINE_VISIBILITY 3159227825Stheravenauto 3160232950Stheraven__invoke(_Fp&& __f, _Args&& ...__args) 3161232950Stheraven -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)); 3162227825Stheraven 3163227825Stheraven// __invokable 3164227825Stheraven 3165232950Stheraventemplate <class _Fp, class ..._Args> 3166227825Stheravenstruct __invokable_imp 3167241903Sdim : private __check_complete<_Fp> 3168227825Stheraven{ 3169227825Stheraven typedef decltype( 3170232950Stheraven __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...) 3171227825Stheraven ) type; 3172227825Stheraven static const bool value = !is_same<type, __nat>::value; 3173227825Stheraven}; 3174227825Stheraven 3175232950Stheraventemplate <class _Fp, class ..._Args> 3176227825Stheravenstruct __invokable 3177227825Stheraven : public integral_constant<bool, 3178232950Stheraven __invokable_imp<_Fp, _Args...>::value> 3179227825Stheraven{ 3180227825Stheraven}; 3181227825Stheraven 3182227825Stheraven// __invoke_of 3183227825Stheraven 3184232950Stheraventemplate <bool _Invokable, class _Fp, class ..._Args> 3185227825Stheravenstruct __invoke_of_imp // false 3186227825Stheraven{ 3187227825Stheraven}; 3188227825Stheraven 3189232950Stheraventemplate <class _Fp, class ..._Args> 3190232950Stheravenstruct __invoke_of_imp<true, _Fp, _Args...> 3191227825Stheraven{ 3192232950Stheraven typedef typename __invokable_imp<_Fp, _Args...>::type type; 3193227825Stheraven}; 3194227825Stheraven 3195232950Stheraventemplate <class _Fp, class ..._Args> 3196227825Stheravenstruct __invoke_of 3197232950Stheraven : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...> 3198227825Stheraven{ 3199227825Stheraven}; 3200227825Stheraven 3201241903Sdimtemplate <class _Fp, class ..._Args> 3202262801Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fp(_Args...)> 3203241903Sdim : public __invoke_of<_Fp, _Args...> 3204241903Sdim{ 3205241903Sdim}; 3206241903Sdim 3207253159Stheraven#if _LIBCPP_STD_VER > 11 3208253159Stheraventemplate <class _Tp> using result_of_t = typename result_of<_Tp>::type; 3209253159Stheraven#endif 3210253159Stheraven 3211227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 3212227825Stheraven 3213227825Stheraventemplate <class _Tp> 3214227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3215227825Stheraven#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE 3216227825Stheraventypename enable_if 3217227825Stheraven< 3218227825Stheraven is_move_constructible<_Tp>::value && 3219227825Stheraven is_move_assignable<_Tp>::value 3220227825Stheraven>::type 3221227825Stheraven#else 3222227825Stheravenvoid 3223227825Stheraven#endif 3224227825Stheravenswap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && 3225227825Stheraven is_nothrow_move_assignable<_Tp>::value) 3226227825Stheraven{ 3227227825Stheraven _Tp __t(_VSTD::move(__x)); 3228227825Stheraven __x = _VSTD::move(__y); 3229227825Stheraven __y = _VSTD::move(__t); 3230227825Stheraven} 3231227825Stheraven 3232227825Stheraventemplate <class _ForwardIterator1, class _ForwardIterator2> 3233227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3234227825Stheravenvoid 3235227825Stheraveniter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) 3236227825Stheraven // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b))) 3237227825Stheraven _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(), 3238227825Stheraven *_VSTD::declval<_ForwardIterator2>()))) 3239227825Stheraven{ 3240227825Stheraven swap(*__a, *__b); 3241227825Stheraven} 3242227825Stheraven 3243227825Stheraven// __swappable 3244227825Stheraven 3245227825Stheravennamespace __detail 3246227825Stheraven{ 3247227825Stheraven 3248227825Stheravenusing _VSTD::swap; 3249227825Stheraven__nat swap(__any, __any); 3250227825Stheraven 3251227825Stheraventemplate <class _Tp> 3252227825Stheravenstruct __swappable 3253227825Stheraven{ 3254227825Stheraven typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type; 3255227825Stheraven static const bool value = !is_same<type, __nat>::value; 3256227825Stheraven}; 3257227825Stheraven 3258227825Stheraven} // __detail 3259227825Stheraven 3260227825Stheraventemplate <class _Tp> 3261227825Stheravenstruct __is_swappable 3262227825Stheraven : public integral_constant<bool, __detail::__swappable<_Tp>::value> 3263227825Stheraven{ 3264227825Stheraven}; 3265227825Stheraven 3266227825Stheraven#if __has_feature(cxx_noexcept) 3267227825Stheraven 3268227825Stheraventemplate <bool, class _Tp> 3269227825Stheravenstruct __is_nothrow_swappable_imp 3270227825Stheraven : public integral_constant<bool, noexcept(swap(_VSTD::declval<_Tp&>(), 3271227825Stheraven _VSTD::declval<_Tp&>()))> 3272227825Stheraven{ 3273227825Stheraven}; 3274227825Stheraven 3275227825Stheraventemplate <class _Tp> 3276227825Stheravenstruct __is_nothrow_swappable_imp<false, _Tp> 3277227825Stheraven : public false_type 3278227825Stheraven{ 3279227825Stheraven}; 3280227825Stheraven 3281227825Stheraventemplate <class _Tp> 3282227825Stheravenstruct __is_nothrow_swappable 3283227825Stheraven : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp> 3284227825Stheraven{ 3285227825Stheraven}; 3286227825Stheraven 3287227825Stheraven#else // __has_feature(cxx_noexcept) 3288227825Stheraven 3289227825Stheraventemplate <class _Tp> 3290227825Stheravenstruct __is_nothrow_swappable 3291227825Stheraven : public false_type 3292227825Stheraven{ 3293227825Stheraven}; 3294227825Stheraven 3295227825Stheraven#endif // __has_feature(cxx_noexcept) 3296227825Stheraven 3297227825Stheraven#ifdef _LIBCXX_UNDERLYING_TYPE 3298227825Stheraven 3299227825Stheraventemplate <class _Tp> 3300227825Stheravenstruct underlying_type 3301227825Stheraven{ 3302227825Stheraven typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type; 3303227825Stheraven}; 3304227825Stheraven 3305253159Stheraven#if _LIBCPP_STD_VER > 11 3306253159Stheraventemplate <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type; 3307253159Stheraven#endif 3308253159Stheraven 3309227825Stheraven#else // _LIBCXX_UNDERLYING_TYPE 3310227825Stheraven 3311227825Stheraventemplate <class _Tp, bool _Support = false> 3312227825Stheravenstruct underlying_type 3313227825Stheraven{ 3314227825Stheraven static_assert(_Support, "The underyling_type trait requires compiler " 3315227825Stheraven "support. Either no such support exists or " 3316227825Stheraven "libc++ does not know how to use it."); 3317227825Stheraven}; 3318227825Stheraven 3319227825Stheraven#endif // _LIBCXX_UNDERLYING_TYPE 3320227825Stheraven 3321262801Sdim#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE 3322262801Sdim 3323262801Sdimtemplate <class _Tp> 3324262801Sdimstruct __has_operator_addressof_imp 3325262801Sdim{ 3326262801Sdim template <class> 3327262801Sdim static auto __test(__any) -> false_type; 3328262801Sdim template <class _Up> 3329262801Sdim static auto __test(_Up* __u) 3330262801Sdim -> typename __select_2nd<decltype(__u->operator&()), true_type>::type; 3331262801Sdim 3332262801Sdim static const bool value = decltype(__test<_Tp>(nullptr))::value; 3333262801Sdim}; 3334262801Sdim 3335262801Sdimtemplate <class _Tp> 3336262801Sdimstruct __has_operator_addressof 3337262801Sdim : public integral_constant<bool, __has_operator_addressof_imp<_Tp>::value> 3338262801Sdim{}; 3339262801Sdim 3340262801Sdim#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE 3341262801Sdim 3342227825Stheraven_LIBCPP_END_NAMESPACE_STD 3343227825Stheraven 3344227825Stheraven#endif // _LIBCPP_TYPE_TRAITS 3345