type_traits revision 234976
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; 31227825Stheraven template <class T> struct is_integral; 32227825Stheraven template <class T> struct is_floating_point; 33227825Stheraven template <class T> struct is_array; 34227825Stheraven template <class T> struct is_pointer; 35227825Stheraven template <class T> struct is_lvalue_reference; 36227825Stheraven template <class T> struct is_rvalue_reference; 37227825Stheraven template <class T> struct is_member_object_pointer; 38227825Stheraven template <class T> struct is_member_function_pointer; 39227825Stheraven template <class T> struct is_enum; 40227825Stheraven template <class T> struct is_union; 41227825Stheraven template <class T> struct is_class; 42227825Stheraven template <class T> struct is_function; 43227825Stheraven 44227825Stheraven // Secondary classification traits: 45227825Stheraven template <class T> struct is_reference; 46227825Stheraven template <class T> struct is_arithmetic; 47227825Stheraven template <class T> struct is_fundamental; 48227825Stheraven template <class T> struct is_member_pointer; 49227825Stheraven template <class T> struct is_scalar; 50227825Stheraven template <class T> struct is_object; 51227825Stheraven template <class T> struct is_compound; 52227825Stheraven 53227825Stheraven // Const-volatile properties and transformations: 54227825Stheraven template <class T> struct is_const; 55227825Stheraven template <class T> struct is_volatile; 56227825Stheraven template <class T> struct remove_const; 57227825Stheraven template <class T> struct remove_volatile; 58227825Stheraven template <class T> struct remove_cv; 59227825Stheraven template <class T> struct add_const; 60227825Stheraven template <class T> struct add_volatile; 61227825Stheraven template <class T> struct add_cv; 62227825Stheraven 63227825Stheraven // Reference transformations: 64227825Stheraven template <class T> struct remove_reference; 65227825Stheraven template <class T> struct add_lvalue_reference; 66227825Stheraven template <class T> struct add_rvalue_reference; 67227825Stheraven 68227825Stheraven // Pointer transformations: 69227825Stheraven template <class T> struct remove_pointer; 70227825Stheraven template <class T> struct add_pointer; 71227825Stheraven 72227825Stheraven // Integral properties: 73227825Stheraven template <class T> struct is_signed; 74227825Stheraven template <class T> struct is_unsigned; 75227825Stheraven template <class T> struct make_signed; 76227825Stheraven template <class T> struct make_unsigned; 77227825Stheraven 78227825Stheraven // Array properties and transformations: 79227825Stheraven template <class T> struct rank; 80227825Stheraven template <class T, unsigned I = 0> struct extent; 81227825Stheraven template <class T> struct remove_extent; 82227825Stheraven template <class T> struct remove_all_extents; 83227825Stheraven 84227825Stheraven // Member introspection: 85227825Stheraven template <class T> struct is_pod; 86227825Stheraven template <class T> struct is_trivial; 87227825Stheraven template <class T> struct is_trivially_copyable; 88227825Stheraven template <class T> struct is_standard_layout; 89227825Stheraven template <class T> struct is_literal_type; 90227825Stheraven template <class T> struct is_empty; 91227825Stheraven template <class T> struct is_polymorphic; 92227825Stheraven template <class T> struct is_abstract; 93227825Stheraven 94227825Stheraven template <class T, class... Args> struct is_constructible; 95227825Stheraven template <class T> struct is_default_constructible; 96227825Stheraven template <class T> struct is_copy_constructible; 97227825Stheraven template <class T> struct is_move_constructible; 98227825Stheraven template <class T, class U> struct is_assignable; 99227825Stheraven template <class T> struct is_copy_assignable; 100227825Stheraven template <class T> struct is_move_assignable; 101227825Stheraven template <class T> struct is_destructible; 102227825Stheraven 103227825Stheraven template <class T, class... Args> struct is_trivially_constructible; 104227825Stheraven template <class T> struct is_trivially_default_constructible; 105227825Stheraven template <class T> struct is_trivially_copy_constructible; 106227825Stheraven template <class T> struct is_trivially_move_constructible; 107227825Stheraven template <class T, class U> struct is_trivially_assignable; 108227825Stheraven template <class T> struct is_trivially_copy_assignable; 109227825Stheraven template <class T> struct is_trivially_move_assignable; 110227825Stheraven template <class T> struct is_trivially_destructible; 111227825Stheraven 112227825Stheraven template <class T, class... Args> struct is_nothrow_constructible; 113227825Stheraven template <class T> struct is_nothrow_default_constructible; 114227825Stheraven template <class T> struct is_nothrow_copy_constructible; 115227825Stheraven template <class T> struct is_nothrow_move_constructible; 116227825Stheraven template <class T, class U> struct is_nothrow_assignable; 117227825Stheraven template <class T> struct is_nothrow_copy_assignable; 118227825Stheraven template <class T> struct is_nothrow_move_assignable; 119227825Stheraven template <class T> struct is_nothrow_destructible; 120227825Stheraven 121227825Stheraven template <class T> struct has_virtual_destructor; 122227825Stheraven 123227825Stheraven // Relationships between types: 124227825Stheraven template <class T, class U> struct is_same; 125227825Stheraven template <class Base, class Derived> struct is_base_of; 126227825Stheraven template <class From, class To> struct is_convertible; 127227825Stheraven 128227825Stheraven // Alignment properties and transformations: 129227825Stheraven template <class T> struct alignment_of; 130227825Stheraven template <size_t Len, size_t Align = most_stringent_alignment_requirement> 131227825Stheraven struct aligned_storage; 132227825Stheraven 133227825Stheraven template <class T> struct decay; 134227825Stheraven template <class... T> struct common_type; 135227825Stheraven template <class T> struct underlying_type; 136227825Stheraven template <class> class result_of; // undefined 137227825Stheraven template <class Fn, class... ArgTypes> class result_of<Fn(ArgTypes...)>; 138227825Stheraven 139227825Stheraven} // std 140227825Stheraven 141227825Stheraven*/ 142227825Stheraven#include <__config> 143227825Stheraven#include <cstddef> 144227825Stheraven 145227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 146227825Stheraven#pragma GCC system_header 147227825Stheraven#endif 148227825Stheraven 149227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD 150227825Stheraven 151232950Stheraventemplate <bool _Bp, class _If, class _Then> 152227825Stheraven struct _LIBCPP_VISIBLE conditional {typedef _If type;}; 153227825Stheraventemplate <class _If, class _Then> 154227825Stheraven struct _LIBCPP_VISIBLE conditional<false, _If, _Then> {typedef _Then type;}; 155227825Stheraven 156227825Stheraventemplate <bool, class _Tp = void> struct _LIBCPP_VISIBLE enable_if {}; 157227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE enable_if<true, _Tp> {typedef _Tp type;}; 158227825Stheraven 159227825Stheravenstruct __two {char _[2];}; 160227825Stheraven 161227825Stheraven// helper class: 162227825Stheraven 163227825Stheraventemplate <class _Tp, _Tp __v> 164227825Stheravenstruct _LIBCPP_VISIBLE integral_constant 165227825Stheraven{ 166234976Stheraven static _LIBCPP_CONSTEXPR const _Tp value = __v; 167227825Stheraven typedef _Tp value_type; 168227825Stheraven typedef integral_constant type; 169227825Stheraven _LIBCPP_INLINE_VISIBILITY 170234976Stheraven _LIBCPP_CONSTEXPR operator value_type() const {return value;} 171227825Stheraven}; 172227825Stheraven 173227825Stheraventemplate <class _Tp, _Tp __v> 174234976Stheraven_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value; 175227825Stheraven 176227825Stheraventypedef integral_constant<bool, true> true_type; 177227825Stheraventypedef integral_constant<bool, false> false_type; 178227825Stheraven 179227825Stheraven// is_const 180227825Stheraven 181227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_const : public false_type {}; 182227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_const<_Tp const> : public true_type {}; 183227825Stheraven 184227825Stheraven// is_volatile 185227825Stheraven 186227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_volatile : public false_type {}; 187227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_volatile<_Tp volatile> : public true_type {}; 188227825Stheraven 189227825Stheraven// remove_const 190227825Stheraven 191227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_const {typedef _Tp type;}; 192227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_const<const _Tp> {typedef _Tp type;}; 193227825Stheraven 194227825Stheraven// remove_volatile 195227825Stheraven 196227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_volatile {typedef _Tp type;}; 197227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_volatile<volatile _Tp> {typedef _Tp type;}; 198227825Stheraven 199227825Stheraven// remove_cv 200227825Stheraven 201227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_cv 202227825Stheraven{typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;}; 203227825Stheraven 204227825Stheraven// is_void 205227825Stheraven 206227825Stheraventemplate <class _Tp> struct __is_void : public false_type {}; 207227825Stheraventemplate <> struct __is_void<void> : public true_type {}; 208227825Stheraven 209227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_void 210227825Stheraven : public __is_void<typename remove_cv<_Tp>::type> {}; 211227825Stheraven 212227825Stheraven// __is_nullptr_t 213227825Stheraven 214227825Stheraventemplate <class _Tp> struct ____is_nullptr_t : public false_type {}; 215227825Stheraventemplate <> struct ____is_nullptr_t<nullptr_t> : public true_type {}; 216227825Stheraven 217227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE __is_nullptr_t 218227825Stheraven : public ____is_nullptr_t<typename remove_cv<_Tp>::type> {}; 219227825Stheraven 220227825Stheraven// is_integral 221227825Stheraven 222227825Stheraventemplate <class _Tp> struct __is_integral : public false_type {}; 223227825Stheraventemplate <> struct __is_integral<bool> : public true_type {}; 224227825Stheraventemplate <> struct __is_integral<char> : public true_type {}; 225227825Stheraventemplate <> struct __is_integral<signed char> : public true_type {}; 226227825Stheraventemplate <> struct __is_integral<unsigned char> : public true_type {}; 227227825Stheraventemplate <> struct __is_integral<wchar_t> : public true_type {}; 228227825Stheraven#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS 229227825Stheraventemplate <> struct __is_integral<char16_t> : public true_type {}; 230227825Stheraventemplate <> struct __is_integral<char32_t> : public true_type {}; 231227825Stheraven#endif // _LIBCPP_HAS_NO_UNICODE_CHARS 232227825Stheraventemplate <> struct __is_integral<short> : public true_type {}; 233227825Stheraventemplate <> struct __is_integral<unsigned short> : public true_type {}; 234227825Stheraventemplate <> struct __is_integral<int> : public true_type {}; 235227825Stheraventemplate <> struct __is_integral<unsigned int> : public true_type {}; 236227825Stheraventemplate <> struct __is_integral<long> : public true_type {}; 237227825Stheraventemplate <> struct __is_integral<unsigned long> : public true_type {}; 238227825Stheraventemplate <> struct __is_integral<long long> : public true_type {}; 239227825Stheraventemplate <> struct __is_integral<unsigned long long> : public true_type {}; 240227825Stheraven 241227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_integral 242227825Stheraven : public __is_integral<typename remove_cv<_Tp>::type> {}; 243227825Stheraven 244227825Stheraven// is_floating_point 245227825Stheraven 246227825Stheraventemplate <class _Tp> struct __is_floating_point : public false_type {}; 247227825Stheraventemplate <> struct __is_floating_point<float> : public true_type {}; 248227825Stheraventemplate <> struct __is_floating_point<double> : public true_type {}; 249227825Stheraventemplate <> struct __is_floating_point<long double> : public true_type {}; 250227825Stheraven 251227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_floating_point 252227825Stheraven : public __is_floating_point<typename remove_cv<_Tp>::type> {}; 253227825Stheraven 254227825Stheraven// is_array 255227825Stheraven 256227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_array 257227825Stheraven : public false_type {}; 258227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_array<_Tp[]> 259227825Stheraven : public true_type {}; 260227825Stheraventemplate <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE is_array<_Tp[_Np]> 261227825Stheraven : public true_type {}; 262227825Stheraven 263227825Stheraven// is_pointer 264227825Stheraven 265227825Stheraventemplate <class _Tp> struct __is_pointer : public false_type {}; 266227825Stheraventemplate <class _Tp> struct __is_pointer<_Tp*> : public true_type {}; 267227825Stheraven 268227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_pointer 269227825Stheraven : public __is_pointer<typename remove_cv<_Tp>::type> {}; 270227825Stheraven 271227825Stheraven// is_reference 272227825Stheraven 273227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_lvalue_reference : public false_type {}; 274227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_lvalue_reference<_Tp&> : public true_type {}; 275227825Stheraven 276227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_rvalue_reference : public false_type {}; 277227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 278227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_rvalue_reference<_Tp&&> : public true_type {}; 279227825Stheraven#endif 280227825Stheraven 281227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_reference : public false_type {}; 282227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_reference<_Tp&> : public true_type {}; 283227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 284227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_reference<_Tp&&> : public true_type {}; 285227825Stheraven#endif 286227825Stheraven 287227825Stheraven#if defined(__clang__) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 288227825Stheraven#define _LIBCPP_HAS_TYPE_TRAITS 289227825Stheraven#endif 290227825Stheraven 291227825Stheraven// is_union 292227825Stheraven 293227825Stheraven#if __has_feature(is_union) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 294227825Stheraven 295227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_union 296227825Stheraven : public integral_constant<bool, __is_union(_Tp)> {}; 297227825Stheraven 298227825Stheraven#else 299227825Stheraven 300227825Stheraventemplate <class _Tp> struct __libcpp_union : public false_type {}; 301227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_union 302227825Stheraven : public __libcpp_union<typename remove_cv<_Tp>::type> {}; 303227825Stheraven 304227825Stheraven#endif 305227825Stheraven 306227825Stheraven// is_class 307227825Stheraven 308227825Stheraven#if __has_feature(is_class) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 309227825Stheraven 310227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_class 311227825Stheraven : public integral_constant<bool, __is_class(_Tp)> {}; 312227825Stheraven 313227825Stheraven#else 314227825Stheraven 315227825Stheravennamespace __is_class_imp 316227825Stheraven{ 317227825Stheraventemplate <class _Tp> char __test(int _Tp::*); 318227825Stheraventemplate <class _Tp> __two __test(...); 319227825Stheraven} 320227825Stheraven 321227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_class 322227825Stheraven : public integral_constant<bool, sizeof(__is_class_imp::__test<_Tp>(0)) == 1 && !is_union<_Tp>::value> {}; 323227825Stheraven 324227825Stheraven#endif 325227825Stheraven 326227825Stheraven// is_same 327227825Stheraven 328227825Stheraventemplate <class _Tp, class _Up> struct _LIBCPP_VISIBLE is_same : public false_type {}; 329227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_same<_Tp, _Tp> : public true_type {}; 330227825Stheraven 331227825Stheraven// is_function 332227825Stheraven 333227825Stheravennamespace __is_function_imp 334227825Stheraven{ 335227825Stheraventemplate <class _Tp> char __test(_Tp*); 336227825Stheraventemplate <class _Tp> __two __test(...); 337227825Stheraventemplate <class _Tp> _Tp& __source(); 338227825Stheraven} 339227825Stheraven 340227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value || 341227825Stheraven is_union<_Tp>::value || 342227825Stheraven is_void<_Tp>::value || 343227825Stheraven is_reference<_Tp>::value || 344227825Stheraven is_same<_Tp, nullptr_t>::value > 345227825Stheravenstruct __is_function 346227825Stheraven : public integral_constant<bool, sizeof(__is_function_imp::__test<_Tp>(__is_function_imp::__source<_Tp>())) == 1> 347227825Stheraven {}; 348227825Stheraventemplate <class _Tp> struct __is_function<_Tp, true> : public false_type {}; 349227825Stheraven 350227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_function 351227825Stheraven : public __is_function<_Tp> {}; 352227825Stheraven 353227825Stheraven// is_member_function_pointer 354227825Stheraven 355227825Stheraventemplate <class _Tp> struct __is_member_function_pointer : public false_type {}; 356227825Stheraventemplate <class _Tp, class _Up> struct __is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {}; 357227825Stheraven 358227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_member_function_pointer 359227825Stheraven : public __is_member_function_pointer<typename remove_cv<_Tp>::type> {}; 360227825Stheraven 361227825Stheraven// is_member_pointer 362227825Stheraven 363227825Stheraventemplate <class _Tp> struct __is_member_pointer : public false_type {}; 364227825Stheraventemplate <class _Tp, class _Up> struct __is_member_pointer<_Tp _Up::*> : public true_type {}; 365227825Stheraven 366227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_member_pointer 367227825Stheraven : public __is_member_pointer<typename remove_cv<_Tp>::type> {}; 368227825Stheraven 369227825Stheraven// is_member_object_pointer 370227825Stheraven 371227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_member_object_pointer 372227825Stheraven : public integral_constant<bool, is_member_pointer<_Tp>::value && 373227825Stheraven !is_member_function_pointer<_Tp>::value> {}; 374227825Stheraven 375227825Stheraven// is_enum 376227825Stheraven 377227825Stheraven#if __has_feature(is_enum) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 378227825Stheraven 379227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_enum 380227825Stheraven : public integral_constant<bool, __is_enum(_Tp)> {}; 381227825Stheraven 382227825Stheraven#else 383227825Stheraven 384227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_enum 385227825Stheraven : public integral_constant<bool, !is_void<_Tp>::value && 386227825Stheraven !is_integral<_Tp>::value && 387227825Stheraven !is_floating_point<_Tp>::value && 388227825Stheraven !is_array<_Tp>::value && 389227825Stheraven !is_pointer<_Tp>::value && 390227825Stheraven !is_reference<_Tp>::value && 391227825Stheraven !is_member_pointer<_Tp>::value && 392227825Stheraven !is_union<_Tp>::value && 393227825Stheraven !is_class<_Tp>::value && 394227825Stheraven !is_function<_Tp>::value > {}; 395227825Stheraven 396227825Stheraven#endif 397227825Stheraven 398227825Stheraven// is_arithmetic 399227825Stheraven 400227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_arithmetic 401227825Stheraven : public integral_constant<bool, is_integral<_Tp>::value || 402227825Stheraven is_floating_point<_Tp>::value> {}; 403227825Stheraven 404227825Stheraven// is_fundamental 405227825Stheraven 406227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_fundamental 407227825Stheraven : public integral_constant<bool, is_void<_Tp>::value || 408227825Stheraven __is_nullptr_t<_Tp>::value || 409227825Stheraven is_arithmetic<_Tp>::value> {}; 410227825Stheraven 411227825Stheraven// is_scalar 412227825Stheraven 413227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_scalar 414227825Stheraven : public integral_constant<bool, is_arithmetic<_Tp>::value || 415227825Stheraven is_member_pointer<_Tp>::value || 416227825Stheraven is_pointer<_Tp>::value || 417227825Stheraven __is_nullptr_t<_Tp>::value || 418227825Stheraven is_enum<_Tp>::value > {}; 419227825Stheraven 420227825Stheraventemplate <> struct _LIBCPP_VISIBLE is_scalar<nullptr_t> : public true_type {}; 421227825Stheraven 422227825Stheraven// is_object 423227825Stheraven 424227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_object 425227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 426227825Stheraven is_array<_Tp>::value || 427227825Stheraven is_union<_Tp>::value || 428227825Stheraven is_class<_Tp>::value > {}; 429227825Stheraven 430227825Stheraven// is_compound 431227825Stheraven 432227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_compound 433227825Stheraven : public integral_constant<bool, !is_fundamental<_Tp>::value> {}; 434227825Stheraven 435227825Stheraven// add_const 436227825Stheraven 437227825Stheraventemplate <class _Tp, bool = is_reference<_Tp>::value || 438227825Stheraven is_function<_Tp>::value || 439227825Stheraven is_const<_Tp>::value > 440227825Stheravenstruct __add_const {typedef _Tp type;}; 441227825Stheraven 442227825Stheraventemplate <class _Tp> 443227825Stheravenstruct __add_const<_Tp, false> {typedef const _Tp type;}; 444227825Stheraven 445227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE add_const 446227825Stheraven {typedef typename __add_const<_Tp>::type type;}; 447227825Stheraven 448227825Stheraven// add_volatile 449227825Stheraven 450227825Stheraventemplate <class _Tp, bool = is_reference<_Tp>::value || 451227825Stheraven is_function<_Tp>::value || 452227825Stheraven is_volatile<_Tp>::value > 453227825Stheravenstruct __add_volatile {typedef _Tp type;}; 454227825Stheraven 455227825Stheraventemplate <class _Tp> 456227825Stheravenstruct __add_volatile<_Tp, false> {typedef volatile _Tp type;}; 457227825Stheraven 458227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE add_volatile 459227825Stheraven {typedef typename __add_volatile<_Tp>::type type;}; 460227825Stheraven 461227825Stheraven// add_cv 462227825Stheraven 463227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE add_cv 464227825Stheraven {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;}; 465227825Stheraven 466227825Stheraven// remove_reference 467227825Stheraven 468227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_reference {typedef _Tp type;}; 469227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_reference<_Tp&> {typedef _Tp type;}; 470227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 471227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_reference<_Tp&&> {typedef _Tp type;}; 472227825Stheraven#endif 473227825Stheraven 474227825Stheraven// add_lvalue_reference 475227825Stheraven 476227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE add_lvalue_reference {typedef _Tp& type;}; 477227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE add_lvalue_reference<_Tp&> {typedef _Tp& type;}; // for older compiler 478227825Stheraventemplate <> struct _LIBCPP_VISIBLE add_lvalue_reference<void> {typedef void type;}; 479227825Stheraventemplate <> struct _LIBCPP_VISIBLE add_lvalue_reference<const void> {typedef const void type;}; 480227825Stheraventemplate <> struct _LIBCPP_VISIBLE add_lvalue_reference<volatile void> {typedef volatile void type;}; 481227825Stheraventemplate <> struct _LIBCPP_VISIBLE add_lvalue_reference<const volatile void> {typedef const volatile void type;}; 482227825Stheraven 483227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 484227825Stheraven 485227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE add_rvalue_reference {typedef _Tp&& type;}; 486227825Stheraventemplate <> struct _LIBCPP_VISIBLE add_rvalue_reference<void> {typedef void type;}; 487227825Stheraventemplate <> struct _LIBCPP_VISIBLE add_rvalue_reference<const void> {typedef const void type;}; 488227825Stheraventemplate <> struct _LIBCPP_VISIBLE add_rvalue_reference<volatile void> {typedef volatile void type;}; 489227825Stheraventemplate <> struct _LIBCPP_VISIBLE add_rvalue_reference<const volatile void> {typedef const volatile void type;}; 490227825Stheraven 491227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 492227825Stheraven 493227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 494227825Stheraven 495227825Stheraventemplate <class _Tp> 496227825Stheraventypename add_rvalue_reference<_Tp>::type 497227825Stheravendeclval() _NOEXCEPT; 498227825Stheraven 499227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 500227825Stheraven 501227825Stheraventemplate <class _Tp> 502227825Stheraventypename add_lvalue_reference<_Tp>::type 503227825Stheravendeclval(); 504227825Stheraven 505227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 506227825Stheraven 507227825Stheravenstruct __any 508227825Stheraven{ 509227825Stheraven __any(...); 510227825Stheraven}; 511227825Stheraven 512227825Stheraven// remove_pointer 513227825Stheraven 514227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_pointer {typedef _Tp type;}; 515227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp*> {typedef _Tp type;}; 516227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp* const> {typedef _Tp type;}; 517227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp* volatile> {typedef _Tp type;}; 518227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_pointer<_Tp* const volatile> {typedef _Tp type;}; 519227825Stheraven 520227825Stheraven// add_pointer 521227825Stheraven 522227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE add_pointer 523227825Stheraven {typedef typename remove_reference<_Tp>::type* type;}; 524227825Stheraven 525227825Stheraven// is_signed 526227825Stheraven 527227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value> 528227825Stheravenstruct ___is_signed : public integral_constant<bool, _Tp(-1) < _Tp(0)> {}; 529227825Stheraven 530227825Stheraventemplate <class _Tp> 531227825Stheravenstruct ___is_signed<_Tp, false> : public true_type {}; // floating point 532227825Stheraven 533227825Stheraventemplate <class _Tp, bool = is_arithmetic<_Tp>::value> 534227825Stheravenstruct __is_signed : public ___is_signed<_Tp> {}; 535227825Stheraven 536227825Stheraventemplate <class _Tp> struct __is_signed<_Tp, false> : public false_type {}; 537227825Stheraven 538227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_signed : public __is_signed<_Tp> {}; 539227825Stheraven 540227825Stheraven// is_unsigned 541227825Stheraven 542227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value> 543227825Stheravenstruct ___is_unsigned : public integral_constant<bool, _Tp(0) < _Tp(-1)> {}; 544227825Stheraven 545227825Stheraventemplate <class _Tp> 546227825Stheravenstruct ___is_unsigned<_Tp, false> : public false_type {}; // floating point 547227825Stheraven 548227825Stheraventemplate <class _Tp, bool = is_arithmetic<_Tp>::value> 549227825Stheravenstruct __is_unsigned : public ___is_unsigned<_Tp> {}; 550227825Stheraven 551227825Stheraventemplate <class _Tp> struct __is_unsigned<_Tp, false> : public false_type {}; 552227825Stheraven 553227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_unsigned : public __is_unsigned<_Tp> {}; 554227825Stheraven 555227825Stheraven// rank 556227825Stheraven 557227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE rank 558227825Stheraven : public integral_constant<size_t, 0> {}; 559227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE rank<_Tp[]> 560227825Stheraven : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 561227825Stheraventemplate <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE rank<_Tp[_Np]> 562227825Stheraven : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 563227825Stheraven 564227825Stheraven// extent 565227825Stheraven 566227825Stheraventemplate <class _Tp, unsigned _Ip = 0> struct _LIBCPP_VISIBLE extent 567227825Stheraven : public integral_constant<size_t, 0> {}; 568227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE extent<_Tp[], 0> 569227825Stheraven : public integral_constant<size_t, 0> {}; 570227825Stheraventemplate <class _Tp, unsigned _Ip> struct _LIBCPP_VISIBLE extent<_Tp[], _Ip> 571227825Stheraven : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 572227825Stheraventemplate <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE extent<_Tp[_Np], 0> 573227825Stheraven : public integral_constant<size_t, _Np> {}; 574227825Stheraventemplate <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_VISIBLE extent<_Tp[_Np], _Ip> 575227825Stheraven : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 576227825Stheraven 577227825Stheraven// remove_extent 578227825Stheraven 579227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_extent 580227825Stheraven {typedef _Tp type;}; 581227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_extent<_Tp[]> 582227825Stheraven {typedef _Tp type;}; 583227825Stheraventemplate <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE remove_extent<_Tp[_Np]> 584227825Stheraven {typedef _Tp type;}; 585227825Stheraven 586227825Stheraven// remove_all_extents 587227825Stheraven 588227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_all_extents 589227825Stheraven {typedef _Tp type;}; 590227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE remove_all_extents<_Tp[]> 591227825Stheraven {typedef typename remove_all_extents<_Tp>::type type;}; 592227825Stheraventemplate <class _Tp, size_t _Np> struct _LIBCPP_VISIBLE remove_all_extents<_Tp[_Np]> 593227825Stheraven {typedef typename remove_all_extents<_Tp>::type type;}; 594227825Stheraven 595227825Stheraven// is_abstract 596227825Stheraven 597227825Stheravennamespace __is_abstract_imp 598227825Stheraven{ 599227825Stheraventemplate <class _Tp> char __test(_Tp (*)[1]); 600227825Stheraventemplate <class _Tp> __two __test(...); 601227825Stheraven} 602227825Stheraven 603227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value> 604227825Stheravenstruct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {}; 605227825Stheraven 606227825Stheraventemplate <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {}; 607227825Stheraven 608227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_abstract : public __libcpp_abstract<_Tp> {}; 609227825Stheraven 610227825Stheraven// is_convertible 611227825Stheraven 612227825Stheraven#if __has_feature(is_convertible_to) 613227825Stheraven 614227825Stheraventemplate <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible 615227825Stheraven : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {}; 616227825Stheraven 617227825Stheraven#else // __has_feature(is_convertible_to) 618227825Stheraven 619227825Stheravennamespace __is_convertible_imp 620227825Stheraven{ 621227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 622227825Stheraventemplate <class _Tp> char __test(const volatile typename remove_reference<_Tp>::type&&); 623227825Stheraven#else 624227825Stheraventemplate <class _Tp> char __test(_Tp); 625227825Stheraven#endif 626227825Stheraventemplate <class _Tp> __two __test(...); 627227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 628227825Stheraventemplate <class _Tp> _Tp&& __source(); 629227825Stheraven#else 630227825Stheraventemplate <class _Tp> typename remove_reference<_Tp>::type& __source(); 631227825Stheraven#endif 632227825Stheraven 633227825Stheraventemplate <class _Tp, bool _IsArray = is_array<_Tp>::value, 634227825Stheraven bool _IsFunction = is_function<_Tp>::value, 635227825Stheraven bool _IsVoid = is_void<_Tp>::value> 636227825Stheraven struct __is_array_function_or_void {enum {value = 0};}; 637227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};}; 638227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};}; 639227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};}; 640227825Stheraven} 641227825Stheraven 642227825Stheraventemplate <class _Tp, 643227825Stheraven unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value> 644227825Stheravenstruct __is_convertible_check 645227825Stheraven{ 646227825Stheraven static const size_t __v = 0; 647227825Stheraven}; 648227825Stheraven 649227825Stheraventemplate <class _Tp> 650227825Stheravenstruct __is_convertible_check<_Tp, 0> 651227825Stheraven{ 652227825Stheraven static const size_t __v = sizeof(_Tp); 653227825Stheraven}; 654227825Stheraven 655227825Stheraventemplate <class _T1, class _T2, 656227825Stheraven unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value, 657227825Stheraven unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value> 658227825Stheravenstruct __is_convertible 659227825Stheraven : public integral_constant<bool, 660227825Stheraven sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 661227825Stheraven > 662227825Stheraven{}; 663227825Stheraven 664227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {}; 665227825Stheraven 666227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {}; 667227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 668227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {}; 669227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {}; 670227825Stheraventemplate <class _T1> struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {}; 671227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {}; 672227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 673227825Stheraven 674227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2*, 1, 0> 675227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*>::value> {}; 676227825Stheraven 677227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* const, 1, 0> 678227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const>::value> {}; 679227825Stheraven 680227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* volatile, 1, 0> 681227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*volatile>::value> {}; 682227825Stheraven 683227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* const volatile, 1, 0> 684227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const volatile>::value> {}; 685227825Stheraven 686227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0> : public false_type {}; 687227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 688227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1&&, 2, 0> : public true_type {}; 689227825Stheraven#endif 690227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*, 2, 0> : public true_type {}; 691227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*const, 2, 0> : public true_type {}; 692227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {}; 693227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {}; 694227825Stheraven 695227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 0> : public false_type {}; 696227825Stheraven 697227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {}; 698227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {}; 699227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {}; 700227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {}; 701227825Stheraven 702227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {}; 703227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {}; 704227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {}; 705227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {}; 706227825Stheraven 707227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {}; 708227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {}; 709227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {}; 710227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {}; 711227825Stheraven 712227825Stheraventemplate <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible 713227825Stheraven : public __is_convertible<_T1, _T2> 714227825Stheraven{ 715227825Stheraven static const size_t __complete_check1 = __is_convertible_check<_T1>::__v; 716227825Stheraven static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; 717227825Stheraven}; 718227825Stheraven 719227825Stheraven#endif // __has_feature(is_convertible_to) 720227825Stheraven 721227825Stheraven// is_base_of 722227825Stheraven 723227825Stheraven#ifdef _LIBCP_HAS_IS_BASE_OF 724227825Stheraven 725227825Stheraventemplate <class _Bp, class _Dp> 726227825Stheravenstruct _LIBCPP_VISIBLE is_base_of 727227825Stheraven : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; 728227825Stheraven 729227825Stheraven#else // __has_feature(is_base_of) 730227825Stheraven 731227825Stheraven#error is_base_of not implemented. 732227825Stheraven 733227825Stheraven#endif // __has_feature(is_base_of) 734227825Stheraven 735227825Stheraven// is_empty 736227825Stheraven 737232950Stheraven#if __has_feature(is_empty) 738232950Stheraven 739227825Stheraventemplate <class _Tp> 740232950Stheravenstruct _LIBCPP_VISIBLE is_empty 741232950Stheraven : public integral_constant<bool, __is_empty(_Tp)> {}; 742232950Stheraven 743232950Stheraven#else // __has_feature(is_empty) 744232950Stheraven 745232950Stheraventemplate <class _Tp> 746227825Stheravenstruct __is_empty1 747227825Stheraven : public _Tp 748227825Stheraven{ 749227825Stheraven double _; 750227825Stheraven}; 751227825Stheraven 752227825Stheravenstruct __is_empty2 753227825Stheraven{ 754227825Stheraven double _; 755227825Stheraven}; 756227825Stheraven 757227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value> 758227825Stheravenstruct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {}; 759227825Stheraven 760227825Stheraventemplate <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {}; 761227825Stheraven 762227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_empty : public __libcpp_empty<_Tp> {}; 763227825Stheraven 764232950Stheraven#endif // __has_feature(is_empty) 765232950Stheraven 766227825Stheraven// is_polymorphic 767227825Stheraven 768232950Stheraven#if __has_feature(is_polymorphic) 769232950Stheraven 770232950Stheraventemplate <class _Tp> 771232950Stheravenstruct _LIBCPP_VISIBLE is_polymorphic 772232950Stheraven : public integral_constant<bool, __is_polymorphic(_Tp)> {}; 773232950Stheraven 774232950Stheraven#else 775232950Stheraven 776227825Stheraventemplate <class _Tp> struct __is_polymorphic1 : public _Tp {}; 777227825Stheraventemplate <class _Tp> struct __is_polymorphic2 : public _Tp {virtual ~__is_polymorphic2() throw();}; 778227825Stheraven 779227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value> 780227825Stheravenstruct __libcpp_polymorphic 781227825Stheraven : public integral_constant<bool, sizeof(__is_polymorphic1<_Tp>) == sizeof(__is_polymorphic2<_Tp>)> {}; 782227825Stheraven 783227825Stheraventemplate <class _Tp> struct __libcpp_polymorphic<_Tp, false> : public false_type {}; 784227825Stheraven 785227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_polymorphic 786227825Stheraven : public __libcpp_polymorphic<_Tp> {}; 787227825Stheraven 788232950Stheraven#endif // __has_feature(is_polymorphic) 789232950Stheraven 790227825Stheraven// has_virtual_destructor 791227825Stheraven 792227825Stheraven#if __has_feature(has_virtual_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 793227825Stheraven 794227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE has_virtual_destructor 795227825Stheraven : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; 796227825Stheraven 797227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 798227825Stheraven 799227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE has_virtual_destructor 800227825Stheraven : public false_type {}; 801227825Stheraven 802227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 803227825Stheraven 804227825Stheraven// alignment_of 805227825Stheraven 806227825Stheraventemplate <class _Tp> struct __alignment_of {_Tp _;}; 807227825Stheraven 808227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE alignment_of 809227825Stheraven : public integral_constant<size_t, __alignof__(__alignment_of<typename remove_all_extents<_Tp>::type>)> {}; 810227825Stheraven 811227825Stheraven// aligned_storage 812227825Stheraven 813227825Stheraventemplate <class _Hp, class _Tp> 814227825Stheravenstruct __type_list 815227825Stheraven{ 816227825Stheraven typedef _Hp _Head; 817227825Stheraven typedef _Tp _Tail; 818227825Stheraven}; 819227825Stheraven 820227825Stheravenstruct __nat 821227825Stheraven{ 822227825Stheraven#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS 823227825Stheraven __nat() = delete; 824227825Stheraven __nat(const __nat&) = delete; 825227825Stheraven __nat& operator=(const __nat&) = delete; 826227825Stheraven ~__nat() = delete; 827227825Stheraven#endif 828227825Stheraven}; 829227825Stheraven 830227825Stheraventemplate <class _Tp> 831227825Stheravenstruct __align_type 832227825Stheraven{ 833227825Stheraven static const size_t value = alignment_of<_Tp>::value; 834227825Stheraven typedef _Tp type; 835227825Stheraven}; 836227825Stheraven 837227825Stheravenstruct __struct_double {long double _;}; 838227825Stheravenstruct __struct_double4 {double _[4];}; 839227825Stheraven 840227825Stheraventypedef 841227825Stheraven __type_list<__align_type<unsigned char>, 842227825Stheraven __type_list<__align_type<unsigned short>, 843227825Stheraven __type_list<__align_type<unsigned int>, 844227825Stheraven __type_list<__align_type<unsigned long>, 845227825Stheraven __type_list<__align_type<unsigned long long>, 846227825Stheraven __type_list<__align_type<double>, 847227825Stheraven __type_list<__align_type<long double>, 848227825Stheraven __type_list<__align_type<__struct_double>, 849227825Stheraven __type_list<__align_type<__struct_double4>, 850227825Stheraven __type_list<__align_type<int*>, 851227825Stheraven __nat 852227825Stheraven > > > > > > > > > > __all_types; 853227825Stheraven 854227825Stheraventemplate <class _TL, size_t _Align> struct __find_pod; 855227825Stheraven 856227825Stheraventemplate <class _Hp, size_t _Align> 857227825Stheravenstruct __find_pod<__type_list<_Hp, __nat>, _Align> 858227825Stheraven{ 859227825Stheraven typedef typename conditional< 860227825Stheraven _Align == _Hp::value, 861227825Stheraven typename _Hp::type, 862227825Stheraven void 863227825Stheraven >::type type; 864227825Stheraven}; 865227825Stheraven 866227825Stheraventemplate <class _Hp, class _Tp, size_t _Align> 867227825Stheravenstruct __find_pod<__type_list<_Hp, _Tp>, _Align> 868227825Stheraven{ 869227825Stheraven typedef typename conditional< 870227825Stheraven _Align == _Hp::value, 871227825Stheraven typename _Hp::type, 872227825Stheraven typename __find_pod<_Tp, _Align>::type 873227825Stheraven >::type type; 874227825Stheraven}; 875227825Stheraven 876227825Stheraventemplate <class _TL, size_t _Len> struct __find_max_align; 877227825Stheraven 878227825Stheraventemplate <class _Hp, size_t _Len> 879227825Stheravenstruct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {}; 880227825Stheraven 881227825Stheraventemplate <size_t _Len, size_t _A1, size_t _A2> 882227825Stheravenstruct __select_align 883227825Stheraven{ 884227825Stheravenprivate: 885227825Stheraven static const size_t __min = _A2 < _A1 ? _A2 : _A1; 886227825Stheraven static const size_t __max = _A1 < _A2 ? _A2 : _A1; 887227825Stheravenpublic: 888227825Stheraven static const size_t value = _Len < __max ? __min : __max; 889227825Stheraven}; 890227825Stheraven 891227825Stheraventemplate <class _Hp, class _Tp, size_t _Len> 892227825Stheravenstruct __find_max_align<__type_list<_Hp, _Tp>, _Len> 893227825Stheraven : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {}; 894227825Stheraven 895227825Stheraventemplate <size_t _Len, const size_t _Align = __find_max_align<__all_types, _Len>::value> 896227825Stheravenstruct _LIBCPP_VISIBLE aligned_storage 897227825Stheraven{ 898227825Stheraven typedef typename __find_pod<__all_types, _Align>::type _Aligner; 899227825Stheraven static_assert(!is_void<_Aligner>::value, ""); 900227825Stheraven union type 901227825Stheraven { 902227825Stheraven _Aligner __align; 903227825Stheraven unsigned char __data[_Len]; 904227825Stheraven }; 905227825Stheraven}; 906227825Stheraven 907227825Stheraven#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ 908227825Stheraventemplate <size_t _Len>\ 909227825Stheravenstruct _LIBCPP_VISIBLE aligned_storage<_Len, n>\ 910227825Stheraven{\ 911227825Stheraven struct _ALIGNAS(n) type\ 912227825Stheraven {\ 913227825Stheraven unsigned char _[_Len];\ 914227825Stheraven };\ 915227825Stheraven} 916227825Stheraven 917227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1); 918227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2); 919227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4); 920227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8); 921227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10); 922227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20); 923227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40); 924227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80); 925227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100); 926227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200); 927227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400); 928227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800); 929227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000); 930227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000); 931227825Stheraven// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000) 932227825Stheraven#if !defined(_MSC_VER) 933227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); 934227825Stheraven#endif // !_MSC_VER 935227825Stheraven 936227825Stheraven#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION 937227825Stheraven 938227825Stheraven// __promote 939227825Stheraven 940227825Stheraventemplate <class _A1, class _A2 = void, class _A3 = void, 941227825Stheraven bool = (is_arithmetic<_A1>::value || is_void<_A1>::value) && 942227825Stheraven (is_arithmetic<_A2>::value || is_void<_A2>::value) && 943227825Stheraven (is_arithmetic<_A3>::value || is_void<_A3>::value)> 944227825Stheravenclass __promote {}; 945227825Stheraven 946227825Stheraventemplate <class _A1, class _A2, class _A3> 947227825Stheravenclass __promote<_A1, _A2, _A3, true> 948227825Stheraven{ 949227825Stheravenprivate: 950227825Stheraven typedef typename __promote<_A1>::type __type1; 951227825Stheraven typedef typename __promote<_A2>::type __type2; 952227825Stheraven typedef typename __promote<_A3>::type __type3; 953227825Stheravenpublic: 954227825Stheraven typedef decltype(__type1() + __type2() + __type3()) type; 955227825Stheraven}; 956227825Stheraven 957227825Stheraventemplate <class _A1, class _A2> 958227825Stheravenclass __promote<_A1, _A2, void, true> 959227825Stheraven{ 960227825Stheravenprivate: 961227825Stheraven typedef typename __promote<_A1>::type __type1; 962227825Stheraven typedef typename __promote<_A2>::type __type2; 963227825Stheravenpublic: 964227825Stheraven typedef decltype(__type1() + __type2()) type; 965227825Stheraven}; 966227825Stheraven 967227825Stheraventemplate <class _A1> 968227825Stheravenclass __promote<_A1, void, void, true> 969227825Stheraven{ 970227825Stheravenpublic: 971227825Stheraven typedef typename conditional<is_arithmetic<_A1>::value, 972227825Stheraven typename conditional<is_integral<_A1>::value, double, _A1>::type, 973227825Stheraven void 974227825Stheraven >::type type; 975227825Stheraven}; 976227825Stheraven 977227825Stheraven#ifdef _LIBCPP_STORE_AS_OPTIMIZATION 978227825Stheraven 979227825Stheraven// __transform 980227825Stheraven 981227825Stheraventemplate <class _Tp, size_t = sizeof(_Tp), bool = is_scalar<_Tp>::value> struct __transform {typedef _Tp type;}; 982227825Stheraventemplate <class _Tp> struct __transform<_Tp, 1, true> {typedef unsigned char type;}; 983227825Stheraventemplate <class _Tp> struct __transform<_Tp, 2, true> {typedef unsigned short type;}; 984227825Stheraventemplate <class _Tp> struct __transform<_Tp, 4, true> {typedef unsigned int type;}; 985227825Stheraventemplate <class _Tp> struct __transform<_Tp, 8, true> {typedef unsigned long long type;}; 986227825Stheraven 987227825Stheraven#endif // _LIBCPP_STORE_AS_OPTIMIZATION 988227825Stheraven 989227825Stheraven// make_signed / make_unsigned 990227825Stheraven 991227825Stheraventypedef 992227825Stheraven __type_list<signed char, 993227825Stheraven __type_list<signed short, 994227825Stheraven __type_list<signed int, 995227825Stheraven __type_list<signed long, 996227825Stheraven __type_list<signed long long, 997227825Stheraven __nat 998227825Stheraven > > > > > __signed_types; 999227825Stheraven 1000227825Stheraventypedef 1001227825Stheraven __type_list<unsigned char, 1002227825Stheraven __type_list<unsigned short, 1003227825Stheraven __type_list<unsigned int, 1004227825Stheraven __type_list<unsigned long, 1005227825Stheraven __type_list<unsigned long long, 1006227825Stheraven __nat 1007227825Stheraven > > > > > __unsigned_types; 1008227825Stheraven 1009227825Stheraventemplate <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first; 1010227825Stheraven 1011227825Stheraventemplate <class _Hp, class _Tp, size_t _Size> 1012227825Stheravenstruct __find_first<__type_list<_Hp, _Tp>, _Size, true> 1013227825Stheraven{ 1014227825Stheraven typedef _Hp type; 1015227825Stheraven}; 1016227825Stheraven 1017227825Stheraventemplate <class _Hp, class _Tp, size_t _Size> 1018227825Stheravenstruct __find_first<__type_list<_Hp, _Tp>, _Size, false> 1019227825Stheraven{ 1020227825Stheraven typedef typename __find_first<_Tp, _Size>::type type; 1021227825Stheraven}; 1022227825Stheraven 1023227825Stheraventemplate <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, 1024227825Stheraven bool = is_volatile<typename remove_reference<_Tp>::type>::value> 1025227825Stheravenstruct __apply_cv 1026227825Stheraven{ 1027227825Stheraven typedef _Up type; 1028227825Stheraven}; 1029227825Stheraven 1030227825Stheraventemplate <class _Tp, class _Up> 1031227825Stheravenstruct __apply_cv<_Tp, _Up, true, false> 1032227825Stheraven{ 1033227825Stheraven typedef const _Up type; 1034227825Stheraven}; 1035227825Stheraven 1036227825Stheraventemplate <class _Tp, class _Up> 1037227825Stheravenstruct __apply_cv<_Tp, _Up, false, true> 1038227825Stheraven{ 1039227825Stheraven typedef volatile _Up type; 1040227825Stheraven}; 1041227825Stheraven 1042227825Stheraventemplate <class _Tp, class _Up> 1043227825Stheravenstruct __apply_cv<_Tp, _Up, true, true> 1044227825Stheraven{ 1045227825Stheraven typedef const volatile _Up type; 1046227825Stheraven}; 1047227825Stheraven 1048227825Stheraventemplate <class _Tp, class _Up> 1049227825Stheravenstruct __apply_cv<_Tp&, _Up, false, false> 1050227825Stheraven{ 1051227825Stheraven typedef _Up& type; 1052227825Stheraven}; 1053227825Stheraven 1054227825Stheraventemplate <class _Tp, class _Up> 1055227825Stheravenstruct __apply_cv<_Tp&, _Up, true, false> 1056227825Stheraven{ 1057227825Stheraven typedef const _Up& type; 1058227825Stheraven}; 1059227825Stheraven 1060227825Stheraventemplate <class _Tp, class _Up> 1061227825Stheravenstruct __apply_cv<_Tp&, _Up, false, true> 1062227825Stheraven{ 1063227825Stheraven typedef volatile _Up& type; 1064227825Stheraven}; 1065227825Stheraven 1066227825Stheraventemplate <class _Tp, class _Up> 1067227825Stheravenstruct __apply_cv<_Tp&, _Up, true, true> 1068227825Stheraven{ 1069227825Stheraven typedef const volatile _Up& type; 1070227825Stheraven}; 1071227825Stheraven 1072227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1073227825Stheravenstruct __make_signed {}; 1074227825Stheraven 1075227825Stheraventemplate <class _Tp> 1076227825Stheravenstruct __make_signed<_Tp, true> 1077227825Stheraven{ 1078227825Stheraven typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type; 1079227825Stheraven}; 1080227825Stheraven 1081227825Stheraventemplate <> struct __make_signed<bool, true> {}; 1082227825Stheraventemplate <> struct __make_signed< signed short, true> {typedef short type;}; 1083227825Stheraventemplate <> struct __make_signed<unsigned short, true> {typedef short type;}; 1084227825Stheraventemplate <> struct __make_signed< signed int, true> {typedef int type;}; 1085227825Stheraventemplate <> struct __make_signed<unsigned int, true> {typedef int type;}; 1086227825Stheraventemplate <> struct __make_signed< signed long, true> {typedef long type;}; 1087227825Stheraventemplate <> struct __make_signed<unsigned long, true> {typedef long type;}; 1088227825Stheraventemplate <> struct __make_signed< signed long long, true> {typedef long long type;}; 1089227825Stheraventemplate <> struct __make_signed<unsigned long long, true> {typedef long long type;}; 1090227825Stheraven 1091227825Stheraventemplate <class _Tp> 1092227825Stheravenstruct _LIBCPP_VISIBLE make_signed 1093227825Stheraven{ 1094227825Stheraven typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type; 1095227825Stheraven}; 1096227825Stheraven 1097227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1098227825Stheravenstruct __make_unsigned {}; 1099227825Stheraven 1100227825Stheraventemplate <class _Tp> 1101227825Stheravenstruct __make_unsigned<_Tp, true> 1102227825Stheraven{ 1103227825Stheraven typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type; 1104227825Stheraven}; 1105227825Stheraven 1106227825Stheraventemplate <> struct __make_unsigned<bool, true> {}; 1107227825Stheraventemplate <> struct __make_unsigned< signed short, true> {typedef unsigned short type;}; 1108227825Stheraventemplate <> struct __make_unsigned<unsigned short, true> {typedef unsigned short type;}; 1109227825Stheraventemplate <> struct __make_unsigned< signed int, true> {typedef unsigned int type;}; 1110227825Stheraventemplate <> struct __make_unsigned<unsigned int, true> {typedef unsigned int type;}; 1111227825Stheraventemplate <> struct __make_unsigned< signed long, true> {typedef unsigned long type;}; 1112227825Stheraventemplate <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;}; 1113227825Stheraventemplate <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;}; 1114227825Stheraventemplate <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;}; 1115227825Stheraven 1116227825Stheraventemplate <class _Tp> 1117227825Stheravenstruct _LIBCPP_VISIBLE make_unsigned 1118227825Stheraven{ 1119227825Stheraven typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type; 1120227825Stheraven}; 1121227825Stheraven 1122227825Stheraven#ifdef _LIBCPP_HAS_NO_VARIADICS 1123227825Stheraven 1124227825Stheraventemplate <class _Tp, class _Up = void, class V = void> 1125227825Stheravenstruct _LIBCPP_VISIBLE common_type 1126227825Stheraven{ 1127227825Stheravenpublic: 1128227825Stheraven typedef typename common_type<typename common_type<_Tp, _Up>::type, V>::type type; 1129227825Stheraven}; 1130227825Stheraven 1131227825Stheraventemplate <class _Tp> 1132227825Stheravenstruct _LIBCPP_VISIBLE common_type<_Tp, void, void> 1133227825Stheraven{ 1134227825Stheravenpublic: 1135227825Stheraven typedef _Tp type; 1136227825Stheraven}; 1137227825Stheraven 1138227825Stheraventemplate <class _Tp, class _Up> 1139227825Stheravenstruct _LIBCPP_VISIBLE common_type<_Tp, _Up, void> 1140227825Stheraven{ 1141227825Stheravenprivate: 1142227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1143227825Stheraven static _Tp&& __t(); 1144227825Stheraven static _Up&& __u(); 1145227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1146227825Stheraven static _Tp __t(); 1147227825Stheraven static _Up __u(); 1148227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1149227825Stheravenpublic: 1150232950Stheraven typedef typename remove_reference<decltype(true ? __t() : __u())>::type type; 1151227825Stheraven}; 1152227825Stheraven 1153227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1154227825Stheraven 1155227825Stheraventemplate <class ..._Tp> struct common_type; 1156227825Stheraven 1157227825Stheraventemplate <class _Tp> 1158227825Stheravenstruct _LIBCPP_VISIBLE common_type<_Tp> 1159227825Stheraven{ 1160227825Stheraven typedef _Tp type; 1161227825Stheraven}; 1162227825Stheraven 1163227825Stheraventemplate <class _Tp, class _Up> 1164227825Stheravenstruct _LIBCPP_VISIBLE common_type<_Tp, _Up> 1165227825Stheraven{ 1166227825Stheravenprivate: 1167227825Stheraven static _Tp&& __t(); 1168227825Stheraven static _Up&& __u(); 1169227825Stheraven static bool __f(); 1170227825Stheravenpublic: 1171232950Stheraven typedef typename remove_reference<decltype(__f() ? __t() : __u())>::type type; 1172227825Stheraven}; 1173227825Stheraven 1174227825Stheraventemplate <class _Tp, class _Up, class ..._Vp> 1175227825Stheravenstruct _LIBCPP_VISIBLE common_type<_Tp, _Up, _Vp...> 1176227825Stheraven{ 1177227825Stheraven typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type; 1178227825Stheraven}; 1179227825Stheraven 1180227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 1181227825Stheraven 1182227825Stheraven// is_assignable 1183227825Stheraven 1184227825Stheraventemplate <class _Tp, class _Arg> 1185227825Stheravendecltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>(), true_type())) 1186227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1187227825Stheraven__is_assignable_test(_Tp&&, _Arg&&); 1188227825Stheraven#else 1189227825Stheraven__is_assignable_test(_Tp, _Arg&); 1190227825Stheraven#endif 1191227825Stheraven 1192227825Stheraventemplate <class _Arg> 1193227825Stheravenfalse_type 1194227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1195227825Stheraven__is_assignable_test(__any, _Arg&&); 1196227825Stheraven#else 1197227825Stheraven__is_assignable_test(__any, _Arg&); 1198227825Stheraven#endif 1199227825Stheraven 1200227825Stheraventemplate <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value> 1201227825Stheravenstruct __is_assignable_imp 1202227825Stheraven : public common_type 1203227825Stheraven < 1204227825Stheraven decltype(__is_assignable_test(declval<_Tp>(), declval<_Arg>())) 1205227825Stheraven >::type {}; 1206227825Stheraven 1207227825Stheraventemplate <class _Tp, class _Arg> 1208227825Stheravenstruct __is_assignable_imp<_Tp, _Arg, true> 1209227825Stheraven : public false_type 1210227825Stheraven{ 1211227825Stheraven}; 1212227825Stheraven 1213227825Stheraventemplate <class _Tp, class _Arg> 1214227825Stheravenstruct is_assignable 1215227825Stheraven : public __is_assignable_imp<_Tp, _Arg> {}; 1216227825Stheraven 1217227825Stheraven// is_copy_assignable 1218227825Stheraven 1219227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_copy_assignable 1220227825Stheraven : public is_assignable<typename add_lvalue_reference<_Tp>::type, 1221227825Stheraven const typename add_lvalue_reference<_Tp>::type> {}; 1222227825Stheraven 1223227825Stheraven// is_move_assignable 1224227825Stheraven 1225227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_move_assignable 1226227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1227227825Stheraven : public is_assignable<typename add_lvalue_reference<_Tp>::type, 1228227825Stheraven const typename add_rvalue_reference<_Tp>::type> {}; 1229227825Stheraven#else 1230227825Stheraven : public is_copy_assignable<_Tp> {}; 1231227825Stheraven#endif 1232227825Stheraven 1233227825Stheraven// is_destructible 1234227825Stheraven 1235227825Stheraventemplate <class _Tp> 1236227825Stheravenstruct __destructible_test 1237227825Stheraven{ 1238227825Stheraven _Tp __t; 1239227825Stheraven}; 1240227825Stheraven 1241227825Stheraventemplate <class _Tp> 1242227825Stheravendecltype((_VSTD::declval<__destructible_test<_Tp> >().~__destructible_test<_Tp>(), true_type())) 1243227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1244227825Stheraven__is_destructible_test(_Tp&&); 1245227825Stheraven#else 1246227825Stheraven__is_destructible_test(_Tp&); 1247227825Stheraven#endif 1248227825Stheraven 1249227825Stheravenfalse_type 1250227825Stheraven__is_destructible_test(__any); 1251227825Stheraven 1252227825Stheraventemplate <class _Tp, bool = is_void<_Tp>::value || is_abstract<_Tp>::value> 1253227825Stheravenstruct __destructible_imp 1254227825Stheraven : public common_type 1255227825Stheraven < 1256227825Stheraven decltype(__is_destructible_test(declval<_Tp>())) 1257227825Stheraven >::type {}; 1258227825Stheraven 1259227825Stheraventemplate <class _Tp> 1260227825Stheravenstruct __destructible_imp<_Tp, true> 1261227825Stheraven : public false_type {}; 1262227825Stheraven 1263227825Stheraventemplate <class _Tp> 1264227825Stheravenstruct is_destructible 1265227825Stheraven : public __destructible_imp<_Tp> {}; 1266227825Stheraven 1267227825Stheraven// move 1268227825Stheraven 1269227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1270227825Stheraven 1271227825Stheraventemplate <class _Tp> 1272227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1273227825Stheraventypename remove_reference<_Tp>::type&& 1274227825Stheravenmove(_Tp&& __t) _NOEXCEPT 1275227825Stheraven{ 1276227825Stheraven typedef typename remove_reference<_Tp>::type _Up; 1277227825Stheraven return static_cast<_Up&&>(__t); 1278227825Stheraven} 1279227825Stheraven 1280227825Stheraventemplate <class _Tp> 1281227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1282227825Stheraven_Tp&& 1283227825Stheravenforward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT 1284227825Stheraven{ 1285227825Stheraven return static_cast<_Tp&&>(__t); 1286227825Stheraven} 1287227825Stheraven 1288227825Stheraventemplate <class _Tp> 1289227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1290227825Stheraven_Tp&& 1291227825Stheravenforward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT 1292227825Stheraven{ 1293227825Stheraven static_assert(!std::is_lvalue_reference<_Tp>::value, 1294227825Stheraven "Can not forward an rvalue as an lvalue."); 1295227825Stheraven return static_cast<_Tp&&>(__t); 1296227825Stheraven} 1297227825Stheraven 1298227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1299227825Stheraven 1300227825Stheraventemplate <class _Tp> 1301227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1302234976Stheraven_Tp& 1303227825Stheravenmove(_Tp& __t) 1304227825Stheraven{ 1305227825Stheraven return __t; 1306227825Stheraven} 1307227825Stheraven 1308227825Stheraventemplate <class _Tp> 1309227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1310234976Stheravenconst _Tp& 1311232950Stheravenmove(const _Tp& __t) 1312232950Stheraven{ 1313232950Stheraven return __t; 1314232950Stheraven} 1315232950Stheraven 1316232950Stheraventemplate <class _Tp> 1317232950Stheraveninline _LIBCPP_INLINE_VISIBILITY 1318234976Stheraven_Tp& 1319234976Stheravenforward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT 1320227825Stheraven{ 1321227825Stheraven return __t; 1322227825Stheraven} 1323227825Stheraven 1324227825Stheraven 1325234976Stheraventemplate <class _Tp> 1326234976Stheravenclass __rv 1327227825Stheraven{ 1328234976Stheraven typedef typename remove_reference<_Tp>::type _Trr; 1329234976Stheraven _Trr& t_; 1330234976Stheravenpublic: 1331234976Stheraven _LIBCPP_INLINE_VISIBILITY 1332234976Stheraven _Trr* operator->() {return &t_;} 1333234976Stheraven _LIBCPP_INLINE_VISIBILITY 1334234976Stheraven explicit __rv(_Trr& __t) : t_(__t) {} 1335234976Stheraven}; 1336227825Stheraven 1337227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1338227825Stheraven 1339227825Stheraventemplate <class _Tp> 1340227825Stheravenstruct _LIBCPP_VISIBLE decay 1341227825Stheraven{ 1342227825Stheravenprivate: 1343227825Stheraven typedef typename remove_reference<_Tp>::type _Up; 1344227825Stheravenpublic: 1345227825Stheraven typedef typename conditional 1346227825Stheraven < 1347227825Stheraven is_array<_Up>::value, 1348227825Stheraven typename remove_extent<_Up>::type*, 1349227825Stheraven typename conditional 1350227825Stheraven < 1351227825Stheraven is_function<_Up>::value, 1352227825Stheraven typename add_pointer<_Up>::type, 1353227825Stheraven typename remove_cv<_Up>::type 1354227825Stheraven >::type 1355227825Stheraven >::type type; 1356227825Stheraven}; 1357227825Stheraven 1358227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1359227825Stheraven 1360227825Stheraventemplate <class _Tp> 1361227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1362227825Stheraventypename decay<_Tp>::type 1363227825Stheraven__decay_copy(_Tp&& __t) 1364227825Stheraven{ 1365227825Stheraven return _VSTD::forward<_Tp>(__t); 1366227825Stheraven} 1367227825Stheraven 1368227825Stheraven#else 1369227825Stheraven 1370227825Stheraventemplate <class _Tp> 1371227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1372227825Stheraventypename decay<_Tp>::type 1373227825Stheraven__decay_copy(const _Tp& __t) 1374227825Stheraven{ 1375227825Stheraven return _VSTD::forward<_Tp>(__t); 1376227825Stheraven} 1377227825Stheraven 1378227825Stheraven#endif 1379227825Stheraven 1380227825Stheraventemplate <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr> 1381227825Stheravenstruct __member_pointer_traits_imp 1382227825Stheraven{ 1383227825Stheraven}; 1384227825Stheraven 1385227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 1386227825Stheraven 1387232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1388232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> 1389227825Stheraven{ 1390227825Stheraven typedef _Class _ClassType; 1391232950Stheraven typedef _Rp _ReturnType; 1392227825Stheraven}; 1393227825Stheraven 1394232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1395232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> 1396227825Stheraven{ 1397227825Stheraven typedef _Class const _ClassType; 1398232950Stheraven typedef _Rp _ReturnType; 1399227825Stheraven}; 1400227825Stheraven 1401232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1402232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> 1403227825Stheraven{ 1404227825Stheraven typedef _Class volatile _ClassType; 1405232950Stheraven typedef _Rp _ReturnType; 1406227825Stheraven}; 1407227825Stheraven 1408232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1409232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> 1410227825Stheraven{ 1411227825Stheraven typedef _Class const volatile _ClassType; 1412232950Stheraven typedef _Rp _ReturnType; 1413227825Stheraven}; 1414227825Stheraven 1415227825Stheraven#if __has_feature(cxx_reference_qualified_functions) 1416227825Stheraven 1417232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1418232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> 1419227825Stheraven{ 1420227825Stheraven typedef _Class& _ClassType; 1421232950Stheraven typedef _Rp _ReturnType; 1422227825Stheraven}; 1423227825Stheraven 1424232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1425232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> 1426227825Stheraven{ 1427227825Stheraven typedef _Class const& _ClassType; 1428232950Stheraven typedef _Rp _ReturnType; 1429227825Stheraven}; 1430227825Stheraven 1431232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1432232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> 1433227825Stheraven{ 1434227825Stheraven typedef _Class volatile& _ClassType; 1435232950Stheraven typedef _Rp _ReturnType; 1436227825Stheraven}; 1437227825Stheraven 1438232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1439232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> 1440227825Stheraven{ 1441227825Stheraven typedef _Class const volatile& _ClassType; 1442232950Stheraven typedef _Rp _ReturnType; 1443227825Stheraven}; 1444227825Stheraven 1445232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1446232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> 1447227825Stheraven{ 1448227825Stheraven typedef _Class&& _ClassType; 1449232950Stheraven typedef _Rp _ReturnType; 1450227825Stheraven}; 1451227825Stheraven 1452232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1453232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> 1454227825Stheraven{ 1455227825Stheraven typedef _Class const&& _ClassType; 1456232950Stheraven typedef _Rp _ReturnType; 1457227825Stheraven}; 1458227825Stheraven 1459232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1460232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> 1461227825Stheraven{ 1462227825Stheraven typedef _Class volatile&& _ClassType; 1463232950Stheraven typedef _Rp _ReturnType; 1464227825Stheraven}; 1465227825Stheraven 1466232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1467232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> 1468227825Stheraven{ 1469227825Stheraven typedef _Class const volatile&& _ClassType; 1470232950Stheraven typedef _Rp _ReturnType; 1471227825Stheraven}; 1472227825Stheraven 1473227825Stheraven#endif // __has_feature(cxx_reference_qualified_functions) 1474227825Stheraven 1475227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1476227825Stheraven 1477232950Stheraventemplate <class _Rp, class _Class> 1478232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false> 1479227825Stheraven{ 1480227825Stheraven typedef _Class _ClassType; 1481232950Stheraven typedef _Rp _ReturnType; 1482227825Stheraven}; 1483227825Stheraven 1484232950Stheraventemplate <class _Rp, class _Class, class _P0> 1485232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> 1486227825Stheraven{ 1487227825Stheraven typedef _Class _ClassType; 1488232950Stheraven typedef _Rp _ReturnType; 1489227825Stheraven}; 1490227825Stheraven 1491232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1492232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> 1493227825Stheraven{ 1494227825Stheraven typedef _Class _ClassType; 1495232950Stheraven typedef _Rp _ReturnType; 1496227825Stheraven}; 1497227825Stheraven 1498232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1499232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> 1500227825Stheraven{ 1501227825Stheraven typedef _Class _ClassType; 1502232950Stheraven typedef _Rp _ReturnType; 1503227825Stheraven}; 1504227825Stheraven 1505232950Stheraventemplate <class _Rp, class _Class> 1506232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> 1507227825Stheraven{ 1508227825Stheraven typedef _Class const _ClassType; 1509232950Stheraven typedef _Rp _ReturnType; 1510227825Stheraven}; 1511227825Stheraven 1512232950Stheraventemplate <class _Rp, class _Class, class _P0> 1513232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> 1514227825Stheraven{ 1515227825Stheraven typedef _Class const _ClassType; 1516232950Stheraven typedef _Rp _ReturnType; 1517227825Stheraven}; 1518227825Stheraven 1519232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1520232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> 1521227825Stheraven{ 1522227825Stheraven typedef _Class const _ClassType; 1523232950Stheraven typedef _Rp _ReturnType; 1524227825Stheraven}; 1525227825Stheraven 1526232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1527232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false> 1528227825Stheraven{ 1529227825Stheraven typedef _Class const _ClassType; 1530232950Stheraven typedef _Rp _ReturnType; 1531227825Stheraven}; 1532227825Stheraven 1533232950Stheraventemplate <class _Rp, class _Class> 1534232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> 1535227825Stheraven{ 1536227825Stheraven typedef _Class volatile _ClassType; 1537232950Stheraven typedef _Rp _ReturnType; 1538227825Stheraven}; 1539227825Stheraven 1540232950Stheraventemplate <class _Rp, class _Class, class _P0> 1541232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> 1542227825Stheraven{ 1543227825Stheraven typedef _Class volatile _ClassType; 1544232950Stheraven typedef _Rp _ReturnType; 1545227825Stheraven}; 1546227825Stheraven 1547232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1548232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false> 1549227825Stheraven{ 1550227825Stheraven typedef _Class volatile _ClassType; 1551232950Stheraven typedef _Rp _ReturnType; 1552227825Stheraven}; 1553227825Stheraven 1554232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1555232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false> 1556227825Stheraven{ 1557227825Stheraven typedef _Class volatile _ClassType; 1558232950Stheraven typedef _Rp _ReturnType; 1559227825Stheraven}; 1560227825Stheraven 1561232950Stheraventemplate <class _Rp, class _Class> 1562232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false> 1563227825Stheraven{ 1564227825Stheraven typedef _Class const volatile _ClassType; 1565232950Stheraven typedef _Rp _ReturnType; 1566227825Stheraven}; 1567227825Stheraven 1568232950Stheraventemplate <class _Rp, class _Class, class _P0> 1569232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false> 1570227825Stheraven{ 1571227825Stheraven typedef _Class const volatile _ClassType; 1572232950Stheraven typedef _Rp _ReturnType; 1573227825Stheraven}; 1574227825Stheraven 1575232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1576232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false> 1577227825Stheraven{ 1578227825Stheraven typedef _Class const volatile _ClassType; 1579232950Stheraven typedef _Rp _ReturnType; 1580227825Stheraven}; 1581227825Stheraven 1582232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1583232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false> 1584227825Stheraven{ 1585227825Stheraven typedef _Class const volatile _ClassType; 1586232950Stheraven typedef _Rp _ReturnType; 1587227825Stheraven}; 1588227825Stheraven 1589227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 1590227825Stheraven 1591232950Stheraventemplate <class _Rp, class _Class> 1592232950Stheravenstruct __member_pointer_traits_imp<_Rp _Class::*, false, true> 1593227825Stheraven{ 1594227825Stheraven typedef _Class _ClassType; 1595232950Stheraven typedef _Rp _ReturnType; 1596227825Stheraven}; 1597227825Stheraven 1598227825Stheraventemplate <class _MP> 1599227825Stheravenstruct __member_pointer_traits 1600227825Stheraven : public __member_pointer_traits_imp<_MP, 1601227825Stheraven is_member_function_pointer<_MP>::value, 1602227825Stheraven is_member_object_pointer<_MP>::value> 1603227825Stheraven{ 1604227825Stheraven// typedef ... _ClassType; 1605227825Stheraven// typedef ... _ReturnType; 1606227825Stheraven}; 1607227825Stheraven 1608227825Stheraven// result_of 1609227825Stheraven 1610227825Stheraventemplate <class _Callable> class result_of; 1611227825Stheraven 1612227825Stheraventemplate <class _Fn, bool, bool> 1613227825Stheravenclass __result_of 1614227825Stheraven{ 1615227825Stheraven}; 1616227825Stheraven 1617227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 1618227825Stheraven 1619227825Stheraventemplate <class _Fn, class ..._ArgTypes> 1620227825Stheravenclass __result_of<_Fn(_ArgTypes...), true, false> 1621227825Stheraven{ 1622227825Stheravenpublic: 1623227825Stheraven typedef decltype(declval<_Fn>()(declval<_ArgTypes>()...)) type; 1624227825Stheraven}; 1625227825Stheraven 1626227825Stheraventemplate <class _MP, class _Tp, bool _IsMemberFunctionPtr> 1627227825Stheravenstruct __result_of_mp; 1628227825Stheraven 1629227825Stheraven// member function pointer 1630227825Stheraven 1631227825Stheraventemplate <class _MP, class _Tp> 1632227825Stheravenstruct __result_of_mp<_MP, _Tp, true> 1633227825Stheraven : public common_type<typename __member_pointer_traits<_MP>::_ReturnType> 1634227825Stheraven{ 1635227825Stheraven}; 1636227825Stheraven 1637227825Stheraven// member data pointer 1638227825Stheraven 1639227825Stheraventemplate <class _MP, class _Tp, bool> 1640227825Stheravenstruct __result_of_mdp; 1641227825Stheraven 1642232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1643232950Stheravenstruct __result_of_mdp<_Rp _Class::*, _Tp, false> 1644227825Stheraven{ 1645232950Stheraven typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type&& type; 1646227825Stheraven}; 1647227825Stheraven 1648232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1649232950Stheravenstruct __result_of_mdp<_Rp _Class::*, _Tp, true> 1650227825Stheraven{ 1651232950Stheraven typedef typename __apply_cv<_Tp, _Rp>::type&& type; 1652227825Stheraven}; 1653227825Stheraven 1654232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1655232950Stheravenstruct __result_of_mp<_Rp _Class::*, _Tp, false> 1656232950Stheraven : public __result_of_mdp<_Rp _Class::*, _Tp, 1657227825Stheraven is_base_of<_Class, typename remove_reference<_Tp>::type>::value> 1658227825Stheraven{ 1659227825Stheraven}; 1660227825Stheraven 1661227825Stheraventemplate <class _Fn, class _Tp, class ..._ArgTypes> 1662227825Stheravenclass __result_of<_Fn(_Tp, _ArgTypes...), false, true> // _Fn must be member pointer 1663227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1664227825Stheraven _Tp, 1665227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1666227825Stheraven{ 1667227825Stheraven}; 1668227825Stheraven 1669227825Stheraven// result_of 1670227825Stheraven 1671227825Stheraventemplate <class _Fn, class ..._ArgTypes> 1672227825Stheravenclass _LIBCPP_VISIBLE result_of<_Fn(_ArgTypes...)> 1673227825Stheraven : public __result_of<_Fn(_ArgTypes...), 1674227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1675227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1676227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1677227825Stheraven > 1678227825Stheraven{ 1679227825Stheraven}; 1680227825Stheraven 1681227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1682227825Stheraven 1683227825Stheraventemplate <class _Fn> 1684227825Stheravenclass __result_of<_Fn(), true, false> 1685227825Stheraven{ 1686227825Stheravenpublic: 1687227825Stheraven typedef decltype(declval<_Fn>()()) type; 1688227825Stheraven}; 1689227825Stheraven 1690227825Stheraventemplate <class _Fn, class _A0> 1691227825Stheravenclass __result_of<_Fn(_A0), true, false> 1692227825Stheraven{ 1693227825Stheravenpublic: 1694227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>())) type; 1695227825Stheraven}; 1696227825Stheraven 1697227825Stheraventemplate <class _Fn, class _A0, class _A1> 1698227825Stheravenclass __result_of<_Fn(_A0, _A1), true, false> 1699227825Stheraven{ 1700227825Stheravenpublic: 1701227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type; 1702227825Stheraven}; 1703227825Stheraven 1704227825Stheraventemplate <class _Fn, class _A0, class _A1, class _A2> 1705227825Stheravenclass __result_of<_Fn(_A0, _A1, _A2), true, false> 1706227825Stheraven{ 1707227825Stheravenpublic: 1708227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type; 1709227825Stheraven}; 1710227825Stheraven 1711227825Stheraventemplate <class _MP, class _Tp, bool _IsMemberFunctionPtr> 1712227825Stheravenstruct __result_of_mp; 1713227825Stheraven 1714227825Stheraven// member function pointer 1715227825Stheraven 1716227825Stheraventemplate <class _MP, class _Tp> 1717227825Stheravenstruct __result_of_mp<_MP, _Tp, true> 1718227825Stheraven : public common_type<typename __member_pointer_traits<_MP>::_ReturnType> 1719227825Stheraven{ 1720227825Stheraven}; 1721227825Stheraven 1722227825Stheraven// member data pointer 1723227825Stheraven 1724227825Stheraventemplate <class _MP, class _Tp, bool> 1725227825Stheravenstruct __result_of_mdp; 1726227825Stheraven 1727232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1728232950Stheravenstruct __result_of_mdp<_Rp _Class::*, _Tp, false> 1729227825Stheraven{ 1730232950Stheraven typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type; 1731227825Stheraven}; 1732227825Stheraven 1733232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1734232950Stheravenstruct __result_of_mdp<_Rp _Class::*, _Tp, true> 1735227825Stheraven{ 1736232950Stheraven typedef typename __apply_cv<_Tp, _Rp>::type& type; 1737227825Stheraven}; 1738227825Stheraven 1739232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1740232950Stheravenstruct __result_of_mp<_Rp _Class::*, _Tp, false> 1741232950Stheraven : public __result_of_mdp<_Rp _Class::*, _Tp, 1742227825Stheraven is_base_of<_Class, typename remove_reference<_Tp>::type>::value> 1743227825Stheraven{ 1744227825Stheraven}; 1745227825Stheraven 1746227825Stheraven 1747227825Stheraven 1748227825Stheraventemplate <class _Fn, class _Tp> 1749227825Stheravenclass __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer 1750227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1751227825Stheraven _Tp, 1752227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1753227825Stheraven{ 1754227825Stheraven}; 1755227825Stheraven 1756227825Stheraventemplate <class _Fn, class _Tp, class _A0> 1757227825Stheravenclass __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer 1758227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1759227825Stheraven _Tp, 1760227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1761227825Stheraven{ 1762227825Stheraven}; 1763227825Stheraven 1764227825Stheraventemplate <class _Fn, class _Tp, class _A0, class _A1> 1765227825Stheravenclass __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer 1766227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1767227825Stheraven _Tp, 1768227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1769227825Stheraven{ 1770227825Stheraven}; 1771227825Stheraven 1772227825Stheraventemplate <class _Fn, class _Tp, class _A0, class _A1, class _A2> 1773227825Stheravenclass __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer 1774227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1775227825Stheraven _Tp, 1776227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1777227825Stheraven{ 1778227825Stheraven}; 1779227825Stheraven 1780227825Stheraven// result_of 1781227825Stheraven 1782227825Stheraventemplate <class _Fn> 1783227825Stheravenclass _LIBCPP_VISIBLE result_of<_Fn()> 1784227825Stheraven : public __result_of<_Fn(), 1785227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1786227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1787227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1788227825Stheraven > 1789227825Stheraven{ 1790227825Stheraven}; 1791227825Stheraven 1792227825Stheraventemplate <class _Fn, class _A0> 1793227825Stheravenclass _LIBCPP_VISIBLE result_of<_Fn(_A0)> 1794227825Stheraven : public __result_of<_Fn(_A0), 1795227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1796227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1797227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1798227825Stheraven > 1799227825Stheraven{ 1800227825Stheraven}; 1801227825Stheraven 1802227825Stheraventemplate <class _Fn, class _A0, class _A1> 1803227825Stheravenclass _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1)> 1804227825Stheraven : public __result_of<_Fn(_A0, _A1), 1805227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1806227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1807227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1808227825Stheraven > 1809227825Stheraven{ 1810227825Stheraven}; 1811227825Stheraven 1812227825Stheraventemplate <class _Fn, class _A0, class _A1, class _A2> 1813227825Stheravenclass _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1, _A2)> 1814227825Stheraven : public __result_of<_Fn(_A0, _A1, _A2), 1815227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1816227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1817227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1818227825Stheraven > 1819227825Stheraven{ 1820227825Stheraven}; 1821227825Stheraven 1822227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 1823227825Stheraven 1824227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 1825227825Stheraven 1826227825Stheraven// template <class T, class... Args> struct is_constructible; 1827227825Stheraven 1828227825Stheraven// main is_constructible test 1829227825Stheraven 1830227825Stheraventemplate <class _Tp, class ..._Args> 1831227825Stheravendecltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...)), true_type()) 1832227825Stheraven__is_constructible_test(_Tp&&, _Args&& ...); 1833227825Stheraven 1834227825Stheraventemplate <class ..._Args> 1835227825Stheravenfalse_type 1836227825Stheraven__is_constructible_test(__any, _Args&& ...); 1837227825Stheraven 1838227825Stheraventemplate <bool, class _Tp, class... _Args> 1839227825Stheravenstruct __is_constructible // false, _Tp is not a scalar 1840227825Stheraven : public common_type 1841227825Stheraven < 1842227825Stheraven decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...)) 1843227825Stheraven >::type 1844227825Stheraven {}; 1845227825Stheraven 1846227825Stheraven// function types are not constructible 1847227825Stheraven 1848232950Stheraventemplate <class _Rp, class... _A1, class... _A2> 1849232950Stheravenstruct __is_constructible<false, _Rp(_A1...), _A2...> 1850227825Stheraven : public false_type 1851227825Stheraven {}; 1852227825Stheraven 1853227825Stheraven// handle scalars and reference types 1854227825Stheraven 1855227825Stheraven// Scalars are default constructible, references are not 1856227825Stheraven 1857227825Stheraventemplate <class _Tp> 1858227825Stheravenstruct __is_constructible<true, _Tp> 1859227825Stheraven : public is_scalar<_Tp> 1860227825Stheraven {}; 1861227825Stheraven 1862227825Stheraven// Scalars and references are constructible from one arg if that arg is 1863227825Stheraven// implicitly convertible to the scalar or reference. 1864227825Stheraven 1865227825Stheraventemplate <class _Tp> 1866227825Stheravenstruct __is_constructible_ref 1867227825Stheraven{ 1868227825Stheraven true_type static __(_Tp); 1869227825Stheraven false_type static __(...); 1870227825Stheraven}; 1871227825Stheraven 1872227825Stheraventemplate <class _Tp, class _A0> 1873227825Stheravenstruct __is_constructible<true, _Tp, _A0> 1874227825Stheraven : public common_type 1875227825Stheraven < 1876227825Stheraven decltype(__is_constructible_ref<_Tp>::__(declval<_A0>())) 1877227825Stheraven >::type 1878227825Stheraven {}; 1879227825Stheraven 1880227825Stheraven// Scalars and references are not constructible from multiple args. 1881227825Stheraven 1882227825Stheraventemplate <class _Tp, class _A0, class ..._Args> 1883227825Stheravenstruct __is_constructible<true, _Tp, _A0, _Args...> 1884227825Stheraven : public false_type 1885227825Stheraven {}; 1886227825Stheraven 1887227825Stheraven// Treat scalars and reference types separately 1888227825Stheraven 1889227825Stheraventemplate <bool, class _Tp, class... _Args> 1890227825Stheravenstruct __is_constructible_void_check 1891227825Stheraven : public __is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value, 1892227825Stheraven _Tp, _Args...> 1893227825Stheraven {}; 1894227825Stheraven 1895227825Stheraven// If any of T or Args is void, is_constructible should be false 1896227825Stheraven 1897227825Stheraventemplate <class _Tp, class... _Args> 1898227825Stheravenstruct __is_constructible_void_check<true, _Tp, _Args...> 1899227825Stheraven : public false_type 1900227825Stheraven {}; 1901227825Stheraven 1902227825Stheraventemplate <class ..._Args> struct __contains_void; 1903227825Stheraven 1904227825Stheraventemplate <> struct __contains_void<> : false_type {}; 1905227825Stheraven 1906227825Stheraventemplate <class _A0, class ..._Args> 1907227825Stheravenstruct __contains_void<_A0, _Args...> 1908227825Stheraven{ 1909227825Stheraven static const bool value = is_void<_A0>::value || 1910227825Stheraven __contains_void<_Args...>::value; 1911227825Stheraven}; 1912227825Stheraven 1913227825Stheraven// is_constructible entry point 1914227825Stheraven 1915227825Stheraventemplate <class _Tp, class... _Args> 1916227825Stheravenstruct _LIBCPP_VISIBLE is_constructible 1917227825Stheraven : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value 1918227825Stheraven || is_abstract<_Tp>::value, 1919227825Stheraven _Tp, _Args...> 1920227825Stheraven {}; 1921227825Stheraven 1922227825Stheraven// Array types are default constructible if their element type 1923227825Stheraven// is default constructible 1924227825Stheraven 1925232950Stheraventemplate <class _Ap, size_t _Np> 1926232950Stheravenstruct __is_constructible<false, _Ap[_Np]> 1927232950Stheraven : public is_constructible<typename remove_all_extents<_Ap>::type> 1928227825Stheraven {}; 1929227825Stheraven 1930227825Stheraven// Otherwise array types are not constructible by this syntax 1931227825Stheraven 1932232950Stheraventemplate <class _Ap, size_t _Np, class ..._Args> 1933232950Stheravenstruct __is_constructible<false, _Ap[_Np], _Args...> 1934227825Stheraven : public false_type 1935227825Stheraven {}; 1936227825Stheraven 1937227825Stheraven// Incomplete array types are not constructible 1938227825Stheraven 1939232950Stheraventemplate <class _Ap, class ..._Args> 1940232950Stheravenstruct __is_constructible<false, _Ap[], _Args...> 1941227825Stheraven : public false_type 1942227825Stheraven {}; 1943227825Stheraven 1944227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1945227825Stheraven 1946227825Stheraven// template <class T> struct is_constructible0; 1947227825Stheraven 1948227825Stheraven// main is_constructible0 test 1949227825Stheraven 1950227825Stheraventemplate <class _Tp> 1951227825Stheravendecltype((_Tp(), true_type())) 1952227825Stheraven__is_constructible0_test(_Tp&); 1953227825Stheraven 1954227825Stheravenfalse_type 1955227825Stheraven__is_constructible0_test(__any); 1956227825Stheraven 1957227825Stheraventemplate <class _Tp, class _A0> 1958227825Stheravendecltype((_Tp(_VSTD::declval<_A0>()), true_type())) 1959227825Stheraven__is_constructible1_test(_Tp&, _A0&); 1960227825Stheraven 1961227825Stheraventemplate <class _A0> 1962227825Stheravenfalse_type 1963227825Stheraven__is_constructible1_test(__any, _A0&); 1964227825Stheraven 1965227825Stheraventemplate <class _Tp, class _A0, class _A1> 1966227825Stheravendecltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type())) 1967227825Stheraven__is_constructible2_test(_Tp&, _A0&, _A1&); 1968227825Stheraven 1969227825Stheraventemplate <class _A0, class _A1> 1970227825Stheravenfalse_type 1971227825Stheraven__is_constructible2_test(__any, _A0&, _A1&); 1972227825Stheraven 1973227825Stheraventemplate <bool, class _Tp> 1974227825Stheravenstruct __is_constructible0_imp // false, _Tp is not a scalar 1975227825Stheraven : public common_type 1976227825Stheraven < 1977227825Stheraven decltype(__is_constructible0_test(declval<_Tp&>())) 1978227825Stheraven >::type 1979227825Stheraven {}; 1980227825Stheraven 1981227825Stheraventemplate <bool, class _Tp, class _A0> 1982227825Stheravenstruct __is_constructible1_imp // false, _Tp is not a scalar 1983227825Stheraven : public common_type 1984227825Stheraven < 1985227825Stheraven decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>())) 1986227825Stheraven >::type 1987227825Stheraven {}; 1988227825Stheraven 1989227825Stheraventemplate <bool, class _Tp, class _A0, class _A1> 1990227825Stheravenstruct __is_constructible2_imp // false, _Tp is not a scalar 1991227825Stheraven : public common_type 1992227825Stheraven < 1993227825Stheraven decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>())) 1994227825Stheraven >::type 1995227825Stheraven {}; 1996227825Stheraven 1997227825Stheraven// handle scalars and reference types 1998227825Stheraven 1999227825Stheraven// Scalars are default constructible, references are not 2000227825Stheraven 2001227825Stheraventemplate <class _Tp> 2002227825Stheravenstruct __is_constructible0_imp<true, _Tp> 2003227825Stheraven : public is_scalar<_Tp> 2004227825Stheraven {}; 2005227825Stheraven 2006227825Stheraventemplate <class _Tp, class _A0> 2007227825Stheravenstruct __is_constructible1_imp<true, _Tp, _A0> 2008227825Stheraven : public is_convertible<_A0, _Tp> 2009227825Stheraven {}; 2010227825Stheraven 2011227825Stheraventemplate <class _Tp, class _A0, class _A1> 2012227825Stheravenstruct __is_constructible2_imp<true, _Tp, _A0, _A1> 2013227825Stheraven : public false_type 2014227825Stheraven {}; 2015227825Stheraven 2016227825Stheraven// Treat scalars and reference types separately 2017227825Stheraven 2018227825Stheraventemplate <bool, class _Tp> 2019227825Stheravenstruct __is_constructible0_void_check 2020227825Stheraven : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2021227825Stheraven _Tp> 2022227825Stheraven {}; 2023227825Stheraven 2024227825Stheraventemplate <bool, class _Tp, class _A0> 2025227825Stheravenstruct __is_constructible1_void_check 2026227825Stheraven : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2027227825Stheraven _Tp, _A0> 2028227825Stheraven {}; 2029227825Stheraven 2030227825Stheraventemplate <bool, class _Tp, class _A0, class _A1> 2031227825Stheravenstruct __is_constructible2_void_check 2032227825Stheraven : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2033227825Stheraven _Tp, _A0, _A1> 2034227825Stheraven {}; 2035227825Stheraven 2036227825Stheraven// If any of T or Args is void, is_constructible should be false 2037227825Stheraven 2038227825Stheraventemplate <class _Tp> 2039227825Stheravenstruct __is_constructible0_void_check<true, _Tp> 2040227825Stheraven : public false_type 2041227825Stheraven {}; 2042227825Stheraven 2043227825Stheraventemplate <class _Tp, class _A0> 2044227825Stheravenstruct __is_constructible1_void_check<true, _Tp, _A0> 2045227825Stheraven : public false_type 2046227825Stheraven {}; 2047227825Stheraven 2048227825Stheraventemplate <class _Tp, class _A0, class _A1> 2049227825Stheravenstruct __is_constructible2_void_check<true, _Tp, _A0, _A1> 2050227825Stheraven : public false_type 2051227825Stheraven {}; 2052227825Stheraven 2053227825Stheraven// is_constructible entry point 2054227825Stheraven 2055227825Stheravennamespace __is_construct 2056227825Stheraven{ 2057227825Stheraven 2058227825Stheravenstruct __nat {}; 2059227825Stheraven 2060227825Stheraven} 2061227825Stheraven 2062227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2063227825Stheraven class _A1 = __is_construct::__nat> 2064227825Stheravenstruct _LIBCPP_VISIBLE is_constructible 2065227825Stheraven : public __is_constructible2_void_check<is_void<_Tp>::value 2066227825Stheraven || is_abstract<_Tp>::value 2067227825Stheraven || is_function<_Tp>::value 2068227825Stheraven || is_void<_A0>::value 2069227825Stheraven || is_void<_A1>::value, 2070227825Stheraven _Tp, _A0, _A1> 2071227825Stheraven {}; 2072227825Stheraven 2073227825Stheraventemplate <class _Tp> 2074227825Stheravenstruct _LIBCPP_VISIBLE is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> 2075227825Stheraven : public __is_constructible0_void_check<is_void<_Tp>::value 2076227825Stheraven || is_abstract<_Tp>::value 2077227825Stheraven || is_function<_Tp>::value, 2078227825Stheraven _Tp> 2079227825Stheraven {}; 2080227825Stheraven 2081227825Stheraventemplate <class _Tp, class _A0> 2082227825Stheravenstruct _LIBCPP_VISIBLE is_constructible<_Tp, _A0, __is_construct::__nat> 2083227825Stheraven : public __is_constructible1_void_check<is_void<_Tp>::value 2084227825Stheraven || is_abstract<_Tp>::value 2085227825Stheraven || is_function<_Tp>::value 2086227825Stheraven || is_void<_A0>::value, 2087227825Stheraven _Tp, _A0> 2088227825Stheraven {}; 2089227825Stheraven 2090227825Stheraven// Array types are default constructible if their element type 2091227825Stheraven// is default constructible 2092227825Stheraven 2093232950Stheraventemplate <class _Ap, size_t _Np> 2094232950Stheravenstruct __is_constructible0_imp<false, _Ap[_Np]> 2095232950Stheraven : public is_constructible<typename remove_all_extents<_Ap>::type> 2096227825Stheraven {}; 2097227825Stheraven 2098232950Stheraventemplate <class _Ap, size_t _Np, class _A0> 2099232950Stheravenstruct __is_constructible1_imp<false, _Ap[_Np], _A0> 2100227825Stheraven : public false_type 2101227825Stheraven {}; 2102227825Stheraven 2103232950Stheraventemplate <class _Ap, size_t _Np, class _A0, class _A1> 2104232950Stheravenstruct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1> 2105227825Stheraven : public false_type 2106227825Stheraven {}; 2107227825Stheraven 2108227825Stheraven// Incomplete array types are not constructible 2109227825Stheraven 2110232950Stheraventemplate <class _Ap> 2111232950Stheravenstruct __is_constructible0_imp<false, _Ap[]> 2112227825Stheraven : public false_type 2113227825Stheraven {}; 2114227825Stheraven 2115232950Stheraventemplate <class _Ap, class _A0> 2116232950Stheravenstruct __is_constructible1_imp<false, _Ap[], _A0> 2117227825Stheraven : public false_type 2118227825Stheraven {}; 2119227825Stheraven 2120232950Stheraventemplate <class _Ap, class _A0, class _A1> 2121232950Stheravenstruct __is_constructible2_imp<false, _Ap[], _A0, _A1> 2122227825Stheraven : public false_type 2123227825Stheraven {}; 2124227825Stheraven 2125227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2126227825Stheraven 2127227825Stheraven// is_default_constructible 2128227825Stheraven 2129227825Stheraventemplate <class _Tp> 2130227825Stheravenstruct _LIBCPP_VISIBLE is_default_constructible 2131227825Stheraven : public is_constructible<_Tp> 2132227825Stheraven {}; 2133227825Stheraven 2134227825Stheraven// is_copy_constructible 2135227825Stheraven 2136227825Stheraventemplate <class _Tp> 2137227825Stheravenstruct _LIBCPP_VISIBLE is_copy_constructible 2138227825Stheraven : public is_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> 2139227825Stheraven {}; 2140227825Stheraven 2141227825Stheraven// is_move_constructible 2142227825Stheraven 2143227825Stheraventemplate <class _Tp> 2144227825Stheravenstruct _LIBCPP_VISIBLE is_move_constructible 2145227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2146227825Stheraven : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2147227825Stheraven#else 2148227825Stheraven : public is_copy_constructible<_Tp> 2149227825Stheraven#endif 2150227825Stheraven {}; 2151227825Stheraven 2152227825Stheraven// is_trivially_constructible 2153227825Stheraven 2154227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2155227825Stheraven 2156232950Stheraven#if __has_feature(is_trivially_constructible) 2157232950Stheraven 2158227825Stheraventemplate <class _Tp, class... _Args> 2159227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible 2160232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> 2161232950Stheraven{ 2162232950Stheraven}; 2163232950Stheraven 2164232950Stheraven#else // !__has_feature(is_trivially_constructible) 2165232950Stheraven 2166232950Stheraventemplate <class _Tp, class... _Args> 2167232950Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible 2168227825Stheraven : false_type 2169227825Stheraven{ 2170227825Stheraven}; 2171227825Stheraven 2172227825Stheraventemplate <class _Tp> 2173227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp> 2174227825Stheraven#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2175227825Stheraven : integral_constant<bool, __has_trivial_constructor(_Tp)> 2176227825Stheraven#else 2177227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2178227825Stheraven#endif 2179227825Stheraven{ 2180227825Stheraven}; 2181227825Stheraven 2182227825Stheraventemplate <class _Tp> 2183227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2184227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&&> 2185227825Stheraven#else 2186227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp> 2187227825Stheraven#endif 2188227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2189227825Stheraven{ 2190227825Stheraven}; 2191227825Stheraven 2192227825Stheraventemplate <class _Tp> 2193227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&> 2194227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2195227825Stheraven{ 2196227825Stheraven}; 2197227825Stheraven 2198227825Stheraventemplate <class _Tp> 2199227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&> 2200227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2201227825Stheraven{ 2202227825Stheraven}; 2203227825Stheraven 2204232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2205232950Stheraven 2206227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2207227825Stheraven 2208227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2209227825Stheraven class _A1 = __is_construct::__nat> 2210227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible 2211227825Stheraven : false_type 2212227825Stheraven{ 2213227825Stheraven}; 2214227825Stheraven 2215232950Stheraven#if __has_feature(is_trivially_constructible) 2216232950Stheraven 2217227825Stheraventemplate <class _Tp> 2218227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat, 2219227825Stheraven __is_construct::__nat> 2220232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp)> 2221232950Stheraven{ 2222232950Stheraven}; 2223232950Stheraven 2224232950Stheraventemplate <class _Tp> 2225232950Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp, 2226232950Stheraven __is_construct::__nat> 2227232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)> 2228232950Stheraven{ 2229232950Stheraven}; 2230232950Stheraven 2231232950Stheraventemplate <class _Tp> 2232232950Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&, 2233232950Stheraven __is_construct::__nat> 2234232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)> 2235232950Stheraven{ 2236232950Stheraven}; 2237232950Stheraven 2238232950Stheraventemplate <class _Tp> 2239232950Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&, 2240232950Stheraven __is_construct::__nat> 2241232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)> 2242232950Stheraven{ 2243232950Stheraven}; 2244232950Stheraven 2245232950Stheraven#else // !__has_feature(is_trivially_constructible) 2246232950Stheraven 2247232950Stheraventemplate <class _Tp> 2248232950Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat, 2249232950Stheraven __is_construct::__nat> 2250227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2251227825Stheraven{ 2252227825Stheraven}; 2253227825Stheraven 2254227825Stheraventemplate <class _Tp> 2255227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp, 2256227825Stheraven __is_construct::__nat> 2257227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2258227825Stheraven{ 2259227825Stheraven}; 2260227825Stheraven 2261227825Stheraventemplate <class _Tp> 2262227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&, 2263227825Stheraven __is_construct::__nat> 2264227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2265227825Stheraven{ 2266227825Stheraven}; 2267227825Stheraven 2268227825Stheraventemplate <class _Tp> 2269227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&, 2270227825Stheraven __is_construct::__nat> 2271227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2272227825Stheraven{ 2273227825Stheraven}; 2274227825Stheraven 2275232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2276232950Stheraven 2277227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2278227825Stheraven 2279227825Stheraven// is_trivially_default_constructible 2280227825Stheraven 2281227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_default_constructible 2282227825Stheraven : public is_trivially_constructible<_Tp> 2283227825Stheraven {}; 2284227825Stheraven 2285227825Stheraven// is_trivially_copy_constructible 2286227825Stheraven 2287227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copy_constructible 2288227825Stheraven : public is_trivially_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> 2289227825Stheraven {}; 2290227825Stheraven 2291227825Stheraven// is_trivially_move_constructible 2292227825Stheraven 2293227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_move_constructible 2294227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2295227825Stheraven : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2296227825Stheraven#else 2297227825Stheraven : public is_trivially_copy_constructible<_Tp> 2298227825Stheraven#endif 2299227825Stheraven {}; 2300227825Stheraven 2301227825Stheraven// is_trivially_assignable 2302227825Stheraven 2303232950Stheraven#if __has_feature(is_trivially_constructible) 2304232950Stheraven 2305227825Stheraventemplate <class _Tp, class _Arg> 2306227825Stheravenstruct is_trivially_assignable 2307232950Stheraven : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> 2308232950Stheraven{ 2309232950Stheraven}; 2310232950Stheraven 2311232950Stheraven#else // !__has_feature(is_trivially_constructible) 2312232950Stheraven 2313232950Stheraventemplate <class _Tp, class _Arg> 2314232950Stheravenstruct is_trivially_assignable 2315227825Stheraven : public false_type {}; 2316227825Stheraven 2317227825Stheraventemplate <class _Tp> 2318227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp> 2319227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2320227825Stheraven 2321227825Stheraventemplate <class _Tp> 2322227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp&> 2323227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2324227825Stheraven 2325227825Stheraventemplate <class _Tp> 2326227825Stheravenstruct is_trivially_assignable<_Tp&, const _Tp&> 2327227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2328227825Stheraven 2329227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2330227825Stheraven 2331227825Stheraventemplate <class _Tp> 2332227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp&&> 2333227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2334227825Stheraven 2335227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2336227825Stheraven 2337232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2338232950Stheraven 2339227825Stheraven// is_trivially_copy_assignable 2340227825Stheraven 2341227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copy_assignable 2342227825Stheraven : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2343227825Stheraven const typename add_lvalue_reference<_Tp>::type> 2344227825Stheraven {}; 2345227825Stheraven 2346227825Stheraven// is_trivially_move_assignable 2347227825Stheraven 2348227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_move_assignable 2349227825Stheraven : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2350227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2351227825Stheraven typename add_rvalue_reference<_Tp>::type> 2352227825Stheraven#else 2353227825Stheraven typename add_lvalue_reference<_Tp>::type> 2354227825Stheraven#endif 2355227825Stheraven {}; 2356227825Stheraven 2357227825Stheraven// is_trivially_destructible 2358227825Stheraven 2359227825Stheraven#if __has_feature(has_trivial_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2360227825Stheraven 2361227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_destructible 2362227825Stheraven : public integral_constant<bool, __has_trivial_destructor(_Tp)> {}; 2363227825Stheraven 2364227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 2365227825Stheraven 2366227825Stheraventemplate <class _Tp> struct __libcpp_trivial_destructor 2367227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 2368227825Stheraven is_reference<_Tp>::value> {}; 2369227825Stheraven 2370227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_destructible 2371227825Stheraven : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {}; 2372227825Stheraven 2373227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 2374227825Stheraven 2375227825Stheraven// is_nothrow_constructible 2376227825Stheraven 2377227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2378227825Stheraven 2379227825Stheraven#if __has_feature(cxx_noexcept) 2380227825Stheraven 2381227825Stheraventemplate <bool, class _Tp, class... _Args> struct __is_nothrow_constructible; 2382227825Stheraven 2383227825Stheraventemplate <class _Tp, class... _Args> 2384227825Stheravenstruct __is_nothrow_constructible<true, _Tp, _Args...> 2385227825Stheraven : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> 2386227825Stheraven{ 2387227825Stheraven}; 2388227825Stheraven 2389227825Stheraventemplate <class _Tp, class... _Args> 2390227825Stheravenstruct __is_nothrow_constructible<false, _Tp, _Args...> 2391227825Stheraven : public false_type 2392227825Stheraven{ 2393227825Stheraven}; 2394227825Stheraven 2395227825Stheraventemplate <class _Tp, class... _Args> 2396227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible 2397227825Stheraven : __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...> 2398227825Stheraven{ 2399227825Stheraven}; 2400227825Stheraven 2401227825Stheraventemplate <class _Tp, size_t _Ns> 2402227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp[_Ns]> 2403227825Stheraven : __is_nothrow_constructible<is_constructible<_Tp>::value, _Tp> 2404227825Stheraven{ 2405227825Stheraven}; 2406227825Stheraven 2407227825Stheraven#else // __has_feature(cxx_noexcept) 2408227825Stheraven 2409227825Stheraventemplate <class _Tp, class... _Args> 2410227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible 2411227825Stheraven : false_type 2412227825Stheraven{ 2413227825Stheraven}; 2414227825Stheraven 2415227825Stheraventemplate <class _Tp> 2416227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp> 2417227825Stheraven#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2418227825Stheraven : integral_constant<bool, __has_nothrow_constructor(_Tp)> 2419227825Stheraven#else 2420227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2421227825Stheraven#endif 2422227825Stheraven{ 2423227825Stheraven}; 2424227825Stheraven 2425227825Stheraventemplate <class _Tp> 2426227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2427227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&&> 2428227825Stheraven#else 2429227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp> 2430227825Stheraven#endif 2431227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2432227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2433227825Stheraven#else 2434227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2435227825Stheraven#endif 2436227825Stheraven{ 2437227825Stheraven}; 2438227825Stheraven 2439227825Stheraventemplate <class _Tp> 2440227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&> 2441227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2442227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2443227825Stheraven#else 2444227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2445227825Stheraven#endif 2446227825Stheraven{ 2447227825Stheraven}; 2448227825Stheraven 2449227825Stheraventemplate <class _Tp> 2450227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&> 2451227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2452227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2453227825Stheraven#else 2454227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2455227825Stheraven#endif 2456227825Stheraven{ 2457227825Stheraven}; 2458227825Stheraven 2459227825Stheraven#endif // __has_feature(cxx_noexcept) 2460227825Stheraven 2461227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2462227825Stheraven 2463227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2464227825Stheraven class _A1 = __is_construct::__nat> 2465227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible 2466227825Stheraven : false_type 2467227825Stheraven{ 2468227825Stheraven}; 2469227825Stheraven 2470227825Stheraventemplate <class _Tp> 2471227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, __is_construct::__nat, 2472227825Stheraven __is_construct::__nat> 2473227825Stheraven#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2474227825Stheraven : integral_constant<bool, __has_nothrow_constructor(_Tp)> 2475227825Stheraven#else 2476227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2477227825Stheraven#endif 2478227825Stheraven{ 2479227825Stheraven}; 2480227825Stheraven 2481227825Stheraventemplate <class _Tp> 2482227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp, 2483227825Stheraven __is_construct::__nat> 2484227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2485227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2486227825Stheraven#else 2487227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2488227825Stheraven#endif 2489227825Stheraven{ 2490227825Stheraven}; 2491227825Stheraven 2492227825Stheraventemplate <class _Tp> 2493227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&, 2494227825Stheraven __is_construct::__nat> 2495227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2496227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2497227825Stheraven#else 2498227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2499227825Stheraven#endif 2500227825Stheraven{ 2501227825Stheraven}; 2502227825Stheraven 2503227825Stheraventemplate <class _Tp> 2504227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&, 2505227825Stheraven __is_construct::__nat> 2506227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2507227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2508227825Stheraven#else 2509227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2510227825Stheraven#endif 2511227825Stheraven{ 2512227825Stheraven}; 2513227825Stheraven 2514227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2515227825Stheraven 2516227825Stheraven// is_nothrow_default_constructible 2517227825Stheraven 2518227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_default_constructible 2519227825Stheraven : public is_nothrow_constructible<_Tp> 2520227825Stheraven {}; 2521227825Stheraven 2522227825Stheraven// is_nothrow_copy_constructible 2523227825Stheraven 2524227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_copy_constructible 2525227825Stheraven : public is_nothrow_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> 2526227825Stheraven {}; 2527227825Stheraven 2528227825Stheraven// is_nothrow_move_constructible 2529227825Stheraven 2530227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_move_constructible 2531227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2532227825Stheraven : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2533227825Stheraven#else 2534227825Stheraven : public is_nothrow_copy_constructible<_Tp> 2535227825Stheraven#endif 2536227825Stheraven {}; 2537227825Stheraven 2538227825Stheraven// is_nothrow_assignable 2539227825Stheraven 2540227825Stheraven#if __has_feature(cxx_noexcept) 2541227825Stheraven 2542227825Stheraventemplate <bool, class _Tp, class _Arg> struct __is_nothrow_assignable; 2543227825Stheraven 2544227825Stheraventemplate <class _Tp, class _Arg> 2545227825Stheravenstruct __is_nothrow_assignable<false, _Tp, _Arg> 2546227825Stheraven : public false_type 2547227825Stheraven{ 2548227825Stheraven}; 2549227825Stheraven 2550227825Stheraventemplate <class _Tp, class _Arg> 2551227825Stheravenstruct __is_nothrow_assignable<true, _Tp, _Arg> 2552227825Stheraven : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) > 2553227825Stheraven{ 2554227825Stheraven}; 2555227825Stheraven 2556227825Stheraventemplate <class _Tp, class _Arg> 2557227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_assignable 2558227825Stheraven : public __is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg> 2559227825Stheraven{ 2560227825Stheraven}; 2561227825Stheraven 2562227825Stheraven#else // __has_feature(cxx_noexcept) 2563227825Stheraven 2564227825Stheraventemplate <class _Tp, class _Arg> 2565227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_assignable 2566227825Stheraven : public false_type {}; 2567227825Stheraven 2568227825Stheraventemplate <class _Tp> 2569227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp> 2570227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2571227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2572227825Stheraven#else 2573227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2574227825Stheraven#endif 2575227825Stheraven 2576227825Stheraventemplate <class _Tp> 2577227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp&> 2578227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2579227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2580227825Stheraven#else 2581227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2582227825Stheraven#endif 2583227825Stheraven 2584227825Stheraventemplate <class _Tp> 2585227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, const _Tp&> 2586227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2587227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2588227825Stheraven#else 2589227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2590227825Stheraven#endif 2591227825Stheraven 2592227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2593227825Stheraven 2594227825Stheraventemplate <class _Tp> 2595227825Stheravenstruct is_nothrow_assignable<_Tp&, _Tp&&> 2596227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2597227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2598227825Stheraven#else 2599227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2600227825Stheraven#endif 2601227825Stheraven 2602227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2603227825Stheraven 2604227825Stheraven#endif // __has_feature(cxx_noexcept) 2605227825Stheraven 2606227825Stheraven// is_nothrow_copy_assignable 2607227825Stheraven 2608227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_copy_assignable 2609227825Stheraven : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 2610227825Stheraven const typename add_lvalue_reference<_Tp>::type> 2611227825Stheraven {}; 2612227825Stheraven 2613227825Stheraven// is_nothrow_move_assignable 2614227825Stheraven 2615227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_move_assignable 2616227825Stheraven : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 2617227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2618227825Stheraven typename add_rvalue_reference<_Tp>::type> 2619227825Stheraven#else 2620227825Stheraven typename add_lvalue_reference<_Tp>::type> 2621227825Stheraven#endif 2622227825Stheraven {}; 2623227825Stheraven 2624227825Stheraven// is_nothrow_destructible 2625227825Stheraven 2626227825Stheraven#if __has_feature(cxx_noexcept) 2627227825Stheraven 2628227825Stheraventemplate <bool, class _Tp> struct __is_nothrow_destructible; 2629227825Stheraven 2630227825Stheraventemplate <class _Tp> 2631227825Stheravenstruct __is_nothrow_destructible<false, _Tp> 2632227825Stheraven : public false_type 2633227825Stheraven{ 2634227825Stheraven}; 2635227825Stheraven 2636227825Stheraventemplate <class _Tp> 2637227825Stheravenstruct __is_nothrow_destructible<true, _Tp> 2638227825Stheraven : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) > 2639227825Stheraven{ 2640227825Stheraven}; 2641227825Stheraven 2642227825Stheraventemplate <class _Tp> 2643227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_destructible 2644227825Stheraven : public __is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> 2645227825Stheraven{ 2646227825Stheraven}; 2647227825Stheraven 2648227825Stheraventemplate <class _Tp, size_t _Ns> 2649227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp[_Ns]> 2650227825Stheraven : public is_nothrow_destructible<_Tp> 2651227825Stheraven{ 2652227825Stheraven}; 2653227825Stheraven 2654227825Stheraventemplate <class _Tp> 2655227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp&> 2656227825Stheraven : public true_type 2657227825Stheraven{ 2658227825Stheraven}; 2659227825Stheraven 2660227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2661227825Stheraven 2662227825Stheraventemplate <class _Tp> 2663227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp&&> 2664227825Stheraven : public true_type 2665227825Stheraven{ 2666227825Stheraven}; 2667227825Stheraven 2668227825Stheraven#endif 2669227825Stheraven 2670227825Stheraven#else 2671227825Stheraven 2672227825Stheraventemplate <class _Tp> struct __libcpp_nothrow_destructor 2673227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 2674227825Stheraven is_reference<_Tp>::value> {}; 2675227825Stheraven 2676227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_destructible 2677227825Stheraven : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {}; 2678227825Stheraven 2679227825Stheraven#endif 2680227825Stheraven 2681227825Stheraven// is_pod 2682227825Stheraven 2683227825Stheraven#if __has_feature(is_pod) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2684227825Stheraven 2685227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_pod 2686227825Stheraven : public integral_constant<bool, __is_pod(_Tp)> {}; 2687227825Stheraven 2688227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 2689227825Stheraven 2690227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_pod 2691227825Stheraven : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value && 2692227825Stheraven is_trivially_copy_constructible<_Tp>::value && 2693227825Stheraven is_trivially_copy_assignable<_Tp>::value && 2694227825Stheraven is_trivially_destructible<_Tp>::value> {}; 2695227825Stheraven 2696227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 2697227825Stheraven 2698227825Stheraven// is_literal_type; 2699227825Stheraven 2700227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_literal_type 2701227825Stheraven#if __has_feature(is_literal) 2702227825Stheraven : public integral_constant<bool, __is_literal(_Tp)> 2703227825Stheraven#else 2704227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value || 2705227825Stheraven is_reference<typename remove_all_extents<_Tp>::type>::value> 2706227825Stheraven#endif 2707227825Stheraven {}; 2708227825Stheraven 2709227825Stheraven// is_standard_layout; 2710227825Stheraven 2711227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_standard_layout 2712227825Stheraven#if __has_feature(is_standard_layout) 2713227825Stheraven : public integral_constant<bool, __is_standard_layout(_Tp)> 2714227825Stheraven#else 2715227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 2716227825Stheraven#endif 2717227825Stheraven {}; 2718227825Stheraven 2719227825Stheraven// is_trivially_copyable; 2720227825Stheraven 2721227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copyable 2722227825Stheraven#if __has_feature(is_trivially_copyable) 2723227825Stheraven : public integral_constant<bool, __is_trivially_copyable(_Tp)> 2724227825Stheraven#else 2725227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 2726227825Stheraven#endif 2727227825Stheraven {}; 2728227825Stheraven 2729227825Stheraven// is_trivial; 2730227825Stheraven 2731227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivial 2732227825Stheraven#if __has_feature(is_trivial) 2733227825Stheraven : public integral_constant<bool, __is_trivial(_Tp)> 2734227825Stheraven#else 2735227825Stheraven : integral_constant<bool, is_trivially_copyable<_Tp>::value && 2736227825Stheraven is_trivially_default_constructible<_Tp>::value> 2737227825Stheraven#endif 2738227825Stheraven {}; 2739227825Stheraven 2740227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2741227825Stheraven 2742227825Stheraven// Check for complete types 2743227825Stheraven 2744232950Stheraventemplate <class ..._Tp> struct __check_complete; 2745227825Stheraven 2746227825Stheraventemplate <> 2747227825Stheravenstruct __check_complete<> 2748227825Stheraven{ 2749227825Stheraven}; 2750227825Stheraven 2751232950Stheraventemplate <class _Hp, class _T0, class ..._Tp> 2752232950Stheravenstruct __check_complete<_Hp, _T0, _Tp...> 2753232950Stheraven : private __check_complete<_Hp>, 2754232950Stheraven private __check_complete<_T0, _Tp...> 2755227825Stheraven{ 2756227825Stheraven}; 2757227825Stheraven 2758232950Stheraventemplate <class _Hp> 2759232950Stheravenstruct __check_complete<_Hp, _Hp> 2760232950Stheraven : private __check_complete<_Hp> 2761227825Stheraven{ 2762227825Stheraven}; 2763227825Stheraven 2764232950Stheraventemplate <class _Tp> 2765232950Stheravenstruct __check_complete<_Tp> 2766227825Stheraven{ 2767232950Stheraven static_assert(sizeof(_Tp) > 0, "Type must be complete."); 2768227825Stheraven}; 2769227825Stheraven 2770232950Stheraventemplate <class _Tp> 2771232950Stheravenstruct __check_complete<_Tp&> 2772232950Stheraven : private __check_complete<_Tp> 2773227825Stheraven{ 2774227825Stheraven}; 2775227825Stheraven 2776232950Stheraventemplate <class _Tp> 2777232950Stheravenstruct __check_complete<_Tp&&> 2778232950Stheraven : private __check_complete<_Tp> 2779227825Stheraven{ 2780227825Stheraven}; 2781227825Stheraven 2782232950Stheraventemplate <class _Rp, class ..._Param> 2783232950Stheravenstruct __check_complete<_Rp (*)(_Param...)> 2784227825Stheraven : private __check_complete<_Param...> 2785227825Stheraven{ 2786227825Stheraven}; 2787227825Stheraven 2788232950Stheraventemplate <class _Rp, class ..._Param> 2789232950Stheravenstruct __check_complete<_Rp (_Param...)> 2790227825Stheraven : private __check_complete<_Param...> 2791227825Stheraven{ 2792227825Stheraven}; 2793227825Stheraven 2794232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2795232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...)> 2796227825Stheraven : private __check_complete<_Class, _Param...> 2797227825Stheraven{ 2798227825Stheraven}; 2799227825Stheraven 2800232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2801232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const> 2802227825Stheraven : private __check_complete<_Class, _Param...> 2803227825Stheraven{ 2804227825Stheraven}; 2805227825Stheraven 2806232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2807232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile> 2808227825Stheraven : private __check_complete<_Class, _Param...> 2809227825Stheraven{ 2810227825Stheraven}; 2811227825Stheraven 2812232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2813232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile> 2814227825Stheraven : private __check_complete<_Class, _Param...> 2815227825Stheraven{ 2816227825Stheraven}; 2817227825Stheraven 2818227825Stheraven#if __has_feature(cxx_reference_qualified_functions) 2819227825Stheraven 2820232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2821232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) &> 2822227825Stheraven : private __check_complete<_Class, _Param...> 2823227825Stheraven{ 2824227825Stheraven}; 2825227825Stheraven 2826232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2827232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const&> 2828227825Stheraven : private __check_complete<_Class, _Param...> 2829227825Stheraven{ 2830227825Stheraven}; 2831227825Stheraven 2832232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2833232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile&> 2834227825Stheraven : private __check_complete<_Class, _Param...> 2835227825Stheraven{ 2836227825Stheraven}; 2837227825Stheraven 2838232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2839232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> 2840227825Stheraven : private __check_complete<_Class, _Param...> 2841227825Stheraven{ 2842227825Stheraven}; 2843227825Stheraven 2844232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2845232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) &&> 2846227825Stheraven : private __check_complete<_Class, _Param...> 2847227825Stheraven{ 2848227825Stheraven}; 2849227825Stheraven 2850232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2851232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const&&> 2852227825Stheraven : private __check_complete<_Class, _Param...> 2853227825Stheraven{ 2854227825Stheraven}; 2855227825Stheraven 2856232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2857232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> 2858227825Stheraven : private __check_complete<_Class, _Param...> 2859227825Stheraven{ 2860227825Stheraven}; 2861227825Stheraven 2862232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2863232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> 2864227825Stheraven : private __check_complete<_Class, _Param...> 2865227825Stheraven{ 2866227825Stheraven}; 2867227825Stheraven 2868227825Stheraven#endif 2869227825Stheraven 2870232950Stheraventemplate <class _Rp, class _Class> 2871232950Stheravenstruct __check_complete<_Rp _Class::*> 2872227825Stheraven : private __check_complete<_Class> 2873227825Stheraven{ 2874227825Stheraven}; 2875227825Stheraven 2876227825Stheraven// __invoke forward declarations 2877227825Stheraven 2878227825Stheraven// fall back - none of the bullets 2879227825Stheraven 2880227825Stheraventemplate <class ..._Args> 2881227825Stheravenauto 2882227825Stheraven__invoke(__any, _Args&& ...__args) 2883227825Stheraven -> __nat; 2884227825Stheraven 2885227825Stheraven// bullets 1 and 2 2886227825Stheraven 2887232950Stheraventemplate <class _Fp, class _A0, class ..._Args> 2888227825Stheravenauto 2889232950Stheraven__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 2890227825Stheraven -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)); 2891227825Stheraven 2892232950Stheraventemplate <class _Fp, class _A0, class ..._Args> 2893227825Stheravenauto 2894232950Stheraven__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 2895227825Stheraven -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)); 2896227825Stheraven 2897227825Stheraven// bullets 3 and 4 2898227825Stheraven 2899232950Stheraventemplate <class _Fp, class _A0> 2900227825Stheravenauto 2901232950Stheraven__invoke(_Fp&& __f, _A0&& __a0) 2902227825Stheraven -> decltype(_VSTD::forward<_A0>(__a0).*__f); 2903227825Stheraven 2904232950Stheraventemplate <class _Fp, class _A0> 2905227825Stheravenauto 2906232950Stheraven__invoke(_Fp&& __f, _A0&& __a0) 2907227825Stheraven -> decltype((*_VSTD::forward<_A0>(__a0)).*__f); 2908227825Stheraven 2909227825Stheraven// bullet 5 2910227825Stheraven 2911232950Stheraventemplate <class _Fp, class ..._Args> 2912227825Stheravenauto 2913232950Stheraven__invoke(_Fp&& __f, _Args&& ...__args) 2914232950Stheraven -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)); 2915227825Stheraven 2916227825Stheraven// __invokable 2917227825Stheraven 2918232950Stheraventemplate <class _Fp, class ..._Args> 2919227825Stheravenstruct __invokable_imp 2920232950Stheraven : private __check_complete<_Fp, _Args...> 2921227825Stheraven{ 2922227825Stheraven typedef decltype( 2923232950Stheraven __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...) 2924227825Stheraven ) type; 2925227825Stheraven static const bool value = !is_same<type, __nat>::value; 2926227825Stheraven}; 2927227825Stheraven 2928232950Stheraventemplate <class _Fp, class ..._Args> 2929227825Stheravenstruct __invokable 2930227825Stheraven : public integral_constant<bool, 2931232950Stheraven __invokable_imp<_Fp, _Args...>::value> 2932227825Stheraven{ 2933227825Stheraven}; 2934227825Stheraven 2935227825Stheraven// __invoke_of 2936227825Stheraven 2937232950Stheraventemplate <bool _Invokable, class _Fp, class ..._Args> 2938227825Stheravenstruct __invoke_of_imp // false 2939227825Stheraven{ 2940227825Stheraven}; 2941227825Stheraven 2942232950Stheraventemplate <class _Fp, class ..._Args> 2943232950Stheravenstruct __invoke_of_imp<true, _Fp, _Args...> 2944227825Stheraven{ 2945232950Stheraven typedef typename __invokable_imp<_Fp, _Args...>::type type; 2946227825Stheraven}; 2947227825Stheraven 2948232950Stheraventemplate <class _Fp, class ..._Args> 2949227825Stheravenstruct __invoke_of 2950232950Stheraven : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...> 2951227825Stheraven{ 2952227825Stheraven}; 2953227825Stheraven 2954227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2955227825Stheraven 2956227825Stheraventemplate <class _Tp> 2957227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2958227825Stheraven#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE 2959227825Stheraventypename enable_if 2960227825Stheraven< 2961227825Stheraven is_move_constructible<_Tp>::value && 2962227825Stheraven is_move_assignable<_Tp>::value 2963227825Stheraven>::type 2964227825Stheraven#else 2965227825Stheravenvoid 2966227825Stheraven#endif 2967227825Stheravenswap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && 2968227825Stheraven is_nothrow_move_assignable<_Tp>::value) 2969227825Stheraven{ 2970227825Stheraven _Tp __t(_VSTD::move(__x)); 2971227825Stheraven __x = _VSTD::move(__y); 2972227825Stheraven __y = _VSTD::move(__t); 2973227825Stheraven} 2974227825Stheraven 2975227825Stheraventemplate <class _ForwardIterator1, class _ForwardIterator2> 2976227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2977227825Stheravenvoid 2978227825Stheraveniter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) 2979227825Stheraven // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b))) 2980227825Stheraven _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(), 2981227825Stheraven *_VSTD::declval<_ForwardIterator2>()))) 2982227825Stheraven{ 2983227825Stheraven swap(*__a, *__b); 2984227825Stheraven} 2985227825Stheraven 2986227825Stheraven// __swappable 2987227825Stheraven 2988227825Stheravennamespace __detail 2989227825Stheraven{ 2990227825Stheraven 2991227825Stheravenusing _VSTD::swap; 2992227825Stheraven__nat swap(__any, __any); 2993227825Stheraven 2994227825Stheraventemplate <class _Tp> 2995227825Stheravenstruct __swappable 2996227825Stheraven{ 2997227825Stheraven typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type; 2998227825Stheraven static const bool value = !is_same<type, __nat>::value; 2999227825Stheraven}; 3000227825Stheraven 3001227825Stheraven} // __detail 3002227825Stheraven 3003227825Stheraventemplate <class _Tp> 3004227825Stheravenstruct __is_swappable 3005227825Stheraven : public integral_constant<bool, __detail::__swappable<_Tp>::value> 3006227825Stheraven{ 3007227825Stheraven}; 3008227825Stheraven 3009227825Stheraven#if __has_feature(cxx_noexcept) 3010227825Stheraven 3011227825Stheraventemplate <bool, class _Tp> 3012227825Stheravenstruct __is_nothrow_swappable_imp 3013227825Stheraven : public integral_constant<bool, noexcept(swap(_VSTD::declval<_Tp&>(), 3014227825Stheraven _VSTD::declval<_Tp&>()))> 3015227825Stheraven{ 3016227825Stheraven}; 3017227825Stheraven 3018227825Stheraventemplate <class _Tp> 3019227825Stheravenstruct __is_nothrow_swappable_imp<false, _Tp> 3020227825Stheraven : public false_type 3021227825Stheraven{ 3022227825Stheraven}; 3023227825Stheraven 3024227825Stheraventemplate <class _Tp> 3025227825Stheravenstruct __is_nothrow_swappable 3026227825Stheraven : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp> 3027227825Stheraven{ 3028227825Stheraven}; 3029227825Stheraven 3030227825Stheraven#else // __has_feature(cxx_noexcept) 3031227825Stheraven 3032227825Stheraventemplate <class _Tp> 3033227825Stheravenstruct __is_nothrow_swappable 3034227825Stheraven : public false_type 3035227825Stheraven{ 3036227825Stheraven}; 3037227825Stheraven 3038227825Stheraven#endif // __has_feature(cxx_noexcept) 3039227825Stheraven 3040227825Stheraven#ifdef _LIBCXX_UNDERLYING_TYPE 3041227825Stheraven 3042227825Stheraventemplate <class _Tp> 3043227825Stheravenstruct underlying_type 3044227825Stheraven{ 3045227825Stheraven typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type; 3046227825Stheraven}; 3047227825Stheraven 3048227825Stheraven#else // _LIBCXX_UNDERLYING_TYPE 3049227825Stheraven 3050227825Stheraventemplate <class _Tp, bool _Support = false> 3051227825Stheravenstruct underlying_type 3052227825Stheraven{ 3053227825Stheraven static_assert(_Support, "The underyling_type trait requires compiler " 3054227825Stheraven "support. Either no such support exists or " 3055227825Stheraven "libc++ does not know how to use it."); 3056227825Stheraven}; 3057227825Stheraven 3058227825Stheraven#endif // _LIBCXX_UNDERLYING_TYPE 3059227825Stheraven 3060227825Stheraven_LIBCPP_END_NAMESPACE_STD 3061227825Stheraven 3062227825Stheraven#endif // _LIBCPP_TYPE_TRAITS 3063