type_traits revision 262801
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 304262801Sdim : public ____is_nullptr_t<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 442260263Sdimtemplate <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {}; 443260263Sdimtemplate <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {}; 444227825Stheraven 445262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer 446260263Sdim : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type> {}; 447227825Stheraven 448227825Stheraven// is_member_pointer 449227825Stheraven 450260263Sdimtemplate <class _Tp> struct __libcpp_is_member_pointer : public false_type {}; 451260263Sdimtemplate <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> : public true_type {}; 452227825Stheraven 453262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer 454260263Sdim : public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {}; 455227825Stheraven 456227825Stheraven// is_member_object_pointer 457227825Stheraven 458262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer 459227825Stheraven : public integral_constant<bool, is_member_pointer<_Tp>::value && 460227825Stheraven !is_member_function_pointer<_Tp>::value> {}; 461227825Stheraven 462227825Stheraven// is_enum 463227825Stheraven 464227825Stheraven#if __has_feature(is_enum) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 465227825Stheraven 466262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum 467227825Stheraven : public integral_constant<bool, __is_enum(_Tp)> {}; 468227825Stheraven 469227825Stheraven#else 470227825Stheraven 471262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum 472227825Stheraven : public integral_constant<bool, !is_void<_Tp>::value && 473227825Stheraven !is_integral<_Tp>::value && 474227825Stheraven !is_floating_point<_Tp>::value && 475227825Stheraven !is_array<_Tp>::value && 476227825Stheraven !is_pointer<_Tp>::value && 477227825Stheraven !is_reference<_Tp>::value && 478227825Stheraven !is_member_pointer<_Tp>::value && 479227825Stheraven !is_union<_Tp>::value && 480227825Stheraven !is_class<_Tp>::value && 481227825Stheraven !is_function<_Tp>::value > {}; 482227825Stheraven 483227825Stheraven#endif 484227825Stheraven 485227825Stheraven// is_arithmetic 486227825Stheraven 487262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_arithmetic 488227825Stheraven : public integral_constant<bool, is_integral<_Tp>::value || 489227825Stheraven is_floating_point<_Tp>::value> {}; 490227825Stheraven 491227825Stheraven// is_fundamental 492227825Stheraven 493262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental 494227825Stheraven : public integral_constant<bool, is_void<_Tp>::value || 495227825Stheraven __is_nullptr_t<_Tp>::value || 496227825Stheraven is_arithmetic<_Tp>::value> {}; 497227825Stheraven 498227825Stheraven// is_scalar 499227825Stheraven 500262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar 501227825Stheraven : public integral_constant<bool, is_arithmetic<_Tp>::value || 502227825Stheraven is_member_pointer<_Tp>::value || 503227825Stheraven is_pointer<_Tp>::value || 504227825Stheraven __is_nullptr_t<_Tp>::value || 505227825Stheraven is_enum<_Tp>::value > {}; 506227825Stheraven 507262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar<nullptr_t> : public true_type {}; 508227825Stheraven 509227825Stheraven// is_object 510227825Stheraven 511262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object 512227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 513227825Stheraven is_array<_Tp>::value || 514227825Stheraven is_union<_Tp>::value || 515227825Stheraven is_class<_Tp>::value > {}; 516227825Stheraven 517227825Stheraven// is_compound 518227825Stheraven 519262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_compound 520227825Stheraven : public integral_constant<bool, !is_fundamental<_Tp>::value> {}; 521227825Stheraven 522227825Stheraven// add_const 523227825Stheraven 524227825Stheraventemplate <class _Tp, bool = is_reference<_Tp>::value || 525227825Stheraven is_function<_Tp>::value || 526227825Stheraven is_const<_Tp>::value > 527227825Stheravenstruct __add_const {typedef _Tp type;}; 528227825Stheraven 529227825Stheraventemplate <class _Tp> 530227825Stheravenstruct __add_const<_Tp, false> {typedef const _Tp type;}; 531227825Stheraven 532262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_const 533227825Stheraven {typedef typename __add_const<_Tp>::type type;}; 534227825Stheraven 535253159Stheraven#if _LIBCPP_STD_VER > 11 536253159Stheraventemplate <class _Tp> using add_const_t = typename add_const<_Tp>::type; 537253159Stheraven#endif 538253159Stheraven 539227825Stheraven// add_volatile 540227825Stheraven 541227825Stheraventemplate <class _Tp, bool = is_reference<_Tp>::value || 542227825Stheraven is_function<_Tp>::value || 543227825Stheraven is_volatile<_Tp>::value > 544227825Stheravenstruct __add_volatile {typedef _Tp type;}; 545227825Stheraven 546227825Stheraventemplate <class _Tp> 547227825Stheravenstruct __add_volatile<_Tp, false> {typedef volatile _Tp type;}; 548227825Stheraven 549262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_volatile 550227825Stheraven {typedef typename __add_volatile<_Tp>::type type;}; 551227825Stheraven 552253159Stheraven#if _LIBCPP_STD_VER > 11 553253159Stheraventemplate <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type; 554253159Stheraven#endif 555253159Stheraven 556227825Stheraven// add_cv 557227825Stheraven 558262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_cv 559227825Stheraven {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;}; 560227825Stheraven 561253159Stheraven#if _LIBCPP_STD_VER > 11 562253159Stheraventemplate <class _Tp> using add_cv_t = typename add_cv<_Tp>::type; 563253159Stheraven#endif 564253159Stheraven 565227825Stheraven// remove_reference 566227825Stheraven 567262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference {typedef _Tp type;}; 568262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&> {typedef _Tp type;}; 569227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 570262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&&> {typedef _Tp type;}; 571227825Stheraven#endif 572227825Stheraven 573253159Stheraven#if _LIBCPP_STD_VER > 11 574253159Stheraventemplate <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type; 575253159Stheraven#endif 576253159Stheraven 577227825Stheraven// add_lvalue_reference 578227825Stheraven 579262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference {typedef _Tp& type;}; 580262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<_Tp&> {typedef _Tp& type;}; // for older compiler 581262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<void> {typedef void type;}; 582262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const void> {typedef const void type;}; 583262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<volatile void> {typedef volatile void type;}; 584262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const volatile void> {typedef const volatile void type;}; 585227825Stheraven 586253159Stheraven#if _LIBCPP_STD_VER > 11 587253159Stheraventemplate <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; 588253159Stheraven#endif 589253159Stheraven 590227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 591227825Stheraven 592262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference {typedef _Tp&& type;}; 593262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<void> {typedef void type;}; 594262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const void> {typedef const void type;}; 595262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<volatile void> {typedef volatile void type;}; 596262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const volatile void> {typedef const volatile void type;}; 597227825Stheraven 598253159Stheraven#if _LIBCPP_STD_VER > 11 599253159Stheraventemplate <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; 600253159Stheraven#endif 601253159Stheraven 602227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 603227825Stheraven 604227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 605227825Stheraven 606227825Stheraventemplate <class _Tp> 607227825Stheraventypename add_rvalue_reference<_Tp>::type 608227825Stheravendeclval() _NOEXCEPT; 609227825Stheraven 610227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 611227825Stheraven 612227825Stheraventemplate <class _Tp> 613227825Stheraventypename add_lvalue_reference<_Tp>::type 614227825Stheravendeclval(); 615227825Stheraven 616227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 617227825Stheraven 618227825Stheravenstruct __any 619227825Stheraven{ 620227825Stheraven __any(...); 621227825Stheraven}; 622227825Stheraven 623227825Stheraven// remove_pointer 624227825Stheraven 625262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer {typedef _Tp type;}; 626262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp*> {typedef _Tp type;}; 627262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const> {typedef _Tp type;}; 628262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* volatile> {typedef _Tp type;}; 629262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const volatile> {typedef _Tp type;}; 630227825Stheraven 631253159Stheraven#if _LIBCPP_STD_VER > 11 632253159Stheraventemplate <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type; 633253159Stheraven#endif 634253159Stheraven 635227825Stheraven// add_pointer 636227825Stheraven 637262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_pointer 638227825Stheraven {typedef typename remove_reference<_Tp>::type* type;}; 639227825Stheraven 640253159Stheraven#if _LIBCPP_STD_VER > 11 641253159Stheraventemplate <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; 642253159Stheraven#endif 643253159Stheraven 644227825Stheraven// is_signed 645227825Stheraven 646227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value> 647227825Stheravenstruct ___is_signed : public integral_constant<bool, _Tp(-1) < _Tp(0)> {}; 648227825Stheraven 649227825Stheraventemplate <class _Tp> 650227825Stheravenstruct ___is_signed<_Tp, false> : public true_type {}; // floating point 651227825Stheraven 652227825Stheraventemplate <class _Tp, bool = is_arithmetic<_Tp>::value> 653260263Sdimstruct __libcpp_is_signed : public ___is_signed<_Tp> {}; 654227825Stheraven 655260263Sdimtemplate <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {}; 656227825Stheraven 657262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {}; 658227825Stheraven 659227825Stheraven// is_unsigned 660227825Stheraven 661227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value> 662227825Stheravenstruct ___is_unsigned : public integral_constant<bool, _Tp(0) < _Tp(-1)> {}; 663227825Stheraven 664227825Stheraventemplate <class _Tp> 665227825Stheravenstruct ___is_unsigned<_Tp, false> : public false_type {}; // floating point 666227825Stheraven 667227825Stheraventemplate <class _Tp, bool = is_arithmetic<_Tp>::value> 668260263Sdimstruct __libcpp_is_unsigned : public ___is_unsigned<_Tp> {}; 669227825Stheraven 670260263Sdimtemplate <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {}; 671227825Stheraven 672262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {}; 673227825Stheraven 674227825Stheraven// rank 675227825Stheraven 676262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank 677227825Stheraven : public integral_constant<size_t, 0> {}; 678262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[]> 679227825Stheraven : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 680262801Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[_Np]> 681227825Stheraven : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 682227825Stheraven 683227825Stheraven// extent 684227825Stheraven 685262801Sdimtemplate <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TYPE_VIS_ONLY extent 686227825Stheraven : public integral_constant<size_t, 0> {}; 687262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], 0> 688227825Stheraven : public integral_constant<size_t, 0> {}; 689262801Sdimtemplate <class _Tp, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], _Ip> 690227825Stheraven : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 691262801Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], 0> 692227825Stheraven : public integral_constant<size_t, _Np> {}; 693262801Sdimtemplate <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], _Ip> 694227825Stheraven : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 695227825Stheraven 696227825Stheraven// remove_extent 697227825Stheraven 698262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent 699227825Stheraven {typedef _Tp type;}; 700262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[]> 701227825Stheraven {typedef _Tp type;}; 702262801Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[_Np]> 703227825Stheraven {typedef _Tp type;}; 704227825Stheraven 705253159Stheraven#if _LIBCPP_STD_VER > 11 706253159Stheraventemplate <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type; 707253159Stheraven#endif 708253159Stheraven 709227825Stheraven// remove_all_extents 710227825Stheraven 711262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents 712227825Stheraven {typedef _Tp type;}; 713262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[]> 714227825Stheraven {typedef typename remove_all_extents<_Tp>::type type;}; 715262801Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[_Np]> 716227825Stheraven {typedef typename remove_all_extents<_Tp>::type type;}; 717227825Stheraven 718253159Stheraven#if _LIBCPP_STD_VER > 11 719253159Stheraventemplate <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type; 720253159Stheraven#endif 721253159Stheraven 722262801Sdim// decay 723262801Sdim 724262801Sdimtemplate <class _Tp> 725262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY decay 726262801Sdim{ 727262801Sdimprivate: 728262801Sdim typedef typename remove_reference<_Tp>::type _Up; 729262801Sdimpublic: 730262801Sdim typedef typename conditional 731262801Sdim < 732262801Sdim is_array<_Up>::value, 733262801Sdim typename remove_extent<_Up>::type*, 734262801Sdim typename conditional 735262801Sdim < 736262801Sdim is_function<_Up>::value, 737262801Sdim typename add_pointer<_Up>::type, 738262801Sdim typename remove_cv<_Up>::type 739262801Sdim >::type 740262801Sdim >::type type; 741262801Sdim}; 742262801Sdim 743262801Sdim#if _LIBCPP_STD_VER > 11 744262801Sdimtemplate <class _Tp> using decay_t = typename decay<_Tp>::type; 745262801Sdim#endif 746262801Sdim 747227825Stheraven// is_abstract 748227825Stheraven 749227825Stheravennamespace __is_abstract_imp 750227825Stheraven{ 751227825Stheraventemplate <class _Tp> char __test(_Tp (*)[1]); 752227825Stheraventemplate <class _Tp> __two __test(...); 753227825Stheraven} 754227825Stheraven 755227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value> 756227825Stheravenstruct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {}; 757227825Stheraven 758227825Stheraventemplate <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {}; 759227825Stheraven 760262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {}; 761227825Stheraven 762241903Sdim// is_base_of 763241903Sdim 764262801Sdim#ifdef _LIBCPP_HAS_IS_BASE_OF 765241903Sdim 766241903Sdimtemplate <class _Bp, class _Dp> 767262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_base_of 768241903Sdim : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; 769241903Sdim 770241903Sdim#else // __has_feature(is_base_of) 771241903Sdim 772246487Stheravennamespace __is_base_of_imp 773246487Stheraven{ 774246487Stheraventemplate <class _Tp> 775246487Stheravenstruct _Dst 776246487Stheraven{ 777246487Stheraven _Dst(const volatile _Tp &); 778246487Stheraven}; 779246487Stheraventemplate <class _Tp> 780246487Stheravenstruct _Src 781246487Stheraven{ 782246487Stheraven operator const volatile _Tp &(); 783246487Stheraven template <class _Up> operator const _Dst<_Up> &(); 784246487Stheraven}; 785246487Stheraventemplate <size_t> struct __one { typedef char type; }; 786246487Stheraventemplate <class _Bp, class _Dp> typename __one<sizeof(_Dst<_Bp>(declval<_Src<_Dp> >()))>::type __test(int); 787246487Stheraventemplate <class _Bp, class _Dp> __two __test(...); 788246487Stheraven} 789241903Sdim 790246487Stheraventemplate <class _Bp, class _Dp> 791262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_base_of 792246487Stheraven : public integral_constant<bool, is_class<_Bp>::value && 793246487Stheraven sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {}; 794246487Stheraven 795241903Sdim#endif // __has_feature(is_base_of) 796241903Sdim 797227825Stheraven// is_convertible 798227825Stheraven 799227825Stheraven#if __has_feature(is_convertible_to) 800227825Stheraven 801262801Sdimtemplate <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible 802241903Sdim : public integral_constant<bool, __is_convertible_to(_T1, _T2) && 803241903Sdim !is_abstract<_T2>::value> {}; 804227825Stheraven 805227825Stheraven#else // __has_feature(is_convertible_to) 806227825Stheraven 807227825Stheravennamespace __is_convertible_imp 808227825Stheraven{ 809227825Stheraventemplate <class _Tp> char __test(_Tp); 810227825Stheraventemplate <class _Tp> __two __test(...); 811227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 812227825Stheraventemplate <class _Tp> _Tp&& __source(); 813227825Stheraven#else 814227825Stheraventemplate <class _Tp> typename remove_reference<_Tp>::type& __source(); 815227825Stheraven#endif 816227825Stheraven 817227825Stheraventemplate <class _Tp, bool _IsArray = is_array<_Tp>::value, 818227825Stheraven bool _IsFunction = is_function<_Tp>::value, 819227825Stheraven bool _IsVoid = is_void<_Tp>::value> 820227825Stheraven struct __is_array_function_or_void {enum {value = 0};}; 821227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};}; 822227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};}; 823227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};}; 824227825Stheraven} 825227825Stheraven 826227825Stheraventemplate <class _Tp, 827227825Stheraven unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value> 828227825Stheravenstruct __is_convertible_check 829227825Stheraven{ 830227825Stheraven static const size_t __v = 0; 831227825Stheraven}; 832227825Stheraven 833227825Stheraventemplate <class _Tp> 834227825Stheravenstruct __is_convertible_check<_Tp, 0> 835227825Stheraven{ 836227825Stheraven static const size_t __v = sizeof(_Tp); 837227825Stheraven}; 838227825Stheraven 839227825Stheraventemplate <class _T1, class _T2, 840227825Stheraven unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value, 841227825Stheraven unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value> 842227825Stheravenstruct __is_convertible 843227825Stheraven : public integral_constant<bool, 844241903Sdim#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 845227825Stheraven sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 846241903Sdim#else 847241903Sdim sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 848241903Sdim && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value 849241903Sdim && (!is_const<typename remove_reference<_T2>::type>::value 850241903Sdim || is_volatile<typename remove_reference<_T2>::type>::value) 851241903Sdim && (is_same<typename remove_cv<_T1>::type, 852241903Sdim typename remove_cv<typename remove_reference<_T2>::type>::type>::value 853241903Sdim || is_base_of<typename remove_reference<_T2>::type, _T1>::value)) 854241903Sdim#endif 855227825Stheraven > 856227825Stheraven{}; 857227825Stheraven 858227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {}; 859227825Stheraven 860227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {}; 861227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 862227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {}; 863227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {}; 864227825Stheraventemplate <class _T1> struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {}; 865227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {}; 866227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 867227825Stheraven 868227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2*, 1, 0> 869227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*>::value> {}; 870227825Stheraven 871227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* const, 1, 0> 872227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const>::value> {}; 873227825Stheraven 874227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* volatile, 1, 0> 875227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*volatile>::value> {}; 876227825Stheraven 877227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* const volatile, 1, 0> 878227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const volatile>::value> {}; 879227825Stheraven 880227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0> : public false_type {}; 881227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 882227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1&&, 2, 0> : public true_type {}; 883227825Stheraven#endif 884241903Sdimtemplate <class _T1> struct __is_convertible<_T1, _T1&, 2, 0> : public true_type {}; 885227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*, 2, 0> : public true_type {}; 886227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*const, 2, 0> : public true_type {}; 887227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {}; 888227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {}; 889227825Stheraven 890227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 0> : public false_type {}; 891227825Stheraven 892227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {}; 893227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {}; 894227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {}; 895227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {}; 896227825Stheraven 897227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {}; 898227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {}; 899227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {}; 900227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {}; 901227825Stheraven 902227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {}; 903227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {}; 904227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {}; 905227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {}; 906227825Stheraven 907262801Sdimtemplate <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible 908227825Stheraven : public __is_convertible<_T1, _T2> 909227825Stheraven{ 910227825Stheraven static const size_t __complete_check1 = __is_convertible_check<_T1>::__v; 911227825Stheraven static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; 912227825Stheraven}; 913227825Stheraven 914227825Stheraven#endif // __has_feature(is_convertible_to) 915227825Stheraven 916227825Stheraven// is_empty 917227825Stheraven 918232950Stheraven#if __has_feature(is_empty) 919232950Stheraven 920227825Stheraventemplate <class _Tp> 921262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_empty 922232950Stheraven : public integral_constant<bool, __is_empty(_Tp)> {}; 923232950Stheraven 924232950Stheraven#else // __has_feature(is_empty) 925232950Stheraven 926232950Stheraventemplate <class _Tp> 927227825Stheravenstruct __is_empty1 928227825Stheraven : public _Tp 929227825Stheraven{ 930242945Stheraven double __lx; 931227825Stheraven}; 932227825Stheraven 933227825Stheravenstruct __is_empty2 934227825Stheraven{ 935242945Stheraven double __lx; 936227825Stheraven}; 937227825Stheraven 938227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value> 939227825Stheravenstruct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {}; 940227825Stheraven 941227825Stheraventemplate <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {}; 942227825Stheraven 943262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_empty : public __libcpp_empty<_Tp> {}; 944227825Stheraven 945232950Stheraven#endif // __has_feature(is_empty) 946232950Stheraven 947227825Stheraven// is_polymorphic 948227825Stheraven 949232950Stheraven#if __has_feature(is_polymorphic) 950232950Stheraven 951232950Stheraventemplate <class _Tp> 952262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_polymorphic 953232950Stheraven : public integral_constant<bool, __is_polymorphic(_Tp)> {}; 954232950Stheraven 955232950Stheraven#else 956232950Stheraven 957249998Sdimtemplate<typename _Tp> char &__is_polymorphic_impl( 958249998Sdim typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0, 959249998Sdim int>::type); 960249998Sdimtemplate<typename _Tp> __two &__is_polymorphic_impl(...); 961227825Stheraven 962262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic 963249998Sdim : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {}; 964227825Stheraven 965232950Stheraven#endif // __has_feature(is_polymorphic) 966232950Stheraven 967227825Stheraven// has_virtual_destructor 968227825Stheraven 969227825Stheraven#if __has_feature(has_virtual_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 970227825Stheraven 971262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor 972227825Stheraven : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; 973227825Stheraven 974227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 975227825Stheraven 976262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor 977227825Stheraven : public false_type {}; 978227825Stheraven 979227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 980227825Stheraven 981227825Stheraven// alignment_of 982227825Stheraven 983262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY alignment_of 984249998Sdim : public integral_constant<size_t, __alignof__(_Tp)> {}; 985227825Stheraven 986227825Stheraven// aligned_storage 987227825Stheraven 988227825Stheraventemplate <class _Hp, class _Tp> 989227825Stheravenstruct __type_list 990227825Stheraven{ 991227825Stheraven typedef _Hp _Head; 992227825Stheraven typedef _Tp _Tail; 993227825Stheraven}; 994227825Stheraven 995227825Stheravenstruct __nat 996227825Stheraven{ 997227825Stheraven#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS 998227825Stheraven __nat() = delete; 999227825Stheraven __nat(const __nat&) = delete; 1000227825Stheraven __nat& operator=(const __nat&) = delete; 1001227825Stheraven ~__nat() = delete; 1002227825Stheraven#endif 1003227825Stheraven}; 1004227825Stheraven 1005227825Stheraventemplate <class _Tp> 1006227825Stheravenstruct __align_type 1007227825Stheraven{ 1008227825Stheraven static const size_t value = alignment_of<_Tp>::value; 1009227825Stheraven typedef _Tp type; 1010227825Stheraven}; 1011227825Stheraven 1012242945Stheravenstruct __struct_double {long double __lx;}; 1013242945Stheravenstruct __struct_double4 {double __lx[4];}; 1014227825Stheraven 1015227825Stheraventypedef 1016227825Stheraven __type_list<__align_type<unsigned char>, 1017227825Stheraven __type_list<__align_type<unsigned short>, 1018227825Stheraven __type_list<__align_type<unsigned int>, 1019227825Stheraven __type_list<__align_type<unsigned long>, 1020227825Stheraven __type_list<__align_type<unsigned long long>, 1021227825Stheraven __type_list<__align_type<double>, 1022227825Stheraven __type_list<__align_type<long double>, 1023227825Stheraven __type_list<__align_type<__struct_double>, 1024227825Stheraven __type_list<__align_type<__struct_double4>, 1025227825Stheraven __type_list<__align_type<int*>, 1026227825Stheraven __nat 1027227825Stheraven > > > > > > > > > > __all_types; 1028227825Stheraven 1029227825Stheraventemplate <class _TL, size_t _Align> struct __find_pod; 1030227825Stheraven 1031227825Stheraventemplate <class _Hp, size_t _Align> 1032227825Stheravenstruct __find_pod<__type_list<_Hp, __nat>, _Align> 1033227825Stheraven{ 1034227825Stheraven typedef typename conditional< 1035227825Stheraven _Align == _Hp::value, 1036227825Stheraven typename _Hp::type, 1037227825Stheraven void 1038227825Stheraven >::type type; 1039227825Stheraven}; 1040227825Stheraven 1041227825Stheraventemplate <class _Hp, class _Tp, size_t _Align> 1042227825Stheravenstruct __find_pod<__type_list<_Hp, _Tp>, _Align> 1043227825Stheraven{ 1044227825Stheraven typedef typename conditional< 1045227825Stheraven _Align == _Hp::value, 1046227825Stheraven typename _Hp::type, 1047227825Stheraven typename __find_pod<_Tp, _Align>::type 1048227825Stheraven >::type type; 1049227825Stheraven}; 1050227825Stheraven 1051227825Stheraventemplate <class _TL, size_t _Len> struct __find_max_align; 1052227825Stheraven 1053227825Stheraventemplate <class _Hp, size_t _Len> 1054227825Stheravenstruct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {}; 1055227825Stheraven 1056227825Stheraventemplate <size_t _Len, size_t _A1, size_t _A2> 1057227825Stheravenstruct __select_align 1058227825Stheraven{ 1059227825Stheravenprivate: 1060227825Stheraven static const size_t __min = _A2 < _A1 ? _A2 : _A1; 1061227825Stheraven static const size_t __max = _A1 < _A2 ? _A2 : _A1; 1062227825Stheravenpublic: 1063227825Stheraven static const size_t value = _Len < __max ? __min : __max; 1064227825Stheraven}; 1065227825Stheraven 1066227825Stheraventemplate <class _Hp, class _Tp, size_t _Len> 1067227825Stheravenstruct __find_max_align<__type_list<_Hp, _Tp>, _Len> 1068227825Stheraven : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {}; 1069227825Stheraven 1070253159Stheraventemplate <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> 1071262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY aligned_storage 1072227825Stheraven{ 1073227825Stheraven typedef typename __find_pod<__all_types, _Align>::type _Aligner; 1074227825Stheraven static_assert(!is_void<_Aligner>::value, ""); 1075227825Stheraven union type 1076227825Stheraven { 1077227825Stheraven _Aligner __align; 1078227825Stheraven unsigned char __data[_Len]; 1079227825Stheraven }; 1080227825Stheraven}; 1081227825Stheraven 1082253159Stheraven#if _LIBCPP_STD_VER > 11 1083253159Stheraventemplate <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> 1084253159Stheraven using aligned_storage_t = typename aligned_storage<_Len, _Align>::type; 1085253159Stheraven#endif 1086253159Stheraven 1087227825Stheraven#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ 1088227825Stheraventemplate <size_t _Len>\ 1089262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY aligned_storage<_Len, n>\ 1090227825Stheraven{\ 1091227825Stheraven struct _ALIGNAS(n) type\ 1092227825Stheraven {\ 1093242945Stheraven unsigned char __lx[_Len];\ 1094227825Stheraven };\ 1095227825Stheraven} 1096227825Stheraven 1097227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1); 1098227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2); 1099227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4); 1100227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8); 1101227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10); 1102227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20); 1103227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40); 1104227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80); 1105227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100); 1106227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200); 1107227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400); 1108227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800); 1109227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000); 1110227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000); 1111227825Stheraven// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000) 1112262801Sdim#if !defined(_LIBCPP_MSVC) 1113227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); 1114262801Sdim#endif // !_LIBCPP_MSVC 1115227825Stheraven 1116227825Stheraven#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION 1117227825Stheraven 1118249998Sdim#ifndef _LIBCPP_HAS_NO_VARIADICS 1119249998Sdim 1120249998Sdim// aligned_union 1121249998Sdim 1122249998Sdimtemplate <size_t _I0, size_t ..._In> 1123249998Sdimstruct __static_max; 1124249998Sdim 1125249998Sdimtemplate <size_t _I0> 1126249998Sdimstruct __static_max<_I0> 1127249998Sdim{ 1128249998Sdim static const size_t value = _I0; 1129249998Sdim}; 1130249998Sdim 1131249998Sdimtemplate <size_t _I0, size_t _I1, size_t ..._In> 1132249998Sdimstruct __static_max<_I0, _I1, _In...> 1133249998Sdim{ 1134249998Sdim static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value : 1135249998Sdim __static_max<_I1, _In...>::value; 1136249998Sdim}; 1137249998Sdim 1138249998Sdimtemplate <size_t _Len, class _Type0, class ..._Types> 1139249998Sdimstruct aligned_union 1140249998Sdim{ 1141249998Sdim static const size_t alignment_value = __static_max<__alignof__(_Type0), 1142249998Sdim __alignof__(_Types)...>::value; 1143249998Sdim static const size_t __len = __static_max<_Len, sizeof(_Type0), 1144249998Sdim sizeof(_Types)...>::value; 1145249998Sdim typedef typename aligned_storage<__len, alignment_value>::type type; 1146249998Sdim}; 1147249998Sdim 1148253159Stheraven#if _LIBCPP_STD_VER > 11 1149253159Stheraventemplate <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type; 1150253159Stheraven#endif 1151253159Stheraven 1152249998Sdim#endif // _LIBCPP_HAS_NO_VARIADICS 1153249998Sdim 1154227825Stheraven// __promote 1155227825Stheraven 1156227825Stheraventemplate <class _A1, class _A2 = void, class _A3 = void, 1157227825Stheraven bool = (is_arithmetic<_A1>::value || is_void<_A1>::value) && 1158227825Stheraven (is_arithmetic<_A2>::value || is_void<_A2>::value) && 1159227825Stheraven (is_arithmetic<_A3>::value || is_void<_A3>::value)> 1160227825Stheravenclass __promote {}; 1161227825Stheraven 1162227825Stheraventemplate <class _A1, class _A2, class _A3> 1163227825Stheravenclass __promote<_A1, _A2, _A3, true> 1164227825Stheraven{ 1165227825Stheravenprivate: 1166227825Stheraven typedef typename __promote<_A1>::type __type1; 1167227825Stheraven typedef typename __promote<_A2>::type __type2; 1168227825Stheraven typedef typename __promote<_A3>::type __type3; 1169227825Stheravenpublic: 1170227825Stheraven typedef decltype(__type1() + __type2() + __type3()) type; 1171227825Stheraven}; 1172227825Stheraven 1173227825Stheraventemplate <class _A1, class _A2> 1174227825Stheravenclass __promote<_A1, _A2, void, true> 1175227825Stheraven{ 1176227825Stheravenprivate: 1177227825Stheraven typedef typename __promote<_A1>::type __type1; 1178227825Stheraven typedef typename __promote<_A2>::type __type2; 1179227825Stheravenpublic: 1180227825Stheraven typedef decltype(__type1() + __type2()) type; 1181227825Stheraven}; 1182227825Stheraven 1183227825Stheraventemplate <class _A1> 1184227825Stheravenclass __promote<_A1, void, void, true> 1185227825Stheraven{ 1186227825Stheravenpublic: 1187227825Stheraven typedef typename conditional<is_arithmetic<_A1>::value, 1188227825Stheraven typename conditional<is_integral<_A1>::value, double, _A1>::type, 1189227825Stheraven void 1190227825Stheraven >::type type; 1191227825Stheraven}; 1192227825Stheraven 1193227825Stheraven#ifdef _LIBCPP_STORE_AS_OPTIMIZATION 1194227825Stheraven 1195227825Stheraven// __transform 1196227825Stheraven 1197227825Stheraventemplate <class _Tp, size_t = sizeof(_Tp), bool = is_scalar<_Tp>::value> struct __transform {typedef _Tp type;}; 1198227825Stheraventemplate <class _Tp> struct __transform<_Tp, 1, true> {typedef unsigned char type;}; 1199227825Stheraventemplate <class _Tp> struct __transform<_Tp, 2, true> {typedef unsigned short type;}; 1200227825Stheraventemplate <class _Tp> struct __transform<_Tp, 4, true> {typedef unsigned int type;}; 1201227825Stheraventemplate <class _Tp> struct __transform<_Tp, 8, true> {typedef unsigned long long type;}; 1202227825Stheraven 1203227825Stheraven#endif // _LIBCPP_STORE_AS_OPTIMIZATION 1204227825Stheraven 1205227825Stheraven// make_signed / make_unsigned 1206227825Stheraven 1207227825Stheraventypedef 1208227825Stheraven __type_list<signed char, 1209227825Stheraven __type_list<signed short, 1210227825Stheraven __type_list<signed int, 1211227825Stheraven __type_list<signed long, 1212227825Stheraven __type_list<signed long long, 1213227825Stheraven __nat 1214227825Stheraven > > > > > __signed_types; 1215227825Stheraven 1216227825Stheraventypedef 1217227825Stheraven __type_list<unsigned char, 1218227825Stheraven __type_list<unsigned short, 1219227825Stheraven __type_list<unsigned int, 1220227825Stheraven __type_list<unsigned long, 1221227825Stheraven __type_list<unsigned long long, 1222227825Stheraven __nat 1223227825Stheraven > > > > > __unsigned_types; 1224227825Stheraven 1225227825Stheraventemplate <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first; 1226227825Stheraven 1227227825Stheraventemplate <class _Hp, class _Tp, size_t _Size> 1228227825Stheravenstruct __find_first<__type_list<_Hp, _Tp>, _Size, true> 1229227825Stheraven{ 1230227825Stheraven typedef _Hp type; 1231227825Stheraven}; 1232227825Stheraven 1233227825Stheraventemplate <class _Hp, class _Tp, size_t _Size> 1234227825Stheravenstruct __find_first<__type_list<_Hp, _Tp>, _Size, false> 1235227825Stheraven{ 1236227825Stheraven typedef typename __find_first<_Tp, _Size>::type type; 1237227825Stheraven}; 1238227825Stheraven 1239227825Stheraventemplate <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, 1240227825Stheraven bool = is_volatile<typename remove_reference<_Tp>::type>::value> 1241227825Stheravenstruct __apply_cv 1242227825Stheraven{ 1243227825Stheraven typedef _Up type; 1244227825Stheraven}; 1245227825Stheraven 1246227825Stheraventemplate <class _Tp, class _Up> 1247227825Stheravenstruct __apply_cv<_Tp, _Up, true, false> 1248227825Stheraven{ 1249227825Stheraven typedef const _Up type; 1250227825Stheraven}; 1251227825Stheraven 1252227825Stheraventemplate <class _Tp, class _Up> 1253227825Stheravenstruct __apply_cv<_Tp, _Up, false, true> 1254227825Stheraven{ 1255227825Stheraven typedef volatile _Up type; 1256227825Stheraven}; 1257227825Stheraven 1258227825Stheraventemplate <class _Tp, class _Up> 1259227825Stheravenstruct __apply_cv<_Tp, _Up, true, true> 1260227825Stheraven{ 1261227825Stheraven typedef const volatile _Up type; 1262227825Stheraven}; 1263227825Stheraven 1264227825Stheraventemplate <class _Tp, class _Up> 1265227825Stheravenstruct __apply_cv<_Tp&, _Up, false, false> 1266227825Stheraven{ 1267227825Stheraven typedef _Up& type; 1268227825Stheraven}; 1269227825Stheraven 1270227825Stheraventemplate <class _Tp, class _Up> 1271227825Stheravenstruct __apply_cv<_Tp&, _Up, true, false> 1272227825Stheraven{ 1273227825Stheraven typedef const _Up& type; 1274227825Stheraven}; 1275227825Stheraven 1276227825Stheraventemplate <class _Tp, class _Up> 1277227825Stheravenstruct __apply_cv<_Tp&, _Up, false, true> 1278227825Stheraven{ 1279227825Stheraven typedef volatile _Up& type; 1280227825Stheraven}; 1281227825Stheraven 1282227825Stheraventemplate <class _Tp, class _Up> 1283227825Stheravenstruct __apply_cv<_Tp&, _Up, true, true> 1284227825Stheraven{ 1285227825Stheraven typedef const volatile _Up& type; 1286227825Stheraven}; 1287227825Stheraven 1288227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1289227825Stheravenstruct __make_signed {}; 1290227825Stheraven 1291227825Stheraventemplate <class _Tp> 1292227825Stheravenstruct __make_signed<_Tp, true> 1293227825Stheraven{ 1294227825Stheraven typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type; 1295227825Stheraven}; 1296227825Stheraven 1297227825Stheraventemplate <> struct __make_signed<bool, true> {}; 1298227825Stheraventemplate <> struct __make_signed< signed short, true> {typedef short type;}; 1299227825Stheraventemplate <> struct __make_signed<unsigned short, true> {typedef short type;}; 1300227825Stheraventemplate <> struct __make_signed< signed int, true> {typedef int type;}; 1301227825Stheraventemplate <> struct __make_signed<unsigned int, true> {typedef int type;}; 1302227825Stheraventemplate <> struct __make_signed< signed long, true> {typedef long type;}; 1303227825Stheraventemplate <> struct __make_signed<unsigned long, true> {typedef long type;}; 1304227825Stheraventemplate <> struct __make_signed< signed long long, true> {typedef long long type;}; 1305227825Stheraventemplate <> struct __make_signed<unsigned long long, true> {typedef long long type;}; 1306227825Stheraven 1307227825Stheraventemplate <class _Tp> 1308262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY make_signed 1309227825Stheraven{ 1310227825Stheraven typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type; 1311227825Stheraven}; 1312227825Stheraven 1313253159Stheraven#if _LIBCPP_STD_VER > 11 1314253159Stheraventemplate <class _Tp> using make_signed_t = typename make_signed<_Tp>::type; 1315253159Stheraven#endif 1316253159Stheraven 1317227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1318227825Stheravenstruct __make_unsigned {}; 1319227825Stheraven 1320227825Stheraventemplate <class _Tp> 1321227825Stheravenstruct __make_unsigned<_Tp, true> 1322227825Stheraven{ 1323227825Stheraven typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type; 1324227825Stheraven}; 1325227825Stheraven 1326227825Stheraventemplate <> struct __make_unsigned<bool, true> {}; 1327227825Stheraventemplate <> struct __make_unsigned< signed short, true> {typedef unsigned short type;}; 1328227825Stheraventemplate <> struct __make_unsigned<unsigned short, true> {typedef unsigned short type;}; 1329227825Stheraventemplate <> struct __make_unsigned< signed int, true> {typedef unsigned int type;}; 1330227825Stheraventemplate <> struct __make_unsigned<unsigned int, true> {typedef unsigned int type;}; 1331227825Stheraventemplate <> struct __make_unsigned< signed long, true> {typedef unsigned long type;}; 1332227825Stheraventemplate <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;}; 1333227825Stheraventemplate <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;}; 1334227825Stheraventemplate <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;}; 1335227825Stheraven 1336227825Stheraventemplate <class _Tp> 1337262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY make_unsigned 1338227825Stheraven{ 1339227825Stheraven typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type; 1340227825Stheraven}; 1341227825Stheraven 1342253159Stheraven#if _LIBCPP_STD_VER > 11 1343253159Stheraventemplate <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type; 1344253159Stheraven#endif 1345253159Stheraven 1346227825Stheraven#ifdef _LIBCPP_HAS_NO_VARIADICS 1347227825Stheraven 1348227825Stheraventemplate <class _Tp, class _Up = void, class V = void> 1349262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type 1350227825Stheraven{ 1351227825Stheravenpublic: 1352227825Stheraven typedef typename common_type<typename common_type<_Tp, _Up>::type, V>::type type; 1353227825Stheraven}; 1354227825Stheraven 1355227825Stheraventemplate <class _Tp> 1356262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, void, void> 1357227825Stheraven{ 1358227825Stheravenpublic: 1359227825Stheraven typedef _Tp type; 1360227825Stheraven}; 1361227825Stheraven 1362227825Stheraventemplate <class _Tp, class _Up> 1363262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, void> 1364227825Stheraven{ 1365227825Stheravenprivate: 1366227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1367227825Stheraven static _Tp&& __t(); 1368227825Stheraven static _Up&& __u(); 1369227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1370227825Stheraven static _Tp __t(); 1371227825Stheraven static _Up __u(); 1372227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1373227825Stheravenpublic: 1374232950Stheraven typedef typename remove_reference<decltype(true ? __t() : __u())>::type type; 1375227825Stheraven}; 1376227825Stheraven 1377227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1378227825Stheraven 1379227825Stheraventemplate <class ..._Tp> struct common_type; 1380227825Stheraven 1381227825Stheraventemplate <class _Tp> 1382262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp> 1383227825Stheraven{ 1384262801Sdim typedef typename decay<_Tp>::type type; 1385227825Stheraven}; 1386227825Stheraven 1387227825Stheraventemplate <class _Tp, class _Up> 1388262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up> 1389227825Stheraven{ 1390227825Stheravenprivate: 1391227825Stheraven static _Tp&& __t(); 1392227825Stheraven static _Up&& __u(); 1393227825Stheraven static bool __f(); 1394227825Stheravenpublic: 1395262801Sdim typedef typename decay<decltype(__f() ? __t() : __u())>::type type; 1396227825Stheraven}; 1397227825Stheraven 1398227825Stheraventemplate <class _Tp, class _Up, class ..._Vp> 1399262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, _Vp...> 1400227825Stheraven{ 1401227825Stheraven typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type; 1402227825Stheraven}; 1403227825Stheraven 1404253159Stheraven#if _LIBCPP_STD_VER > 11 1405253159Stheraventemplate <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type; 1406253159Stheraven#endif 1407253159Stheraven 1408227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 1409227825Stheraven 1410227825Stheraven// is_assignable 1411227825Stheraven 1412262801Sdimtemplate<typename, typename _Tp> struct __select_2nd { typedef _Tp type; }; 1413262801Sdim 1414227825Stheraventemplate <class _Tp, class _Arg> 1415262801Sdimtypename __select_2nd<decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>())), true_type>::type 1416227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1417227825Stheraven__is_assignable_test(_Tp&&, _Arg&&); 1418227825Stheraven#else 1419227825Stheraven__is_assignable_test(_Tp, _Arg&); 1420227825Stheraven#endif 1421227825Stheraven 1422227825Stheraventemplate <class _Arg> 1423227825Stheravenfalse_type 1424227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1425227825Stheraven__is_assignable_test(__any, _Arg&&); 1426227825Stheraven#else 1427227825Stheraven__is_assignable_test(__any, _Arg&); 1428227825Stheraven#endif 1429227825Stheraven 1430227825Stheraventemplate <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value> 1431227825Stheravenstruct __is_assignable_imp 1432227825Stheraven : public common_type 1433227825Stheraven < 1434227825Stheraven decltype(__is_assignable_test(declval<_Tp>(), declval<_Arg>())) 1435227825Stheraven >::type {}; 1436227825Stheraven 1437227825Stheraventemplate <class _Tp, class _Arg> 1438227825Stheravenstruct __is_assignable_imp<_Tp, _Arg, true> 1439227825Stheraven : public false_type 1440227825Stheraven{ 1441227825Stheraven}; 1442227825Stheraven 1443227825Stheraventemplate <class _Tp, class _Arg> 1444227825Stheravenstruct is_assignable 1445227825Stheraven : public __is_assignable_imp<_Tp, _Arg> {}; 1446227825Stheraven 1447227825Stheraven// is_copy_assignable 1448227825Stheraven 1449262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_copy_assignable 1450227825Stheraven : public is_assignable<typename add_lvalue_reference<_Tp>::type, 1451227825Stheraven const typename add_lvalue_reference<_Tp>::type> {}; 1452227825Stheraven 1453227825Stheraven// is_move_assignable 1454227825Stheraven 1455262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_move_assignable 1456227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1457227825Stheraven : public is_assignable<typename add_lvalue_reference<_Tp>::type, 1458227825Stheraven const typename add_rvalue_reference<_Tp>::type> {}; 1459227825Stheraven#else 1460227825Stheraven : public is_copy_assignable<_Tp> {}; 1461227825Stheraven#endif 1462227825Stheraven 1463227825Stheraven// is_destructible 1464227825Stheraven 1465227825Stheraventemplate <class _Tp> 1466227825Stheravenstruct __destructible_test 1467227825Stheraven{ 1468227825Stheraven _Tp __t; 1469227825Stheraven}; 1470227825Stheraven 1471227825Stheraventemplate <class _Tp> 1472227825Stheravendecltype((_VSTD::declval<__destructible_test<_Tp> >().~__destructible_test<_Tp>(), true_type())) 1473227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1474227825Stheraven__is_destructible_test(_Tp&&); 1475227825Stheraven#else 1476227825Stheraven__is_destructible_test(_Tp&); 1477227825Stheraven#endif 1478227825Stheraven 1479227825Stheravenfalse_type 1480227825Stheraven__is_destructible_test(__any); 1481227825Stheraven 1482262801Sdimtemplate <class _Tp, bool = is_void<_Tp>::value || is_abstract<_Tp>::value 1483262801Sdim || is_function<_Tp>::value> 1484227825Stheravenstruct __destructible_imp 1485227825Stheraven : public common_type 1486227825Stheraven < 1487227825Stheraven decltype(__is_destructible_test(declval<_Tp>())) 1488227825Stheraven >::type {}; 1489227825Stheraven 1490227825Stheraventemplate <class _Tp> 1491227825Stheravenstruct __destructible_imp<_Tp, true> 1492227825Stheraven : public false_type {}; 1493227825Stheraven 1494227825Stheraventemplate <class _Tp> 1495227825Stheravenstruct is_destructible 1496227825Stheraven : public __destructible_imp<_Tp> {}; 1497227825Stheraven 1498262801Sdimtemplate <class _Tp> 1499262801Sdimstruct is_destructible<_Tp[]> 1500262801Sdim : public false_type {}; 1501262801Sdim 1502227825Stheraven// move 1503227825Stheraven 1504227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1505227825Stheraven 1506227825Stheraventemplate <class _Tp> 1507262801Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1508227825Stheraventypename remove_reference<_Tp>::type&& 1509227825Stheravenmove(_Tp&& __t) _NOEXCEPT 1510227825Stheraven{ 1511227825Stheraven typedef typename remove_reference<_Tp>::type _Up; 1512227825Stheraven return static_cast<_Up&&>(__t); 1513227825Stheraven} 1514227825Stheraven 1515227825Stheraventemplate <class _Tp> 1516262801Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1517227825Stheraven_Tp&& 1518227825Stheravenforward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT 1519227825Stheraven{ 1520227825Stheraven return static_cast<_Tp&&>(__t); 1521227825Stheraven} 1522227825Stheraven 1523227825Stheraventemplate <class _Tp> 1524262801Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1525227825Stheraven_Tp&& 1526227825Stheravenforward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT 1527227825Stheraven{ 1528227825Stheraven static_assert(!std::is_lvalue_reference<_Tp>::value, 1529227825Stheraven "Can not forward an rvalue as an lvalue."); 1530227825Stheraven return static_cast<_Tp&&>(__t); 1531227825Stheraven} 1532227825Stheraven 1533227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1534227825Stheraven 1535227825Stheraventemplate <class _Tp> 1536227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1537234976Stheraven_Tp& 1538227825Stheravenmove(_Tp& __t) 1539227825Stheraven{ 1540227825Stheraven return __t; 1541227825Stheraven} 1542227825Stheraven 1543227825Stheraventemplate <class _Tp> 1544227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1545234976Stheravenconst _Tp& 1546232950Stheravenmove(const _Tp& __t) 1547232950Stheraven{ 1548232950Stheraven return __t; 1549232950Stheraven} 1550232950Stheraven 1551232950Stheraventemplate <class _Tp> 1552232950Stheraveninline _LIBCPP_INLINE_VISIBILITY 1553234976Stheraven_Tp& 1554234976Stheravenforward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT 1555227825Stheraven{ 1556227825Stheraven return __t; 1557227825Stheraven} 1558227825Stheraven 1559227825Stheraven 1560234976Stheraventemplate <class _Tp> 1561234976Stheravenclass __rv 1562227825Stheraven{ 1563234976Stheraven typedef typename remove_reference<_Tp>::type _Trr; 1564234976Stheraven _Trr& t_; 1565234976Stheravenpublic: 1566234976Stheraven _LIBCPP_INLINE_VISIBILITY 1567234976Stheraven _Trr* operator->() {return &t_;} 1568234976Stheraven _LIBCPP_INLINE_VISIBILITY 1569234976Stheraven explicit __rv(_Trr& __t) : t_(__t) {} 1570234976Stheraven}; 1571227825Stheraven 1572227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1573227825Stheraven 1574227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1575227825Stheraven 1576227825Stheraventemplate <class _Tp> 1577227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1578227825Stheraventypename decay<_Tp>::type 1579227825Stheraven__decay_copy(_Tp&& __t) 1580227825Stheraven{ 1581227825Stheraven return _VSTD::forward<_Tp>(__t); 1582227825Stheraven} 1583227825Stheraven 1584227825Stheraven#else 1585227825Stheraven 1586227825Stheraventemplate <class _Tp> 1587227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1588227825Stheraventypename decay<_Tp>::type 1589227825Stheraven__decay_copy(const _Tp& __t) 1590227825Stheraven{ 1591227825Stheraven return _VSTD::forward<_Tp>(__t); 1592227825Stheraven} 1593227825Stheraven 1594227825Stheraven#endif 1595227825Stheraven 1596227825Stheraventemplate <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr> 1597227825Stheravenstruct __member_pointer_traits_imp 1598227825Stheraven{ 1599227825Stheraven}; 1600227825Stheraven 1601227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 1602227825Stheraven 1603232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1604232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> 1605227825Stheraven{ 1606227825Stheraven typedef _Class _ClassType; 1607232950Stheraven typedef _Rp _ReturnType; 1608227825Stheraven}; 1609227825Stheraven 1610232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1611232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> 1612227825Stheraven{ 1613227825Stheraven typedef _Class const _ClassType; 1614232950Stheraven typedef _Rp _ReturnType; 1615227825Stheraven}; 1616227825Stheraven 1617232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1618232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> 1619227825Stheraven{ 1620227825Stheraven typedef _Class volatile _ClassType; 1621232950Stheraven typedef _Rp _ReturnType; 1622227825Stheraven}; 1623227825Stheraven 1624232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1625232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> 1626227825Stheraven{ 1627227825Stheraven typedef _Class const volatile _ClassType; 1628232950Stheraven typedef _Rp _ReturnType; 1629227825Stheraven}; 1630227825Stheraven 1631227825Stheraven#if __has_feature(cxx_reference_qualified_functions) 1632227825Stheraven 1633232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1634232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> 1635227825Stheraven{ 1636227825Stheraven typedef _Class& _ClassType; 1637232950Stheraven typedef _Rp _ReturnType; 1638227825Stheraven}; 1639227825Stheraven 1640232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1641232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> 1642227825Stheraven{ 1643227825Stheraven typedef _Class const& _ClassType; 1644232950Stheraven typedef _Rp _ReturnType; 1645227825Stheraven}; 1646227825Stheraven 1647232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1648232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> 1649227825Stheraven{ 1650227825Stheraven typedef _Class volatile& _ClassType; 1651232950Stheraven typedef _Rp _ReturnType; 1652227825Stheraven}; 1653227825Stheraven 1654232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1655232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> 1656227825Stheraven{ 1657227825Stheraven typedef _Class const volatile& _ClassType; 1658232950Stheraven typedef _Rp _ReturnType; 1659227825Stheraven}; 1660227825Stheraven 1661232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1662232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> 1663227825Stheraven{ 1664227825Stheraven typedef _Class&& _ClassType; 1665232950Stheraven typedef _Rp _ReturnType; 1666227825Stheraven}; 1667227825Stheraven 1668232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1669232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> 1670227825Stheraven{ 1671227825Stheraven typedef _Class const&& _ClassType; 1672232950Stheraven typedef _Rp _ReturnType; 1673227825Stheraven}; 1674227825Stheraven 1675232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1676232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> 1677227825Stheraven{ 1678227825Stheraven typedef _Class volatile&& _ClassType; 1679232950Stheraven typedef _Rp _ReturnType; 1680227825Stheraven}; 1681227825Stheraven 1682232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1683232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> 1684227825Stheraven{ 1685227825Stheraven typedef _Class const volatile&& _ClassType; 1686232950Stheraven typedef _Rp _ReturnType; 1687227825Stheraven}; 1688227825Stheraven 1689227825Stheraven#endif // __has_feature(cxx_reference_qualified_functions) 1690227825Stheraven 1691227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1692227825Stheraven 1693232950Stheraventemplate <class _Rp, class _Class> 1694232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false> 1695227825Stheraven{ 1696227825Stheraven typedef _Class _ClassType; 1697232950Stheraven typedef _Rp _ReturnType; 1698227825Stheraven}; 1699227825Stheraven 1700232950Stheraventemplate <class _Rp, class _Class, class _P0> 1701232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> 1702227825Stheraven{ 1703227825Stheraven typedef _Class _ClassType; 1704232950Stheraven typedef _Rp _ReturnType; 1705227825Stheraven}; 1706227825Stheraven 1707232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1708232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> 1709227825Stheraven{ 1710227825Stheraven typedef _Class _ClassType; 1711232950Stheraven typedef _Rp _ReturnType; 1712227825Stheraven}; 1713227825Stheraven 1714232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1715232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> 1716227825Stheraven{ 1717227825Stheraven typedef _Class _ClassType; 1718232950Stheraven typedef _Rp _ReturnType; 1719227825Stheraven}; 1720227825Stheraven 1721232950Stheraventemplate <class _Rp, class _Class> 1722232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> 1723227825Stheraven{ 1724227825Stheraven typedef _Class const _ClassType; 1725232950Stheraven typedef _Rp _ReturnType; 1726227825Stheraven}; 1727227825Stheraven 1728232950Stheraventemplate <class _Rp, class _Class, class _P0> 1729232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> 1730227825Stheraven{ 1731227825Stheraven typedef _Class const _ClassType; 1732232950Stheraven typedef _Rp _ReturnType; 1733227825Stheraven}; 1734227825Stheraven 1735232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1736232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> 1737227825Stheraven{ 1738227825Stheraven typedef _Class const _ClassType; 1739232950Stheraven typedef _Rp _ReturnType; 1740227825Stheraven}; 1741227825Stheraven 1742232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1743232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false> 1744227825Stheraven{ 1745227825Stheraven typedef _Class const _ClassType; 1746232950Stheraven typedef _Rp _ReturnType; 1747227825Stheraven}; 1748227825Stheraven 1749232950Stheraventemplate <class _Rp, class _Class> 1750232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> 1751227825Stheraven{ 1752227825Stheraven typedef _Class volatile _ClassType; 1753232950Stheraven typedef _Rp _ReturnType; 1754227825Stheraven}; 1755227825Stheraven 1756232950Stheraventemplate <class _Rp, class _Class, class _P0> 1757232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> 1758227825Stheraven{ 1759227825Stheraven typedef _Class volatile _ClassType; 1760232950Stheraven typedef _Rp _ReturnType; 1761227825Stheraven}; 1762227825Stheraven 1763232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1764232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false> 1765227825Stheraven{ 1766227825Stheraven typedef _Class volatile _ClassType; 1767232950Stheraven typedef _Rp _ReturnType; 1768227825Stheraven}; 1769227825Stheraven 1770232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1771232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false> 1772227825Stheraven{ 1773227825Stheraven typedef _Class volatile _ClassType; 1774232950Stheraven typedef _Rp _ReturnType; 1775227825Stheraven}; 1776227825Stheraven 1777232950Stheraventemplate <class _Rp, class _Class> 1778232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false> 1779227825Stheraven{ 1780227825Stheraven typedef _Class const volatile _ClassType; 1781232950Stheraven typedef _Rp _ReturnType; 1782227825Stheraven}; 1783227825Stheraven 1784232950Stheraventemplate <class _Rp, class _Class, class _P0> 1785232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false> 1786227825Stheraven{ 1787227825Stheraven typedef _Class const volatile _ClassType; 1788232950Stheraven typedef _Rp _ReturnType; 1789227825Stheraven}; 1790227825Stheraven 1791232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1792232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false> 1793227825Stheraven{ 1794227825Stheraven typedef _Class const volatile _ClassType; 1795232950Stheraven typedef _Rp _ReturnType; 1796227825Stheraven}; 1797227825Stheraven 1798232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1799232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false> 1800227825Stheraven{ 1801227825Stheraven typedef _Class const volatile _ClassType; 1802232950Stheraven typedef _Rp _ReturnType; 1803227825Stheraven}; 1804227825Stheraven 1805227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 1806227825Stheraven 1807232950Stheraventemplate <class _Rp, class _Class> 1808232950Stheravenstruct __member_pointer_traits_imp<_Rp _Class::*, false, true> 1809227825Stheraven{ 1810227825Stheraven typedef _Class _ClassType; 1811232950Stheraven typedef _Rp _ReturnType; 1812227825Stheraven}; 1813227825Stheraven 1814227825Stheraventemplate <class _MP> 1815227825Stheravenstruct __member_pointer_traits 1816253159Stheraven : public __member_pointer_traits_imp<typename remove_cv<_MP>::type, 1817227825Stheraven is_member_function_pointer<_MP>::value, 1818227825Stheraven is_member_object_pointer<_MP>::value> 1819227825Stheraven{ 1820227825Stheraven// typedef ... _ClassType; 1821227825Stheraven// typedef ... _ReturnType; 1822227825Stheraven}; 1823227825Stheraven 1824227825Stheraven// result_of 1825227825Stheraven 1826227825Stheraventemplate <class _Callable> class result_of; 1827227825Stheraven 1828241903Sdim#ifdef _LIBCPP_HAS_NO_VARIADICS 1829241903Sdim 1830227825Stheraventemplate <class _Fn, bool, bool> 1831227825Stheravenclass __result_of 1832227825Stheraven{ 1833227825Stheraven}; 1834227825Stheraven 1835227825Stheraventemplate <class _Fn> 1836227825Stheravenclass __result_of<_Fn(), true, false> 1837227825Stheraven{ 1838227825Stheravenpublic: 1839227825Stheraven typedef decltype(declval<_Fn>()()) type; 1840227825Stheraven}; 1841227825Stheraven 1842227825Stheraventemplate <class _Fn, class _A0> 1843227825Stheravenclass __result_of<_Fn(_A0), true, false> 1844227825Stheraven{ 1845227825Stheravenpublic: 1846227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>())) type; 1847227825Stheraven}; 1848227825Stheraven 1849227825Stheraventemplate <class _Fn, class _A0, class _A1> 1850227825Stheravenclass __result_of<_Fn(_A0, _A1), true, false> 1851227825Stheraven{ 1852227825Stheravenpublic: 1853227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type; 1854227825Stheraven}; 1855227825Stheraven 1856227825Stheraventemplate <class _Fn, class _A0, class _A1, class _A2> 1857227825Stheravenclass __result_of<_Fn(_A0, _A1, _A2), true, false> 1858227825Stheraven{ 1859227825Stheravenpublic: 1860227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type; 1861227825Stheraven}; 1862227825Stheraven 1863227825Stheraventemplate <class _MP, class _Tp, bool _IsMemberFunctionPtr> 1864227825Stheravenstruct __result_of_mp; 1865227825Stheraven 1866227825Stheraven// member function pointer 1867227825Stheraven 1868227825Stheraventemplate <class _MP, class _Tp> 1869227825Stheravenstruct __result_of_mp<_MP, _Tp, true> 1870227825Stheraven : public common_type<typename __member_pointer_traits<_MP>::_ReturnType> 1871227825Stheraven{ 1872227825Stheraven}; 1873227825Stheraven 1874227825Stheraven// member data pointer 1875227825Stheraven 1876227825Stheraventemplate <class _MP, class _Tp, bool> 1877227825Stheravenstruct __result_of_mdp; 1878227825Stheraven 1879232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1880232950Stheravenstruct __result_of_mdp<_Rp _Class::*, _Tp, false> 1881227825Stheraven{ 1882232950Stheraven typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type; 1883227825Stheraven}; 1884227825Stheraven 1885232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1886232950Stheravenstruct __result_of_mdp<_Rp _Class::*, _Tp, true> 1887227825Stheraven{ 1888232950Stheraven typedef typename __apply_cv<_Tp, _Rp>::type& type; 1889227825Stheraven}; 1890227825Stheraven 1891232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1892232950Stheravenstruct __result_of_mp<_Rp _Class::*, _Tp, false> 1893232950Stheraven : public __result_of_mdp<_Rp _Class::*, _Tp, 1894227825Stheraven is_base_of<_Class, typename remove_reference<_Tp>::type>::value> 1895227825Stheraven{ 1896227825Stheraven}; 1897227825Stheraven 1898227825Stheraven 1899227825Stheraven 1900227825Stheraventemplate <class _Fn, class _Tp> 1901227825Stheravenclass __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer 1902227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1903227825Stheraven _Tp, 1904227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1905227825Stheraven{ 1906227825Stheraven}; 1907227825Stheraven 1908227825Stheraventemplate <class _Fn, class _Tp, class _A0> 1909227825Stheravenclass __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer 1910227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1911227825Stheraven _Tp, 1912227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1913227825Stheraven{ 1914227825Stheraven}; 1915227825Stheraven 1916227825Stheraventemplate <class _Fn, class _Tp, class _A0, class _A1> 1917227825Stheravenclass __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer 1918227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1919227825Stheraven _Tp, 1920227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1921227825Stheraven{ 1922227825Stheraven}; 1923227825Stheraven 1924227825Stheraventemplate <class _Fn, class _Tp, class _A0, class _A1, class _A2> 1925227825Stheravenclass __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer 1926227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1927227825Stheraven _Tp, 1928227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1929227825Stheraven{ 1930227825Stheraven}; 1931227825Stheraven 1932227825Stheraven// result_of 1933227825Stheraven 1934227825Stheraventemplate <class _Fn> 1935262801Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fn()> 1936227825Stheraven : public __result_of<_Fn(), 1937227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1938227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1939227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1940227825Stheraven > 1941227825Stheraven{ 1942227825Stheraven}; 1943227825Stheraven 1944227825Stheraventemplate <class _Fn, class _A0> 1945262801Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0)> 1946227825Stheraven : public __result_of<_Fn(_A0), 1947227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1948227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1949227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1950227825Stheraven > 1951227825Stheraven{ 1952227825Stheraven}; 1953227825Stheraven 1954227825Stheraventemplate <class _Fn, class _A0, class _A1> 1955262801Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1)> 1956227825Stheraven : public __result_of<_Fn(_A0, _A1), 1957227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1958227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1959227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1960227825Stheraven > 1961227825Stheraven{ 1962227825Stheraven}; 1963227825Stheraven 1964227825Stheraventemplate <class _Fn, class _A0, class _A1, class _A2> 1965262801Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1, _A2)> 1966227825Stheraven : public __result_of<_Fn(_A0, _A1, _A2), 1967227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1968227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1969227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1970227825Stheraven > 1971227825Stheraven{ 1972227825Stheraven}; 1973227825Stheraven 1974227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 1975227825Stheraven 1976227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 1977227825Stheraven 1978227825Stheraven// template <class T, class... Args> struct is_constructible; 1979227825Stheraven 1980227825Stheraven// main is_constructible test 1981227825Stheraven 1982227825Stheraventemplate <class _Tp, class ..._Args> 1983242945Stheraventypename __select_2nd<decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...))), true_type>::type 1984227825Stheraven__is_constructible_test(_Tp&&, _Args&& ...); 1985227825Stheraven 1986227825Stheraventemplate <class ..._Args> 1987227825Stheravenfalse_type 1988227825Stheraven__is_constructible_test(__any, _Args&& ...); 1989227825Stheraven 1990227825Stheraventemplate <bool, class _Tp, class... _Args> 1991227825Stheravenstruct __is_constructible // false, _Tp is not a scalar 1992227825Stheraven : public common_type 1993227825Stheraven < 1994227825Stheraven decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...)) 1995227825Stheraven >::type 1996227825Stheraven {}; 1997227825Stheraven 1998227825Stheraven// function types are not constructible 1999227825Stheraven 2000232950Stheraventemplate <class _Rp, class... _A1, class... _A2> 2001232950Stheravenstruct __is_constructible<false, _Rp(_A1...), _A2...> 2002227825Stheraven : public false_type 2003227825Stheraven {}; 2004227825Stheraven 2005227825Stheraven// handle scalars and reference types 2006227825Stheraven 2007227825Stheraven// Scalars are default constructible, references are not 2008227825Stheraven 2009227825Stheraventemplate <class _Tp> 2010227825Stheravenstruct __is_constructible<true, _Tp> 2011227825Stheraven : public is_scalar<_Tp> 2012227825Stheraven {}; 2013227825Stheraven 2014227825Stheraven// Scalars and references are constructible from one arg if that arg is 2015227825Stheraven// implicitly convertible to the scalar or reference. 2016227825Stheraven 2017227825Stheraventemplate <class _Tp> 2018227825Stheravenstruct __is_constructible_ref 2019227825Stheraven{ 2020242945Stheraven true_type static __lxx(_Tp); 2021242945Stheraven false_type static __lxx(...); 2022227825Stheraven}; 2023227825Stheraven 2024227825Stheraventemplate <class _Tp, class _A0> 2025227825Stheravenstruct __is_constructible<true, _Tp, _A0> 2026227825Stheraven : public common_type 2027227825Stheraven < 2028242945Stheraven decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>())) 2029227825Stheraven >::type 2030227825Stheraven {}; 2031227825Stheraven 2032227825Stheraven// Scalars and references are not constructible from multiple args. 2033227825Stheraven 2034227825Stheraventemplate <class _Tp, class _A0, class ..._Args> 2035227825Stheravenstruct __is_constructible<true, _Tp, _A0, _Args...> 2036227825Stheraven : public false_type 2037227825Stheraven {}; 2038227825Stheraven 2039227825Stheraven// Treat scalars and reference types separately 2040227825Stheraven 2041227825Stheraventemplate <bool, class _Tp, class... _Args> 2042227825Stheravenstruct __is_constructible_void_check 2043227825Stheraven : public __is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2044227825Stheraven _Tp, _Args...> 2045227825Stheraven {}; 2046227825Stheraven 2047227825Stheraven// If any of T or Args is void, is_constructible should be false 2048227825Stheraven 2049227825Stheraventemplate <class _Tp, class... _Args> 2050227825Stheravenstruct __is_constructible_void_check<true, _Tp, _Args...> 2051227825Stheraven : public false_type 2052227825Stheraven {}; 2053227825Stheraven 2054227825Stheraventemplate <class ..._Args> struct __contains_void; 2055227825Stheraven 2056227825Stheraventemplate <> struct __contains_void<> : false_type {}; 2057227825Stheraven 2058227825Stheraventemplate <class _A0, class ..._Args> 2059227825Stheravenstruct __contains_void<_A0, _Args...> 2060227825Stheraven{ 2061227825Stheraven static const bool value = is_void<_A0>::value || 2062227825Stheraven __contains_void<_Args...>::value; 2063227825Stheraven}; 2064227825Stheraven 2065227825Stheraven// is_constructible entry point 2066227825Stheraven 2067227825Stheraventemplate <class _Tp, class... _Args> 2068262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible 2069227825Stheraven : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value 2070227825Stheraven || is_abstract<_Tp>::value, 2071227825Stheraven _Tp, _Args...> 2072227825Stheraven {}; 2073227825Stheraven 2074227825Stheraven// Array types are default constructible if their element type 2075227825Stheraven// is default constructible 2076227825Stheraven 2077232950Stheraventemplate <class _Ap, size_t _Np> 2078232950Stheravenstruct __is_constructible<false, _Ap[_Np]> 2079232950Stheraven : public is_constructible<typename remove_all_extents<_Ap>::type> 2080227825Stheraven {}; 2081227825Stheraven 2082227825Stheraven// Otherwise array types are not constructible by this syntax 2083227825Stheraven 2084232950Stheraventemplate <class _Ap, size_t _Np, class ..._Args> 2085232950Stheravenstruct __is_constructible<false, _Ap[_Np], _Args...> 2086227825Stheraven : public false_type 2087227825Stheraven {}; 2088227825Stheraven 2089227825Stheraven// Incomplete array types are not constructible 2090227825Stheraven 2091232950Stheraventemplate <class _Ap, class ..._Args> 2092232950Stheravenstruct __is_constructible<false, _Ap[], _Args...> 2093227825Stheraven : public false_type 2094227825Stheraven {}; 2095227825Stheraven 2096227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2097227825Stheraven 2098227825Stheraven// template <class T> struct is_constructible0; 2099227825Stheraven 2100227825Stheraven// main is_constructible0 test 2101227825Stheraven 2102227825Stheraventemplate <class _Tp> 2103227825Stheravendecltype((_Tp(), true_type())) 2104227825Stheraven__is_constructible0_test(_Tp&); 2105227825Stheraven 2106227825Stheravenfalse_type 2107227825Stheraven__is_constructible0_test(__any); 2108227825Stheraven 2109227825Stheraventemplate <class _Tp, class _A0> 2110227825Stheravendecltype((_Tp(_VSTD::declval<_A0>()), true_type())) 2111227825Stheraven__is_constructible1_test(_Tp&, _A0&); 2112227825Stheraven 2113227825Stheraventemplate <class _A0> 2114227825Stheravenfalse_type 2115227825Stheraven__is_constructible1_test(__any, _A0&); 2116227825Stheraven 2117227825Stheraventemplate <class _Tp, class _A0, class _A1> 2118227825Stheravendecltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type())) 2119227825Stheraven__is_constructible2_test(_Tp&, _A0&, _A1&); 2120227825Stheraven 2121227825Stheraventemplate <class _A0, class _A1> 2122227825Stheravenfalse_type 2123227825Stheraven__is_constructible2_test(__any, _A0&, _A1&); 2124227825Stheraven 2125227825Stheraventemplate <bool, class _Tp> 2126227825Stheravenstruct __is_constructible0_imp // false, _Tp is not a scalar 2127227825Stheraven : public common_type 2128227825Stheraven < 2129227825Stheraven decltype(__is_constructible0_test(declval<_Tp&>())) 2130227825Stheraven >::type 2131227825Stheraven {}; 2132227825Stheraven 2133227825Stheraventemplate <bool, class _Tp, class _A0> 2134227825Stheravenstruct __is_constructible1_imp // false, _Tp is not a scalar 2135227825Stheraven : public common_type 2136227825Stheraven < 2137227825Stheraven decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>())) 2138227825Stheraven >::type 2139227825Stheraven {}; 2140227825Stheraven 2141227825Stheraventemplate <bool, class _Tp, class _A0, class _A1> 2142227825Stheravenstruct __is_constructible2_imp // false, _Tp is not a scalar 2143227825Stheraven : public common_type 2144227825Stheraven < 2145227825Stheraven decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>())) 2146227825Stheraven >::type 2147227825Stheraven {}; 2148227825Stheraven 2149227825Stheraven// handle scalars and reference types 2150227825Stheraven 2151227825Stheraven// Scalars are default constructible, references are not 2152227825Stheraven 2153227825Stheraventemplate <class _Tp> 2154227825Stheravenstruct __is_constructible0_imp<true, _Tp> 2155227825Stheraven : public is_scalar<_Tp> 2156227825Stheraven {}; 2157227825Stheraven 2158227825Stheraventemplate <class _Tp, class _A0> 2159227825Stheravenstruct __is_constructible1_imp<true, _Tp, _A0> 2160227825Stheraven : public is_convertible<_A0, _Tp> 2161227825Stheraven {}; 2162227825Stheraven 2163227825Stheraventemplate <class _Tp, class _A0, class _A1> 2164227825Stheravenstruct __is_constructible2_imp<true, _Tp, _A0, _A1> 2165227825Stheraven : public false_type 2166227825Stheraven {}; 2167227825Stheraven 2168227825Stheraven// Treat scalars and reference types separately 2169227825Stheraven 2170227825Stheraventemplate <bool, class _Tp> 2171227825Stheravenstruct __is_constructible0_void_check 2172227825Stheraven : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2173227825Stheraven _Tp> 2174227825Stheraven {}; 2175227825Stheraven 2176227825Stheraventemplate <bool, class _Tp, class _A0> 2177227825Stheravenstruct __is_constructible1_void_check 2178227825Stheraven : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2179227825Stheraven _Tp, _A0> 2180227825Stheraven {}; 2181227825Stheraven 2182227825Stheraventemplate <bool, class _Tp, class _A0, class _A1> 2183227825Stheravenstruct __is_constructible2_void_check 2184227825Stheraven : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2185227825Stheraven _Tp, _A0, _A1> 2186227825Stheraven {}; 2187227825Stheraven 2188227825Stheraven// If any of T or Args is void, is_constructible should be false 2189227825Stheraven 2190227825Stheraventemplate <class _Tp> 2191227825Stheravenstruct __is_constructible0_void_check<true, _Tp> 2192227825Stheraven : public false_type 2193227825Stheraven {}; 2194227825Stheraven 2195227825Stheraventemplate <class _Tp, class _A0> 2196227825Stheravenstruct __is_constructible1_void_check<true, _Tp, _A0> 2197227825Stheraven : public false_type 2198227825Stheraven {}; 2199227825Stheraven 2200227825Stheraventemplate <class _Tp, class _A0, class _A1> 2201227825Stheravenstruct __is_constructible2_void_check<true, _Tp, _A0, _A1> 2202227825Stheraven : public false_type 2203227825Stheraven {}; 2204227825Stheraven 2205227825Stheraven// is_constructible entry point 2206227825Stheraven 2207227825Stheravennamespace __is_construct 2208227825Stheraven{ 2209227825Stheraven 2210227825Stheravenstruct __nat {}; 2211227825Stheraven 2212227825Stheraven} 2213227825Stheraven 2214227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2215227825Stheraven class _A1 = __is_construct::__nat> 2216262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible 2217227825Stheraven : public __is_constructible2_void_check<is_void<_Tp>::value 2218227825Stheraven || is_abstract<_Tp>::value 2219227825Stheraven || is_function<_Tp>::value 2220227825Stheraven || is_void<_A0>::value 2221227825Stheraven || is_void<_A1>::value, 2222227825Stheraven _Tp, _A0, _A1> 2223227825Stheraven {}; 2224227825Stheraven 2225227825Stheraventemplate <class _Tp> 2226262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> 2227227825Stheraven : public __is_constructible0_void_check<is_void<_Tp>::value 2228227825Stheraven || is_abstract<_Tp>::value 2229227825Stheraven || is_function<_Tp>::value, 2230227825Stheraven _Tp> 2231227825Stheraven {}; 2232227825Stheraven 2233227825Stheraventemplate <class _Tp, class _A0> 2234262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, _A0, __is_construct::__nat> 2235227825Stheraven : public __is_constructible1_void_check<is_void<_Tp>::value 2236227825Stheraven || is_abstract<_Tp>::value 2237227825Stheraven || is_function<_Tp>::value 2238227825Stheraven || is_void<_A0>::value, 2239227825Stheraven _Tp, _A0> 2240227825Stheraven {}; 2241227825Stheraven 2242227825Stheraven// Array types are default constructible if their element type 2243227825Stheraven// is default constructible 2244227825Stheraven 2245232950Stheraventemplate <class _Ap, size_t _Np> 2246232950Stheravenstruct __is_constructible0_imp<false, _Ap[_Np]> 2247232950Stheraven : public is_constructible<typename remove_all_extents<_Ap>::type> 2248227825Stheraven {}; 2249227825Stheraven 2250232950Stheraventemplate <class _Ap, size_t _Np, class _A0> 2251232950Stheravenstruct __is_constructible1_imp<false, _Ap[_Np], _A0> 2252227825Stheraven : public false_type 2253227825Stheraven {}; 2254227825Stheraven 2255232950Stheraventemplate <class _Ap, size_t _Np, class _A0, class _A1> 2256232950Stheravenstruct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1> 2257227825Stheraven : public false_type 2258227825Stheraven {}; 2259227825Stheraven 2260227825Stheraven// Incomplete array types are not constructible 2261227825Stheraven 2262232950Stheraventemplate <class _Ap> 2263232950Stheravenstruct __is_constructible0_imp<false, _Ap[]> 2264227825Stheraven : public false_type 2265227825Stheraven {}; 2266227825Stheraven 2267232950Stheraventemplate <class _Ap, class _A0> 2268232950Stheravenstruct __is_constructible1_imp<false, _Ap[], _A0> 2269227825Stheraven : public false_type 2270227825Stheraven {}; 2271227825Stheraven 2272232950Stheraventemplate <class _Ap, class _A0, class _A1> 2273232950Stheravenstruct __is_constructible2_imp<false, _Ap[], _A0, _A1> 2274227825Stheraven : public false_type 2275227825Stheraven {}; 2276227825Stheraven 2277227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2278227825Stheraven 2279227825Stheraven// is_default_constructible 2280227825Stheraven 2281227825Stheraventemplate <class _Tp> 2282262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_default_constructible 2283227825Stheraven : public is_constructible<_Tp> 2284227825Stheraven {}; 2285227825Stheraven 2286227825Stheraven// is_copy_constructible 2287227825Stheraven 2288227825Stheraventemplate <class _Tp> 2289262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_copy_constructible 2290227825Stheraven : public is_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> 2291227825Stheraven {}; 2292227825Stheraven 2293227825Stheraven// is_move_constructible 2294227825Stheraven 2295227825Stheraventemplate <class _Tp> 2296262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_move_constructible 2297227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2298227825Stheraven : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2299227825Stheraven#else 2300227825Stheraven : public is_copy_constructible<_Tp> 2301227825Stheraven#endif 2302227825Stheraven {}; 2303227825Stheraven 2304227825Stheraven// is_trivially_constructible 2305227825Stheraven 2306227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2307227825Stheraven 2308232950Stheraven#if __has_feature(is_trivially_constructible) 2309232950Stheraven 2310227825Stheraventemplate <class _Tp, class... _Args> 2311262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2312232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> 2313232950Stheraven{ 2314232950Stheraven}; 2315232950Stheraven 2316232950Stheraven#else // !__has_feature(is_trivially_constructible) 2317232950Stheraven 2318232950Stheraventemplate <class _Tp, class... _Args> 2319262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2320227825Stheraven : false_type 2321227825Stheraven{ 2322227825Stheraven}; 2323227825Stheraven 2324227825Stheraventemplate <class _Tp> 2325262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp> 2326227825Stheraven#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2327227825Stheraven : integral_constant<bool, __has_trivial_constructor(_Tp)> 2328227825Stheraven#else 2329227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2330227825Stheraven#endif 2331227825Stheraven{ 2332227825Stheraven}; 2333227825Stheraven 2334227825Stheraventemplate <class _Tp> 2335227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2336262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&&> 2337227825Stheraven#else 2338262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp> 2339227825Stheraven#endif 2340227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2341227825Stheraven{ 2342227825Stheraven}; 2343227825Stheraven 2344227825Stheraventemplate <class _Tp> 2345262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&> 2346227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2347227825Stheraven{ 2348227825Stheraven}; 2349227825Stheraven 2350227825Stheraventemplate <class _Tp> 2351262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&> 2352227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2353227825Stheraven{ 2354227825Stheraven}; 2355227825Stheraven 2356232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2357232950Stheraven 2358227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2359227825Stheraven 2360227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2361227825Stheraven class _A1 = __is_construct::__nat> 2362262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2363227825Stheraven : false_type 2364227825Stheraven{ 2365227825Stheraven}; 2366227825Stheraven 2367232950Stheraven#if __has_feature(is_trivially_constructible) 2368232950Stheraven 2369227825Stheraventemplate <class _Tp> 2370262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, 2371227825Stheraven __is_construct::__nat> 2372232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp)> 2373232950Stheraven{ 2374232950Stheraven}; 2375232950Stheraven 2376232950Stheraventemplate <class _Tp> 2377262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp, 2378232950Stheraven __is_construct::__nat> 2379232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)> 2380232950Stheraven{ 2381232950Stheraven}; 2382232950Stheraven 2383232950Stheraventemplate <class _Tp> 2384262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&, 2385232950Stheraven __is_construct::__nat> 2386232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)> 2387232950Stheraven{ 2388232950Stheraven}; 2389232950Stheraven 2390232950Stheraventemplate <class _Tp> 2391262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&, 2392232950Stheraven __is_construct::__nat> 2393232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)> 2394232950Stheraven{ 2395232950Stheraven}; 2396232950Stheraven 2397232950Stheraven#else // !__has_feature(is_trivially_constructible) 2398232950Stheraven 2399232950Stheraventemplate <class _Tp> 2400262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, 2401232950Stheraven __is_construct::__nat> 2402227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2403227825Stheraven{ 2404227825Stheraven}; 2405227825Stheraven 2406227825Stheraventemplate <class _Tp> 2407262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp, 2408227825Stheraven __is_construct::__nat> 2409227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2410227825Stheraven{ 2411227825Stheraven}; 2412227825Stheraven 2413227825Stheraventemplate <class _Tp> 2414262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&, 2415227825Stheraven __is_construct::__nat> 2416227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2417227825Stheraven{ 2418227825Stheraven}; 2419227825Stheraven 2420227825Stheraventemplate <class _Tp> 2421262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&, 2422227825Stheraven __is_construct::__nat> 2423227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2424227825Stheraven{ 2425227825Stheraven}; 2426227825Stheraven 2427232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2428232950Stheraven 2429227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2430227825Stheraven 2431227825Stheraven// is_trivially_default_constructible 2432227825Stheraven 2433262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_default_constructible 2434227825Stheraven : public is_trivially_constructible<_Tp> 2435227825Stheraven {}; 2436227825Stheraven 2437227825Stheraven// is_trivially_copy_constructible 2438227825Stheraven 2439262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_constructible 2440262801Sdim : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type> 2441227825Stheraven {}; 2442227825Stheraven 2443227825Stheraven// is_trivially_move_constructible 2444227825Stheraven 2445262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructible 2446227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2447227825Stheraven : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2448227825Stheraven#else 2449227825Stheraven : public is_trivially_copy_constructible<_Tp> 2450227825Stheraven#endif 2451227825Stheraven {}; 2452227825Stheraven 2453227825Stheraven// is_trivially_assignable 2454227825Stheraven 2455232950Stheraven#if __has_feature(is_trivially_constructible) 2456232950Stheraven 2457227825Stheraventemplate <class _Tp, class _Arg> 2458227825Stheravenstruct is_trivially_assignable 2459232950Stheraven : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> 2460232950Stheraven{ 2461232950Stheraven}; 2462232950Stheraven 2463232950Stheraven#else // !__has_feature(is_trivially_constructible) 2464232950Stheraven 2465232950Stheraventemplate <class _Tp, class _Arg> 2466232950Stheravenstruct is_trivially_assignable 2467227825Stheraven : public false_type {}; 2468227825Stheraven 2469227825Stheraventemplate <class _Tp> 2470227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp> 2471227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2472227825Stheraven 2473227825Stheraventemplate <class _Tp> 2474227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp&> 2475227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2476227825Stheraven 2477227825Stheraventemplate <class _Tp> 2478227825Stheravenstruct is_trivially_assignable<_Tp&, const _Tp&> 2479227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2480227825Stheraven 2481227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2482227825Stheraven 2483227825Stheraventemplate <class _Tp> 2484227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp&&> 2485227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2486227825Stheraven 2487227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2488227825Stheraven 2489232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2490232950Stheraven 2491227825Stheraven// is_trivially_copy_assignable 2492227825Stheraven 2493262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_assignable 2494227825Stheraven : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2495227825Stheraven const typename add_lvalue_reference<_Tp>::type> 2496227825Stheraven {}; 2497227825Stheraven 2498227825Stheraven// is_trivially_move_assignable 2499227825Stheraven 2500262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable 2501227825Stheraven : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2502227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2503227825Stheraven typename add_rvalue_reference<_Tp>::type> 2504227825Stheraven#else 2505227825Stheraven typename add_lvalue_reference<_Tp>::type> 2506227825Stheraven#endif 2507227825Stheraven {}; 2508227825Stheraven 2509227825Stheraven// is_trivially_destructible 2510227825Stheraven 2511227825Stheraven#if __has_feature(has_trivial_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2512227825Stheraven 2513262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible 2514227825Stheraven : public integral_constant<bool, __has_trivial_destructor(_Tp)> {}; 2515227825Stheraven 2516227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 2517227825Stheraven 2518227825Stheraventemplate <class _Tp> struct __libcpp_trivial_destructor 2519227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 2520227825Stheraven is_reference<_Tp>::value> {}; 2521227825Stheraven 2522262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible 2523227825Stheraven : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {}; 2524227825Stheraven 2525227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 2526227825Stheraven 2527227825Stheraven// is_nothrow_constructible 2528227825Stheraven 2529227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2530227825Stheraven 2531227825Stheraven#if __has_feature(cxx_noexcept) 2532227825Stheraven 2533227825Stheraventemplate <bool, class _Tp, class... _Args> struct __is_nothrow_constructible; 2534227825Stheraven 2535227825Stheraventemplate <class _Tp, class... _Args> 2536227825Stheravenstruct __is_nothrow_constructible<true, _Tp, _Args...> 2537227825Stheraven : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> 2538227825Stheraven{ 2539227825Stheraven}; 2540227825Stheraven 2541227825Stheraventemplate <class _Tp, class... _Args> 2542227825Stheravenstruct __is_nothrow_constructible<false, _Tp, _Args...> 2543227825Stheraven : public false_type 2544227825Stheraven{ 2545227825Stheraven}; 2546227825Stheraven 2547227825Stheraventemplate <class _Tp, class... _Args> 2548262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2549227825Stheraven : __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...> 2550227825Stheraven{ 2551227825Stheraven}; 2552227825Stheraven 2553227825Stheraventemplate <class _Tp, size_t _Ns> 2554262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]> 2555227825Stheraven : __is_nothrow_constructible<is_constructible<_Tp>::value, _Tp> 2556227825Stheraven{ 2557227825Stheraven}; 2558227825Stheraven 2559227825Stheraven#else // __has_feature(cxx_noexcept) 2560227825Stheraven 2561227825Stheraventemplate <class _Tp, class... _Args> 2562262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2563227825Stheraven : false_type 2564227825Stheraven{ 2565227825Stheraven}; 2566227825Stheraven 2567227825Stheraventemplate <class _Tp> 2568262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp> 2569227825Stheraven#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2570227825Stheraven : integral_constant<bool, __has_nothrow_constructor(_Tp)> 2571227825Stheraven#else 2572227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2573227825Stheraven#endif 2574227825Stheraven{ 2575227825Stheraven}; 2576227825Stheraven 2577227825Stheraventemplate <class _Tp> 2578227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2579262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&&> 2580227825Stheraven#else 2581262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp> 2582227825Stheraven#endif 2583227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2584227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2585227825Stheraven#else 2586227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2587227825Stheraven#endif 2588227825Stheraven{ 2589227825Stheraven}; 2590227825Stheraven 2591227825Stheraventemplate <class _Tp> 2592262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&> 2593227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2594227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2595227825Stheraven#else 2596227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2597227825Stheraven#endif 2598227825Stheraven{ 2599227825Stheraven}; 2600227825Stheraven 2601227825Stheraventemplate <class _Tp> 2602262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&> 2603227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2604227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2605227825Stheraven#else 2606227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2607227825Stheraven#endif 2608227825Stheraven{ 2609227825Stheraven}; 2610227825Stheraven 2611227825Stheraven#endif // __has_feature(cxx_noexcept) 2612227825Stheraven 2613227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2614227825Stheraven 2615227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2616227825Stheraven class _A1 = __is_construct::__nat> 2617262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2618227825Stheraven : false_type 2619227825Stheraven{ 2620227825Stheraven}; 2621227825Stheraven 2622227825Stheraventemplate <class _Tp> 2623262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat, 2624227825Stheraven __is_construct::__nat> 2625227825Stheraven#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2626227825Stheraven : integral_constant<bool, __has_nothrow_constructor(_Tp)> 2627227825Stheraven#else 2628227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2629227825Stheraven#endif 2630227825Stheraven{ 2631227825Stheraven}; 2632227825Stheraven 2633227825Stheraventemplate <class _Tp> 2634262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp, 2635227825Stheraven __is_construct::__nat> 2636227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2637227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2638227825Stheraven#else 2639227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2640227825Stheraven#endif 2641227825Stheraven{ 2642227825Stheraven}; 2643227825Stheraven 2644227825Stheraventemplate <class _Tp> 2645262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&, 2646227825Stheraven __is_construct::__nat> 2647227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2648227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2649227825Stheraven#else 2650227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2651227825Stheraven#endif 2652227825Stheraven{ 2653227825Stheraven}; 2654227825Stheraven 2655227825Stheraventemplate <class _Tp> 2656262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&, 2657227825Stheraven __is_construct::__nat> 2658227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2659227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2660227825Stheraven#else 2661227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2662227825Stheraven#endif 2663227825Stheraven{ 2664227825Stheraven}; 2665227825Stheraven 2666227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2667227825Stheraven 2668227825Stheraven// is_nothrow_default_constructible 2669227825Stheraven 2670262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_default_constructible 2671227825Stheraven : public is_nothrow_constructible<_Tp> 2672227825Stheraven {}; 2673227825Stheraven 2674227825Stheraven// is_nothrow_copy_constructible 2675227825Stheraven 2676262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_constructible 2677227825Stheraven : public is_nothrow_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> 2678227825Stheraven {}; 2679227825Stheraven 2680227825Stheraven// is_nothrow_move_constructible 2681227825Stheraven 2682262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible 2683227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2684227825Stheraven : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2685227825Stheraven#else 2686227825Stheraven : public is_nothrow_copy_constructible<_Tp> 2687227825Stheraven#endif 2688227825Stheraven {}; 2689227825Stheraven 2690227825Stheraven// is_nothrow_assignable 2691227825Stheraven 2692227825Stheraven#if __has_feature(cxx_noexcept) 2693227825Stheraven 2694227825Stheraventemplate <bool, class _Tp, class _Arg> struct __is_nothrow_assignable; 2695227825Stheraven 2696227825Stheraventemplate <class _Tp, class _Arg> 2697227825Stheravenstruct __is_nothrow_assignable<false, _Tp, _Arg> 2698227825Stheraven : public false_type 2699227825Stheraven{ 2700227825Stheraven}; 2701227825Stheraven 2702227825Stheraventemplate <class _Tp, class _Arg> 2703227825Stheravenstruct __is_nothrow_assignable<true, _Tp, _Arg> 2704227825Stheraven : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) > 2705227825Stheraven{ 2706227825Stheraven}; 2707227825Stheraven 2708227825Stheraventemplate <class _Tp, class _Arg> 2709262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable 2710227825Stheraven : public __is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg> 2711227825Stheraven{ 2712227825Stheraven}; 2713227825Stheraven 2714227825Stheraven#else // __has_feature(cxx_noexcept) 2715227825Stheraven 2716227825Stheraventemplate <class _Tp, class _Arg> 2717262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable 2718227825Stheraven : public false_type {}; 2719227825Stheraven 2720227825Stheraventemplate <class _Tp> 2721262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp> 2722227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2723227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2724227825Stheraven#else 2725227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2726227825Stheraven#endif 2727227825Stheraven 2728227825Stheraventemplate <class _Tp> 2729262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp&> 2730227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2731227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2732227825Stheraven#else 2733227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2734227825Stheraven#endif 2735227825Stheraven 2736227825Stheraventemplate <class _Tp> 2737262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _Tp&> 2738227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2739227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2740227825Stheraven#else 2741227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2742227825Stheraven#endif 2743227825Stheraven 2744227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2745227825Stheraven 2746227825Stheraventemplate <class _Tp> 2747227825Stheravenstruct is_nothrow_assignable<_Tp&, _Tp&&> 2748227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2749227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2750227825Stheraven#else 2751227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2752227825Stheraven#endif 2753227825Stheraven 2754227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2755227825Stheraven 2756227825Stheraven#endif // __has_feature(cxx_noexcept) 2757227825Stheraven 2758227825Stheraven// is_nothrow_copy_assignable 2759227825Stheraven 2760262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable 2761227825Stheraven : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 2762227825Stheraven const typename add_lvalue_reference<_Tp>::type> 2763227825Stheraven {}; 2764227825Stheraven 2765227825Stheraven// is_nothrow_move_assignable 2766227825Stheraven 2767262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable 2768227825Stheraven : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 2769227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2770227825Stheraven typename add_rvalue_reference<_Tp>::type> 2771227825Stheraven#else 2772227825Stheraven typename add_lvalue_reference<_Tp>::type> 2773227825Stheraven#endif 2774227825Stheraven {}; 2775227825Stheraven 2776227825Stheraven// is_nothrow_destructible 2777227825Stheraven 2778227825Stheraven#if __has_feature(cxx_noexcept) 2779227825Stheraven 2780227825Stheraventemplate <bool, class _Tp> struct __is_nothrow_destructible; 2781227825Stheraven 2782227825Stheraventemplate <class _Tp> 2783227825Stheravenstruct __is_nothrow_destructible<false, _Tp> 2784227825Stheraven : public false_type 2785227825Stheraven{ 2786227825Stheraven}; 2787227825Stheraven 2788227825Stheraventemplate <class _Tp> 2789227825Stheravenstruct __is_nothrow_destructible<true, _Tp> 2790227825Stheraven : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) > 2791227825Stheraven{ 2792227825Stheraven}; 2793227825Stheraven 2794227825Stheraventemplate <class _Tp> 2795262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible 2796227825Stheraven : public __is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> 2797227825Stheraven{ 2798227825Stheraven}; 2799227825Stheraven 2800227825Stheraventemplate <class _Tp, size_t _Ns> 2801262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[_Ns]> 2802227825Stheraven : public is_nothrow_destructible<_Tp> 2803227825Stheraven{ 2804227825Stheraven}; 2805227825Stheraven 2806227825Stheraventemplate <class _Tp> 2807262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&> 2808227825Stheraven : public true_type 2809227825Stheraven{ 2810227825Stheraven}; 2811227825Stheraven 2812227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2813227825Stheraven 2814227825Stheraventemplate <class _Tp> 2815262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&&> 2816227825Stheraven : public true_type 2817227825Stheraven{ 2818227825Stheraven}; 2819227825Stheraven 2820227825Stheraven#endif 2821227825Stheraven 2822227825Stheraven#else 2823227825Stheraven 2824227825Stheraventemplate <class _Tp> struct __libcpp_nothrow_destructor 2825227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 2826227825Stheraven is_reference<_Tp>::value> {}; 2827227825Stheraven 2828262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible 2829227825Stheraven : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {}; 2830227825Stheraven 2831227825Stheraven#endif 2832227825Stheraven 2833227825Stheraven// is_pod 2834227825Stheraven 2835227825Stheraven#if __has_feature(is_pod) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2836227825Stheraven 2837262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod 2838227825Stheraven : public integral_constant<bool, __is_pod(_Tp)> {}; 2839227825Stheraven 2840227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 2841227825Stheraven 2842262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod 2843227825Stheraven : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value && 2844227825Stheraven is_trivially_copy_constructible<_Tp>::value && 2845227825Stheraven is_trivially_copy_assignable<_Tp>::value && 2846227825Stheraven is_trivially_destructible<_Tp>::value> {}; 2847227825Stheraven 2848227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 2849227825Stheraven 2850227825Stheraven// is_literal_type; 2851227825Stheraven 2852262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type 2853227825Stheraven#if __has_feature(is_literal) 2854227825Stheraven : public integral_constant<bool, __is_literal(_Tp)> 2855227825Stheraven#else 2856227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value || 2857227825Stheraven is_reference<typename remove_all_extents<_Tp>::type>::value> 2858227825Stheraven#endif 2859227825Stheraven {}; 2860227825Stheraven 2861227825Stheraven// is_standard_layout; 2862227825Stheraven 2863262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout 2864227825Stheraven#if __has_feature(is_standard_layout) 2865227825Stheraven : public integral_constant<bool, __is_standard_layout(_Tp)> 2866227825Stheraven#else 2867227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 2868227825Stheraven#endif 2869227825Stheraven {}; 2870227825Stheraven 2871227825Stheraven// is_trivially_copyable; 2872227825Stheraven 2873262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable 2874227825Stheraven#if __has_feature(is_trivially_copyable) 2875227825Stheraven : public integral_constant<bool, __is_trivially_copyable(_Tp)> 2876227825Stheraven#else 2877227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 2878227825Stheraven#endif 2879227825Stheraven {}; 2880227825Stheraven 2881227825Stheraven// is_trivial; 2882227825Stheraven 2883262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial 2884227825Stheraven#if __has_feature(is_trivial) 2885227825Stheraven : public integral_constant<bool, __is_trivial(_Tp)> 2886227825Stheraven#else 2887227825Stheraven : integral_constant<bool, is_trivially_copyable<_Tp>::value && 2888227825Stheraven is_trivially_default_constructible<_Tp>::value> 2889227825Stheraven#endif 2890227825Stheraven {}; 2891227825Stheraven 2892227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2893227825Stheraven 2894227825Stheraven// Check for complete types 2895227825Stheraven 2896232950Stheraventemplate <class ..._Tp> struct __check_complete; 2897227825Stheraven 2898227825Stheraventemplate <> 2899227825Stheravenstruct __check_complete<> 2900227825Stheraven{ 2901227825Stheraven}; 2902227825Stheraven 2903232950Stheraventemplate <class _Hp, class _T0, class ..._Tp> 2904232950Stheravenstruct __check_complete<_Hp, _T0, _Tp...> 2905232950Stheraven : private __check_complete<_Hp>, 2906232950Stheraven private __check_complete<_T0, _Tp...> 2907227825Stheraven{ 2908227825Stheraven}; 2909227825Stheraven 2910232950Stheraventemplate <class _Hp> 2911232950Stheravenstruct __check_complete<_Hp, _Hp> 2912232950Stheraven : private __check_complete<_Hp> 2913227825Stheraven{ 2914227825Stheraven}; 2915227825Stheraven 2916232950Stheraventemplate <class _Tp> 2917232950Stheravenstruct __check_complete<_Tp> 2918227825Stheraven{ 2919232950Stheraven static_assert(sizeof(_Tp) > 0, "Type must be complete."); 2920227825Stheraven}; 2921227825Stheraven 2922232950Stheraventemplate <class _Tp> 2923232950Stheravenstruct __check_complete<_Tp&> 2924232950Stheraven : private __check_complete<_Tp> 2925227825Stheraven{ 2926227825Stheraven}; 2927227825Stheraven 2928232950Stheraventemplate <class _Tp> 2929232950Stheravenstruct __check_complete<_Tp&&> 2930232950Stheraven : private __check_complete<_Tp> 2931227825Stheraven{ 2932227825Stheraven}; 2933227825Stheraven 2934232950Stheraventemplate <class _Rp, class ..._Param> 2935232950Stheravenstruct __check_complete<_Rp (*)(_Param...)> 2936241903Sdim : private __check_complete<_Rp> 2937227825Stheraven{ 2938227825Stheraven}; 2939227825Stheraven 2940262801Sdimtemplate <class ..._Param> 2941262801Sdimstruct __check_complete<void (*)(_Param...)> 2942262801Sdim{ 2943262801Sdim}; 2944262801Sdim 2945232950Stheraventemplate <class _Rp, class ..._Param> 2946232950Stheravenstruct __check_complete<_Rp (_Param...)> 2947241903Sdim : private __check_complete<_Rp> 2948227825Stheraven{ 2949227825Stheraven}; 2950227825Stheraven 2951262801Sdimtemplate <class ..._Param> 2952262801Sdimstruct __check_complete<void (_Param...)> 2953262801Sdim{ 2954262801Sdim}; 2955262801Sdim 2956232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2957232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...)> 2958241903Sdim : private __check_complete<_Class> 2959227825Stheraven{ 2960227825Stheraven}; 2961227825Stheraven 2962232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2963232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const> 2964241903Sdim : private __check_complete<_Class> 2965227825Stheraven{ 2966227825Stheraven}; 2967227825Stheraven 2968232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2969232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile> 2970241903Sdim : private __check_complete<_Class> 2971227825Stheraven{ 2972227825Stheraven}; 2973227825Stheraven 2974232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2975232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile> 2976241903Sdim : private __check_complete<_Class> 2977227825Stheraven{ 2978227825Stheraven}; 2979227825Stheraven 2980227825Stheraven#if __has_feature(cxx_reference_qualified_functions) 2981227825Stheraven 2982232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2983232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) &> 2984241903Sdim : private __check_complete<_Class> 2985227825Stheraven{ 2986227825Stheraven}; 2987227825Stheraven 2988232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2989232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const&> 2990241903Sdim : private __check_complete<_Class> 2991227825Stheraven{ 2992227825Stheraven}; 2993227825Stheraven 2994232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2995232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile&> 2996241903Sdim : private __check_complete<_Class> 2997227825Stheraven{ 2998227825Stheraven}; 2999227825Stheraven 3000232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3001232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> 3002241903Sdim : private __check_complete<_Class> 3003227825Stheraven{ 3004227825Stheraven}; 3005227825Stheraven 3006232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3007232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) &&> 3008241903Sdim : private __check_complete<_Class> 3009227825Stheraven{ 3010227825Stheraven}; 3011227825Stheraven 3012232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3013232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const&&> 3014241903Sdim : private __check_complete<_Class> 3015227825Stheraven{ 3016227825Stheraven}; 3017227825Stheraven 3018232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3019232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> 3020241903Sdim : private __check_complete<_Class> 3021227825Stheraven{ 3022227825Stheraven}; 3023227825Stheraven 3024232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3025232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> 3026241903Sdim : private __check_complete<_Class> 3027227825Stheraven{ 3028227825Stheraven}; 3029227825Stheraven 3030227825Stheraven#endif 3031227825Stheraven 3032232950Stheraventemplate <class _Rp, class _Class> 3033232950Stheravenstruct __check_complete<_Rp _Class::*> 3034227825Stheraven : private __check_complete<_Class> 3035227825Stheraven{ 3036227825Stheraven}; 3037227825Stheraven 3038227825Stheraven// __invoke forward declarations 3039227825Stheraven 3040227825Stheraven// fall back - none of the bullets 3041227825Stheraven 3042227825Stheraventemplate <class ..._Args> 3043227825Stheravenauto 3044227825Stheraven__invoke(__any, _Args&& ...__args) 3045227825Stheraven -> __nat; 3046227825Stheraven 3047227825Stheraven// bullets 1 and 2 3048227825Stheraven 3049253159Stheraventemplate <class _Fp, class _A0, class ..._Args, 3050253159Stheraven class = typename enable_if 3051253159Stheraven < 3052253159Stheraven is_member_function_pointer<typename remove_reference<_Fp>::type>::value && 3053253159Stheraven is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3054253159Stheraven typename remove_reference<_A0>::type>::value 3055253159Stheraven >::type 3056253159Stheraven > 3057241903Sdim_LIBCPP_INLINE_VISIBILITY 3058227825Stheravenauto 3059232950Stheraven__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 3060227825Stheraven -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)); 3061227825Stheraven 3062253159Stheraventemplate <class _Fp, class _A0, class ..._Args, 3063253159Stheraven class = typename enable_if 3064253159Stheraven < 3065253159Stheraven is_member_function_pointer<typename remove_reference<_Fp>::type>::value && 3066253159Stheraven !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3067253159Stheraven typename remove_reference<_A0>::type>::value 3068253159Stheraven >::type 3069253159Stheraven > 3070241903Sdim_LIBCPP_INLINE_VISIBILITY 3071227825Stheravenauto 3072232950Stheraven__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 3073227825Stheraven -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)); 3074227825Stheraven 3075227825Stheraven// bullets 3 and 4 3076227825Stheraven 3077253159Stheraventemplate <class _Fp, class _A0, 3078253159Stheraven class = typename enable_if 3079253159Stheraven < 3080253159Stheraven is_member_object_pointer<typename remove_reference<_Fp>::type>::value && 3081253159Stheraven is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3082253159Stheraven typename remove_reference<_A0>::type>::value 3083253159Stheraven >::type 3084253159Stheraven > 3085241903Sdim_LIBCPP_INLINE_VISIBILITY 3086227825Stheravenauto 3087232950Stheraven__invoke(_Fp&& __f, _A0&& __a0) 3088227825Stheraven -> decltype(_VSTD::forward<_A0>(__a0).*__f); 3089227825Stheraven 3090253159Stheraventemplate <class _Fp, class _A0, 3091253159Stheraven class = typename enable_if 3092253159Stheraven < 3093253159Stheraven is_member_object_pointer<typename remove_reference<_Fp>::type>::value && 3094253159Stheraven !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3095253159Stheraven typename remove_reference<_A0>::type>::value 3096253159Stheraven >::type 3097253159Stheraven > 3098241903Sdim_LIBCPP_INLINE_VISIBILITY 3099227825Stheravenauto 3100232950Stheraven__invoke(_Fp&& __f, _A0&& __a0) 3101227825Stheraven -> decltype((*_VSTD::forward<_A0>(__a0)).*__f); 3102227825Stheraven 3103227825Stheraven// bullet 5 3104227825Stheraven 3105232950Stheraventemplate <class _Fp, class ..._Args> 3106241903Sdim_LIBCPP_INLINE_VISIBILITY 3107227825Stheravenauto 3108232950Stheraven__invoke(_Fp&& __f, _Args&& ...__args) 3109232950Stheraven -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)); 3110227825Stheraven 3111227825Stheraven// __invokable 3112227825Stheraven 3113232950Stheraventemplate <class _Fp, class ..._Args> 3114227825Stheravenstruct __invokable_imp 3115241903Sdim : private __check_complete<_Fp> 3116227825Stheraven{ 3117227825Stheraven typedef decltype( 3118232950Stheraven __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...) 3119227825Stheraven ) type; 3120227825Stheraven static const bool value = !is_same<type, __nat>::value; 3121227825Stheraven}; 3122227825Stheraven 3123232950Stheraventemplate <class _Fp, class ..._Args> 3124227825Stheravenstruct __invokable 3125227825Stheraven : public integral_constant<bool, 3126232950Stheraven __invokable_imp<_Fp, _Args...>::value> 3127227825Stheraven{ 3128227825Stheraven}; 3129227825Stheraven 3130227825Stheraven// __invoke_of 3131227825Stheraven 3132232950Stheraventemplate <bool _Invokable, class _Fp, class ..._Args> 3133227825Stheravenstruct __invoke_of_imp // false 3134227825Stheraven{ 3135227825Stheraven}; 3136227825Stheraven 3137232950Stheraventemplate <class _Fp, class ..._Args> 3138232950Stheravenstruct __invoke_of_imp<true, _Fp, _Args...> 3139227825Stheraven{ 3140232950Stheraven typedef typename __invokable_imp<_Fp, _Args...>::type type; 3141227825Stheraven}; 3142227825Stheraven 3143232950Stheraventemplate <class _Fp, class ..._Args> 3144227825Stheravenstruct __invoke_of 3145232950Stheraven : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...> 3146227825Stheraven{ 3147227825Stheraven}; 3148227825Stheraven 3149241903Sdimtemplate <class _Fp, class ..._Args> 3150262801Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fp(_Args...)> 3151241903Sdim : public __invoke_of<_Fp, _Args...> 3152241903Sdim{ 3153241903Sdim}; 3154241903Sdim 3155253159Stheraven#if _LIBCPP_STD_VER > 11 3156253159Stheraventemplate <class _Tp> using result_of_t = typename result_of<_Tp>::type; 3157253159Stheraven#endif 3158253159Stheraven 3159227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 3160227825Stheraven 3161227825Stheraventemplate <class _Tp> 3162227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3163227825Stheraven#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE 3164227825Stheraventypename enable_if 3165227825Stheraven< 3166227825Stheraven is_move_constructible<_Tp>::value && 3167227825Stheraven is_move_assignable<_Tp>::value 3168227825Stheraven>::type 3169227825Stheraven#else 3170227825Stheravenvoid 3171227825Stheraven#endif 3172227825Stheravenswap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && 3173227825Stheraven is_nothrow_move_assignable<_Tp>::value) 3174227825Stheraven{ 3175227825Stheraven _Tp __t(_VSTD::move(__x)); 3176227825Stheraven __x = _VSTD::move(__y); 3177227825Stheraven __y = _VSTD::move(__t); 3178227825Stheraven} 3179227825Stheraven 3180227825Stheraventemplate <class _ForwardIterator1, class _ForwardIterator2> 3181227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3182227825Stheravenvoid 3183227825Stheraveniter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) 3184227825Stheraven // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b))) 3185227825Stheraven _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(), 3186227825Stheraven *_VSTD::declval<_ForwardIterator2>()))) 3187227825Stheraven{ 3188227825Stheraven swap(*__a, *__b); 3189227825Stheraven} 3190227825Stheraven 3191227825Stheraven// __swappable 3192227825Stheraven 3193227825Stheravennamespace __detail 3194227825Stheraven{ 3195227825Stheraven 3196227825Stheravenusing _VSTD::swap; 3197227825Stheraven__nat swap(__any, __any); 3198227825Stheraven 3199227825Stheraventemplate <class _Tp> 3200227825Stheravenstruct __swappable 3201227825Stheraven{ 3202227825Stheraven typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type; 3203227825Stheraven static const bool value = !is_same<type, __nat>::value; 3204227825Stheraven}; 3205227825Stheraven 3206227825Stheraven} // __detail 3207227825Stheraven 3208227825Stheraventemplate <class _Tp> 3209227825Stheravenstruct __is_swappable 3210227825Stheraven : public integral_constant<bool, __detail::__swappable<_Tp>::value> 3211227825Stheraven{ 3212227825Stheraven}; 3213227825Stheraven 3214227825Stheraven#if __has_feature(cxx_noexcept) 3215227825Stheraven 3216227825Stheraventemplate <bool, class _Tp> 3217227825Stheravenstruct __is_nothrow_swappable_imp 3218227825Stheraven : public integral_constant<bool, noexcept(swap(_VSTD::declval<_Tp&>(), 3219227825Stheraven _VSTD::declval<_Tp&>()))> 3220227825Stheraven{ 3221227825Stheraven}; 3222227825Stheraven 3223227825Stheraventemplate <class _Tp> 3224227825Stheravenstruct __is_nothrow_swappable_imp<false, _Tp> 3225227825Stheraven : public false_type 3226227825Stheraven{ 3227227825Stheraven}; 3228227825Stheraven 3229227825Stheraventemplate <class _Tp> 3230227825Stheravenstruct __is_nothrow_swappable 3231227825Stheraven : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp> 3232227825Stheraven{ 3233227825Stheraven}; 3234227825Stheraven 3235227825Stheraven#else // __has_feature(cxx_noexcept) 3236227825Stheraven 3237227825Stheraventemplate <class _Tp> 3238227825Stheravenstruct __is_nothrow_swappable 3239227825Stheraven : public false_type 3240227825Stheraven{ 3241227825Stheraven}; 3242227825Stheraven 3243227825Stheraven#endif // __has_feature(cxx_noexcept) 3244227825Stheraven 3245227825Stheraven#ifdef _LIBCXX_UNDERLYING_TYPE 3246227825Stheraven 3247227825Stheraventemplate <class _Tp> 3248227825Stheravenstruct underlying_type 3249227825Stheraven{ 3250227825Stheraven typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type; 3251227825Stheraven}; 3252227825Stheraven 3253253159Stheraven#if _LIBCPP_STD_VER > 11 3254253159Stheraventemplate <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type; 3255253159Stheraven#endif 3256253159Stheraven 3257227825Stheraven#else // _LIBCXX_UNDERLYING_TYPE 3258227825Stheraven 3259227825Stheraventemplate <class _Tp, bool _Support = false> 3260227825Stheravenstruct underlying_type 3261227825Stheraven{ 3262227825Stheraven static_assert(_Support, "The underyling_type trait requires compiler " 3263227825Stheraven "support. Either no such support exists or " 3264227825Stheraven "libc++ does not know how to use it."); 3265227825Stheraven}; 3266227825Stheraven 3267227825Stheraven#endif // _LIBCXX_UNDERLYING_TYPE 3268227825Stheraven 3269262801Sdim#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE 3270262801Sdim 3271262801Sdimtemplate <class _Tp> 3272262801Sdimstruct __has_operator_addressof_imp 3273262801Sdim{ 3274262801Sdim template <class> 3275262801Sdim static auto __test(__any) -> false_type; 3276262801Sdim template <class _Up> 3277262801Sdim static auto __test(_Up* __u) 3278262801Sdim -> typename __select_2nd<decltype(__u->operator&()), true_type>::type; 3279262801Sdim 3280262801Sdim static const bool value = decltype(__test<_Tp>(nullptr))::value; 3281262801Sdim}; 3282262801Sdim 3283262801Sdimtemplate <class _Tp> 3284262801Sdimstruct __has_operator_addressof 3285262801Sdim : public integral_constant<bool, __has_operator_addressof_imp<_Tp>::value> 3286262801Sdim{}; 3287262801Sdim 3288262801Sdim#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE 3289262801Sdim 3290227825Stheraven_LIBCPP_END_NAMESPACE_STD 3291227825Stheraven 3292227825Stheraven#endif // _LIBCPP_TYPE_TRAITS 3293