type_traits revision 241903
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 610241903Sdim// is_base_of 611241903Sdim 612241903Sdim#ifdef _LIBCP_HAS_IS_BASE_OF 613241903Sdim 614241903Sdimtemplate <class _Bp, class _Dp> 615241903Sdimstruct _LIBCPP_VISIBLE is_base_of 616241903Sdim : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; 617241903Sdim 618241903Sdim#else // __has_feature(is_base_of) 619241903Sdim 620241903Sdim#error is_base_of not implemented. 621241903Sdim 622241903Sdim#endif // __has_feature(is_base_of) 623241903Sdim 624227825Stheraven// is_convertible 625227825Stheraven 626227825Stheraven#if __has_feature(is_convertible_to) 627227825Stheraven 628227825Stheraventemplate <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible 629241903Sdim : public integral_constant<bool, __is_convertible_to(_T1, _T2) && 630241903Sdim !is_abstract<_T2>::value> {}; 631227825Stheraven 632227825Stheraven#else // __has_feature(is_convertible_to) 633227825Stheraven 634227825Stheravennamespace __is_convertible_imp 635227825Stheraven{ 636227825Stheraventemplate <class _Tp> char __test(_Tp); 637227825Stheraventemplate <class _Tp> __two __test(...); 638227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 639227825Stheraventemplate <class _Tp> _Tp&& __source(); 640227825Stheraven#else 641227825Stheraventemplate <class _Tp> typename remove_reference<_Tp>::type& __source(); 642227825Stheraven#endif 643227825Stheraven 644227825Stheraventemplate <class _Tp, bool _IsArray = is_array<_Tp>::value, 645227825Stheraven bool _IsFunction = is_function<_Tp>::value, 646227825Stheraven bool _IsVoid = is_void<_Tp>::value> 647227825Stheraven struct __is_array_function_or_void {enum {value = 0};}; 648227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};}; 649227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};}; 650227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};}; 651227825Stheraven} 652227825Stheraven 653227825Stheraventemplate <class _Tp, 654227825Stheraven unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value> 655227825Stheravenstruct __is_convertible_check 656227825Stheraven{ 657227825Stheraven static const size_t __v = 0; 658227825Stheraven}; 659227825Stheraven 660227825Stheraventemplate <class _Tp> 661227825Stheravenstruct __is_convertible_check<_Tp, 0> 662227825Stheraven{ 663227825Stheraven static const size_t __v = sizeof(_Tp); 664227825Stheraven}; 665227825Stheraven 666227825Stheraventemplate <class _T1, class _T2, 667227825Stheraven unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value, 668227825Stheraven unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value> 669227825Stheravenstruct __is_convertible 670227825Stheraven : public integral_constant<bool, 671241903Sdim#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 672227825Stheraven sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 673241903Sdim#else 674241903Sdim sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1 675241903Sdim && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value 676241903Sdim && (!is_const<typename remove_reference<_T2>::type>::value 677241903Sdim || is_volatile<typename remove_reference<_T2>::type>::value) 678241903Sdim && (is_same<typename remove_cv<_T1>::type, 679241903Sdim typename remove_cv<typename remove_reference<_T2>::type>::type>::value 680241903Sdim || is_base_of<typename remove_reference<_T2>::type, _T1>::value)) 681241903Sdim#endif 682227825Stheraven > 683227825Stheraven{}; 684227825Stheraven 685227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {}; 686227825Stheraven 687227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {}; 688227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 689227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {}; 690227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {}; 691227825Stheraventemplate <class _T1> struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {}; 692227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {}; 693227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 694227825Stheraven 695227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2*, 1, 0> 696227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*>::value> {}; 697227825Stheraven 698227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* const, 1, 0> 699227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const>::value> {}; 700227825Stheraven 701227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* volatile, 1, 0> 702227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*volatile>::value> {}; 703227825Stheraven 704227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* const volatile, 1, 0> 705227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const volatile>::value> {}; 706227825Stheraven 707227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0> : public false_type {}; 708227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 709227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1&&, 2, 0> : public true_type {}; 710227825Stheraven#endif 711241903Sdimtemplate <class _T1> struct __is_convertible<_T1, _T1&, 2, 0> : public true_type {}; 712227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*, 2, 0> : public true_type {}; 713227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*const, 2, 0> : public true_type {}; 714227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {}; 715227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {}; 716227825Stheraven 717227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 0> : public false_type {}; 718227825Stheraven 719227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {}; 720227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {}; 721227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {}; 722227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {}; 723227825Stheraven 724227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {}; 725227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {}; 726227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {}; 727227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {}; 728227825Stheraven 729227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {}; 730227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {}; 731227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {}; 732227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {}; 733227825Stheraven 734227825Stheraventemplate <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible 735227825Stheraven : public __is_convertible<_T1, _T2> 736227825Stheraven{ 737227825Stheraven static const size_t __complete_check1 = __is_convertible_check<_T1>::__v; 738227825Stheraven static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; 739227825Stheraven}; 740227825Stheraven 741227825Stheraven#endif // __has_feature(is_convertible_to) 742227825Stheraven 743227825Stheraven// is_empty 744227825Stheraven 745232950Stheraven#if __has_feature(is_empty) 746232950Stheraven 747227825Stheraventemplate <class _Tp> 748232950Stheravenstruct _LIBCPP_VISIBLE is_empty 749232950Stheraven : public integral_constant<bool, __is_empty(_Tp)> {}; 750232950Stheraven 751232950Stheraven#else // __has_feature(is_empty) 752232950Stheraven 753232950Stheraventemplate <class _Tp> 754227825Stheravenstruct __is_empty1 755227825Stheraven : public _Tp 756227825Stheraven{ 757227825Stheraven double _; 758227825Stheraven}; 759227825Stheraven 760227825Stheravenstruct __is_empty2 761227825Stheraven{ 762227825Stheraven double _; 763227825Stheraven}; 764227825Stheraven 765227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value> 766227825Stheravenstruct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {}; 767227825Stheraven 768227825Stheraventemplate <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {}; 769227825Stheraven 770227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_empty : public __libcpp_empty<_Tp> {}; 771227825Stheraven 772232950Stheraven#endif // __has_feature(is_empty) 773232950Stheraven 774227825Stheraven// is_polymorphic 775227825Stheraven 776232950Stheraven#if __has_feature(is_polymorphic) 777232950Stheraven 778232950Stheraventemplate <class _Tp> 779232950Stheravenstruct _LIBCPP_VISIBLE is_polymorphic 780232950Stheraven : public integral_constant<bool, __is_polymorphic(_Tp)> {}; 781232950Stheraven 782232950Stheraven#else 783232950Stheraven 784227825Stheraventemplate <class _Tp> struct __is_polymorphic1 : public _Tp {}; 785227825Stheraventemplate <class _Tp> struct __is_polymorphic2 : public _Tp {virtual ~__is_polymorphic2() throw();}; 786227825Stheraven 787227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value> 788227825Stheravenstruct __libcpp_polymorphic 789227825Stheraven : public integral_constant<bool, sizeof(__is_polymorphic1<_Tp>) == sizeof(__is_polymorphic2<_Tp>)> {}; 790227825Stheraven 791227825Stheraventemplate <class _Tp> struct __libcpp_polymorphic<_Tp, false> : public false_type {}; 792227825Stheraven 793227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_polymorphic 794227825Stheraven : public __libcpp_polymorphic<_Tp> {}; 795227825Stheraven 796232950Stheraven#endif // __has_feature(is_polymorphic) 797232950Stheraven 798227825Stheraven// has_virtual_destructor 799227825Stheraven 800227825Stheraven#if __has_feature(has_virtual_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 801227825Stheraven 802227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE has_virtual_destructor 803227825Stheraven : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; 804227825Stheraven 805227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 806227825Stheraven 807227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE has_virtual_destructor 808227825Stheraven : public false_type {}; 809227825Stheraven 810227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 811227825Stheraven 812227825Stheraven// alignment_of 813227825Stheraven 814227825Stheraventemplate <class _Tp> struct __alignment_of {_Tp _;}; 815227825Stheraven 816227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE alignment_of 817227825Stheraven : public integral_constant<size_t, __alignof__(__alignment_of<typename remove_all_extents<_Tp>::type>)> {}; 818227825Stheraven 819227825Stheraven// aligned_storage 820227825Stheraven 821227825Stheraventemplate <class _Hp, class _Tp> 822227825Stheravenstruct __type_list 823227825Stheraven{ 824227825Stheraven typedef _Hp _Head; 825227825Stheraven typedef _Tp _Tail; 826227825Stheraven}; 827227825Stheraven 828227825Stheravenstruct __nat 829227825Stheraven{ 830227825Stheraven#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS 831227825Stheraven __nat() = delete; 832227825Stheraven __nat(const __nat&) = delete; 833227825Stheraven __nat& operator=(const __nat&) = delete; 834227825Stheraven ~__nat() = delete; 835227825Stheraven#endif 836227825Stheraven}; 837227825Stheraven 838227825Stheraventemplate <class _Tp> 839227825Stheravenstruct __align_type 840227825Stheraven{ 841227825Stheraven static const size_t value = alignment_of<_Tp>::value; 842227825Stheraven typedef _Tp type; 843227825Stheraven}; 844227825Stheraven 845227825Stheravenstruct __struct_double {long double _;}; 846227825Stheravenstruct __struct_double4 {double _[4];}; 847227825Stheraven 848227825Stheraventypedef 849227825Stheraven __type_list<__align_type<unsigned char>, 850227825Stheraven __type_list<__align_type<unsigned short>, 851227825Stheraven __type_list<__align_type<unsigned int>, 852227825Stheraven __type_list<__align_type<unsigned long>, 853227825Stheraven __type_list<__align_type<unsigned long long>, 854227825Stheraven __type_list<__align_type<double>, 855227825Stheraven __type_list<__align_type<long double>, 856227825Stheraven __type_list<__align_type<__struct_double>, 857227825Stheraven __type_list<__align_type<__struct_double4>, 858227825Stheraven __type_list<__align_type<int*>, 859227825Stheraven __nat 860227825Stheraven > > > > > > > > > > __all_types; 861227825Stheraven 862227825Stheraventemplate <class _TL, size_t _Align> struct __find_pod; 863227825Stheraven 864227825Stheraventemplate <class _Hp, size_t _Align> 865227825Stheravenstruct __find_pod<__type_list<_Hp, __nat>, _Align> 866227825Stheraven{ 867227825Stheraven typedef typename conditional< 868227825Stheraven _Align == _Hp::value, 869227825Stheraven typename _Hp::type, 870227825Stheraven void 871227825Stheraven >::type type; 872227825Stheraven}; 873227825Stheraven 874227825Stheraventemplate <class _Hp, class _Tp, size_t _Align> 875227825Stheravenstruct __find_pod<__type_list<_Hp, _Tp>, _Align> 876227825Stheraven{ 877227825Stheraven typedef typename conditional< 878227825Stheraven _Align == _Hp::value, 879227825Stheraven typename _Hp::type, 880227825Stheraven typename __find_pod<_Tp, _Align>::type 881227825Stheraven >::type type; 882227825Stheraven}; 883227825Stheraven 884227825Stheraventemplate <class _TL, size_t _Len> struct __find_max_align; 885227825Stheraven 886227825Stheraventemplate <class _Hp, size_t _Len> 887227825Stheravenstruct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {}; 888227825Stheraven 889227825Stheraventemplate <size_t _Len, size_t _A1, size_t _A2> 890227825Stheravenstruct __select_align 891227825Stheraven{ 892227825Stheravenprivate: 893227825Stheraven static const size_t __min = _A2 < _A1 ? _A2 : _A1; 894227825Stheraven static const size_t __max = _A1 < _A2 ? _A2 : _A1; 895227825Stheravenpublic: 896227825Stheraven static const size_t value = _Len < __max ? __min : __max; 897227825Stheraven}; 898227825Stheraven 899227825Stheraventemplate <class _Hp, class _Tp, size_t _Len> 900227825Stheravenstruct __find_max_align<__type_list<_Hp, _Tp>, _Len> 901227825Stheraven : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {}; 902227825Stheraven 903227825Stheraventemplate <size_t _Len, const size_t _Align = __find_max_align<__all_types, _Len>::value> 904227825Stheravenstruct _LIBCPP_VISIBLE aligned_storage 905227825Stheraven{ 906227825Stheraven typedef typename __find_pod<__all_types, _Align>::type _Aligner; 907227825Stheraven static_assert(!is_void<_Aligner>::value, ""); 908227825Stheraven union type 909227825Stheraven { 910227825Stheraven _Aligner __align; 911227825Stheraven unsigned char __data[_Len]; 912227825Stheraven }; 913227825Stheraven}; 914227825Stheraven 915227825Stheraven#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ 916227825Stheraventemplate <size_t _Len>\ 917227825Stheravenstruct _LIBCPP_VISIBLE aligned_storage<_Len, n>\ 918227825Stheraven{\ 919227825Stheraven struct _ALIGNAS(n) type\ 920227825Stheraven {\ 921227825Stheraven unsigned char _[_Len];\ 922227825Stheraven };\ 923227825Stheraven} 924227825Stheraven 925227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1); 926227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2); 927227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4); 928227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8); 929227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10); 930227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20); 931227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40); 932227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80); 933227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100); 934227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200); 935227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400); 936227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800); 937227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000); 938227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000); 939227825Stheraven// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000) 940227825Stheraven#if !defined(_MSC_VER) 941227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); 942227825Stheraven#endif // !_MSC_VER 943227825Stheraven 944227825Stheraven#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION 945227825Stheraven 946227825Stheraven// __promote 947227825Stheraven 948227825Stheraventemplate <class _A1, class _A2 = void, class _A3 = void, 949227825Stheraven bool = (is_arithmetic<_A1>::value || is_void<_A1>::value) && 950227825Stheraven (is_arithmetic<_A2>::value || is_void<_A2>::value) && 951227825Stheraven (is_arithmetic<_A3>::value || is_void<_A3>::value)> 952227825Stheravenclass __promote {}; 953227825Stheraven 954227825Stheraventemplate <class _A1, class _A2, class _A3> 955227825Stheravenclass __promote<_A1, _A2, _A3, true> 956227825Stheraven{ 957227825Stheravenprivate: 958227825Stheraven typedef typename __promote<_A1>::type __type1; 959227825Stheraven typedef typename __promote<_A2>::type __type2; 960227825Stheraven typedef typename __promote<_A3>::type __type3; 961227825Stheravenpublic: 962227825Stheraven typedef decltype(__type1() + __type2() + __type3()) type; 963227825Stheraven}; 964227825Stheraven 965227825Stheraventemplate <class _A1, class _A2> 966227825Stheravenclass __promote<_A1, _A2, void, true> 967227825Stheraven{ 968227825Stheravenprivate: 969227825Stheraven typedef typename __promote<_A1>::type __type1; 970227825Stheraven typedef typename __promote<_A2>::type __type2; 971227825Stheravenpublic: 972227825Stheraven typedef decltype(__type1() + __type2()) type; 973227825Stheraven}; 974227825Stheraven 975227825Stheraventemplate <class _A1> 976227825Stheravenclass __promote<_A1, void, void, true> 977227825Stheraven{ 978227825Stheravenpublic: 979227825Stheraven typedef typename conditional<is_arithmetic<_A1>::value, 980227825Stheraven typename conditional<is_integral<_A1>::value, double, _A1>::type, 981227825Stheraven void 982227825Stheraven >::type type; 983227825Stheraven}; 984227825Stheraven 985227825Stheraven#ifdef _LIBCPP_STORE_AS_OPTIMIZATION 986227825Stheraven 987227825Stheraven// __transform 988227825Stheraven 989227825Stheraventemplate <class _Tp, size_t = sizeof(_Tp), bool = is_scalar<_Tp>::value> struct __transform {typedef _Tp type;}; 990227825Stheraventemplate <class _Tp> struct __transform<_Tp, 1, true> {typedef unsigned char type;}; 991227825Stheraventemplate <class _Tp> struct __transform<_Tp, 2, true> {typedef unsigned short type;}; 992227825Stheraventemplate <class _Tp> struct __transform<_Tp, 4, true> {typedef unsigned int type;}; 993227825Stheraventemplate <class _Tp> struct __transform<_Tp, 8, true> {typedef unsigned long long type;}; 994227825Stheraven 995227825Stheraven#endif // _LIBCPP_STORE_AS_OPTIMIZATION 996227825Stheraven 997227825Stheraven// make_signed / make_unsigned 998227825Stheraven 999227825Stheraventypedef 1000227825Stheraven __type_list<signed char, 1001227825Stheraven __type_list<signed short, 1002227825Stheraven __type_list<signed int, 1003227825Stheraven __type_list<signed long, 1004227825Stheraven __type_list<signed long long, 1005227825Stheraven __nat 1006227825Stheraven > > > > > __signed_types; 1007227825Stheraven 1008227825Stheraventypedef 1009227825Stheraven __type_list<unsigned char, 1010227825Stheraven __type_list<unsigned short, 1011227825Stheraven __type_list<unsigned int, 1012227825Stheraven __type_list<unsigned long, 1013227825Stheraven __type_list<unsigned long long, 1014227825Stheraven __nat 1015227825Stheraven > > > > > __unsigned_types; 1016227825Stheraven 1017227825Stheraventemplate <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first; 1018227825Stheraven 1019227825Stheraventemplate <class _Hp, class _Tp, size_t _Size> 1020227825Stheravenstruct __find_first<__type_list<_Hp, _Tp>, _Size, true> 1021227825Stheraven{ 1022227825Stheraven typedef _Hp type; 1023227825Stheraven}; 1024227825Stheraven 1025227825Stheraventemplate <class _Hp, class _Tp, size_t _Size> 1026227825Stheravenstruct __find_first<__type_list<_Hp, _Tp>, _Size, false> 1027227825Stheraven{ 1028227825Stheraven typedef typename __find_first<_Tp, _Size>::type type; 1029227825Stheraven}; 1030227825Stheraven 1031227825Stheraventemplate <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, 1032227825Stheraven bool = is_volatile<typename remove_reference<_Tp>::type>::value> 1033227825Stheravenstruct __apply_cv 1034227825Stheraven{ 1035227825Stheraven typedef _Up type; 1036227825Stheraven}; 1037227825Stheraven 1038227825Stheraventemplate <class _Tp, class _Up> 1039227825Stheravenstruct __apply_cv<_Tp, _Up, true, false> 1040227825Stheraven{ 1041227825Stheraven typedef const _Up type; 1042227825Stheraven}; 1043227825Stheraven 1044227825Stheraventemplate <class _Tp, class _Up> 1045227825Stheravenstruct __apply_cv<_Tp, _Up, false, true> 1046227825Stheraven{ 1047227825Stheraven typedef volatile _Up type; 1048227825Stheraven}; 1049227825Stheraven 1050227825Stheraventemplate <class _Tp, class _Up> 1051227825Stheravenstruct __apply_cv<_Tp, _Up, true, true> 1052227825Stheraven{ 1053227825Stheraven typedef const volatile _Up type; 1054227825Stheraven}; 1055227825Stheraven 1056227825Stheraventemplate <class _Tp, class _Up> 1057227825Stheravenstruct __apply_cv<_Tp&, _Up, false, false> 1058227825Stheraven{ 1059227825Stheraven typedef _Up& type; 1060227825Stheraven}; 1061227825Stheraven 1062227825Stheraventemplate <class _Tp, class _Up> 1063227825Stheravenstruct __apply_cv<_Tp&, _Up, true, false> 1064227825Stheraven{ 1065227825Stheraven typedef const _Up& type; 1066227825Stheraven}; 1067227825Stheraven 1068227825Stheraventemplate <class _Tp, class _Up> 1069227825Stheravenstruct __apply_cv<_Tp&, _Up, false, true> 1070227825Stheraven{ 1071227825Stheraven typedef volatile _Up& type; 1072227825Stheraven}; 1073227825Stheraven 1074227825Stheraventemplate <class _Tp, class _Up> 1075227825Stheravenstruct __apply_cv<_Tp&, _Up, true, true> 1076227825Stheraven{ 1077227825Stheraven typedef const volatile _Up& type; 1078227825Stheraven}; 1079227825Stheraven 1080227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1081227825Stheravenstruct __make_signed {}; 1082227825Stheraven 1083227825Stheraventemplate <class _Tp> 1084227825Stheravenstruct __make_signed<_Tp, true> 1085227825Stheraven{ 1086227825Stheraven typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type; 1087227825Stheraven}; 1088227825Stheraven 1089227825Stheraventemplate <> struct __make_signed<bool, true> {}; 1090227825Stheraventemplate <> struct __make_signed< signed short, true> {typedef short type;}; 1091227825Stheraventemplate <> struct __make_signed<unsigned short, true> {typedef short type;}; 1092227825Stheraventemplate <> struct __make_signed< signed int, true> {typedef int type;}; 1093227825Stheraventemplate <> struct __make_signed<unsigned int, true> {typedef int type;}; 1094227825Stheraventemplate <> struct __make_signed< signed long, true> {typedef long type;}; 1095227825Stheraventemplate <> struct __make_signed<unsigned long, true> {typedef long type;}; 1096227825Stheraventemplate <> struct __make_signed< signed long long, true> {typedef long long type;}; 1097227825Stheraventemplate <> struct __make_signed<unsigned long long, true> {typedef long long type;}; 1098227825Stheraven 1099227825Stheraventemplate <class _Tp> 1100227825Stheravenstruct _LIBCPP_VISIBLE make_signed 1101227825Stheraven{ 1102227825Stheraven typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type; 1103227825Stheraven}; 1104227825Stheraven 1105227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1106227825Stheravenstruct __make_unsigned {}; 1107227825Stheraven 1108227825Stheraventemplate <class _Tp> 1109227825Stheravenstruct __make_unsigned<_Tp, true> 1110227825Stheraven{ 1111227825Stheraven typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type; 1112227825Stheraven}; 1113227825Stheraven 1114227825Stheraventemplate <> struct __make_unsigned<bool, true> {}; 1115227825Stheraventemplate <> struct __make_unsigned< signed short, true> {typedef unsigned short type;}; 1116227825Stheraventemplate <> struct __make_unsigned<unsigned short, true> {typedef unsigned short type;}; 1117227825Stheraventemplate <> struct __make_unsigned< signed int, true> {typedef unsigned int type;}; 1118227825Stheraventemplate <> struct __make_unsigned<unsigned int, true> {typedef unsigned int type;}; 1119227825Stheraventemplate <> struct __make_unsigned< signed long, true> {typedef unsigned long type;}; 1120227825Stheraventemplate <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;}; 1121227825Stheraventemplate <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;}; 1122227825Stheraventemplate <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;}; 1123227825Stheraven 1124227825Stheraventemplate <class _Tp> 1125227825Stheravenstruct _LIBCPP_VISIBLE make_unsigned 1126227825Stheraven{ 1127227825Stheraven typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type; 1128227825Stheraven}; 1129227825Stheraven 1130227825Stheraven#ifdef _LIBCPP_HAS_NO_VARIADICS 1131227825Stheraven 1132227825Stheraventemplate <class _Tp, class _Up = void, class V = void> 1133227825Stheravenstruct _LIBCPP_VISIBLE common_type 1134227825Stheraven{ 1135227825Stheravenpublic: 1136227825Stheraven typedef typename common_type<typename common_type<_Tp, _Up>::type, V>::type type; 1137227825Stheraven}; 1138227825Stheraven 1139227825Stheraventemplate <class _Tp> 1140227825Stheravenstruct _LIBCPP_VISIBLE common_type<_Tp, void, void> 1141227825Stheraven{ 1142227825Stheravenpublic: 1143227825Stheraven typedef _Tp type; 1144227825Stheraven}; 1145227825Stheraven 1146227825Stheraventemplate <class _Tp, class _Up> 1147227825Stheravenstruct _LIBCPP_VISIBLE common_type<_Tp, _Up, void> 1148227825Stheraven{ 1149227825Stheravenprivate: 1150227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1151227825Stheraven static _Tp&& __t(); 1152227825Stheraven static _Up&& __u(); 1153227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1154227825Stheraven static _Tp __t(); 1155227825Stheraven static _Up __u(); 1156227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1157227825Stheravenpublic: 1158232950Stheraven typedef typename remove_reference<decltype(true ? __t() : __u())>::type type; 1159227825Stheraven}; 1160227825Stheraven 1161227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1162227825Stheraven 1163227825Stheraventemplate <class ..._Tp> struct common_type; 1164227825Stheraven 1165227825Stheraventemplate <class _Tp> 1166227825Stheravenstruct _LIBCPP_VISIBLE common_type<_Tp> 1167227825Stheraven{ 1168227825Stheraven typedef _Tp type; 1169227825Stheraven}; 1170227825Stheraven 1171227825Stheraventemplate <class _Tp, class _Up> 1172227825Stheravenstruct _LIBCPP_VISIBLE common_type<_Tp, _Up> 1173227825Stheraven{ 1174227825Stheravenprivate: 1175227825Stheraven static _Tp&& __t(); 1176227825Stheraven static _Up&& __u(); 1177227825Stheraven static bool __f(); 1178227825Stheravenpublic: 1179232950Stheraven typedef typename remove_reference<decltype(__f() ? __t() : __u())>::type type; 1180227825Stheraven}; 1181227825Stheraven 1182227825Stheraventemplate <class _Tp, class _Up, class ..._Vp> 1183227825Stheravenstruct _LIBCPP_VISIBLE common_type<_Tp, _Up, _Vp...> 1184227825Stheraven{ 1185227825Stheraven typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type; 1186227825Stheraven}; 1187227825Stheraven 1188227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 1189227825Stheraven 1190227825Stheraven// is_assignable 1191227825Stheraven 1192227825Stheraventemplate <class _Tp, class _Arg> 1193227825Stheravendecltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>(), true_type())) 1194227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1195227825Stheraven__is_assignable_test(_Tp&&, _Arg&&); 1196227825Stheraven#else 1197227825Stheraven__is_assignable_test(_Tp, _Arg&); 1198227825Stheraven#endif 1199227825Stheraven 1200227825Stheraventemplate <class _Arg> 1201227825Stheravenfalse_type 1202227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1203227825Stheraven__is_assignable_test(__any, _Arg&&); 1204227825Stheraven#else 1205227825Stheraven__is_assignable_test(__any, _Arg&); 1206227825Stheraven#endif 1207227825Stheraven 1208227825Stheraventemplate <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value> 1209227825Stheravenstruct __is_assignable_imp 1210227825Stheraven : public common_type 1211227825Stheraven < 1212227825Stheraven decltype(__is_assignable_test(declval<_Tp>(), declval<_Arg>())) 1213227825Stheraven >::type {}; 1214227825Stheraven 1215227825Stheraventemplate <class _Tp, class _Arg> 1216227825Stheravenstruct __is_assignable_imp<_Tp, _Arg, true> 1217227825Stheraven : public false_type 1218227825Stheraven{ 1219227825Stheraven}; 1220227825Stheraven 1221227825Stheraventemplate <class _Tp, class _Arg> 1222227825Stheravenstruct is_assignable 1223227825Stheraven : public __is_assignable_imp<_Tp, _Arg> {}; 1224227825Stheraven 1225227825Stheraven// is_copy_assignable 1226227825Stheraven 1227227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_copy_assignable 1228227825Stheraven : public is_assignable<typename add_lvalue_reference<_Tp>::type, 1229227825Stheraven const typename add_lvalue_reference<_Tp>::type> {}; 1230227825Stheraven 1231227825Stheraven// is_move_assignable 1232227825Stheraven 1233227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_move_assignable 1234227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1235227825Stheraven : public is_assignable<typename add_lvalue_reference<_Tp>::type, 1236227825Stheraven const typename add_rvalue_reference<_Tp>::type> {}; 1237227825Stheraven#else 1238227825Stheraven : public is_copy_assignable<_Tp> {}; 1239227825Stheraven#endif 1240227825Stheraven 1241227825Stheraven// is_destructible 1242227825Stheraven 1243227825Stheraventemplate <class _Tp> 1244227825Stheravenstruct __destructible_test 1245227825Stheraven{ 1246227825Stheraven _Tp __t; 1247227825Stheraven}; 1248227825Stheraven 1249227825Stheraventemplate <class _Tp> 1250227825Stheravendecltype((_VSTD::declval<__destructible_test<_Tp> >().~__destructible_test<_Tp>(), true_type())) 1251227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1252227825Stheraven__is_destructible_test(_Tp&&); 1253227825Stheraven#else 1254227825Stheraven__is_destructible_test(_Tp&); 1255227825Stheraven#endif 1256227825Stheraven 1257227825Stheravenfalse_type 1258227825Stheraven__is_destructible_test(__any); 1259227825Stheraven 1260227825Stheraventemplate <class _Tp, bool = is_void<_Tp>::value || is_abstract<_Tp>::value> 1261227825Stheravenstruct __destructible_imp 1262227825Stheraven : public common_type 1263227825Stheraven < 1264227825Stheraven decltype(__is_destructible_test(declval<_Tp>())) 1265227825Stheraven >::type {}; 1266227825Stheraven 1267227825Stheraventemplate <class _Tp> 1268227825Stheravenstruct __destructible_imp<_Tp, true> 1269227825Stheraven : public false_type {}; 1270227825Stheraven 1271227825Stheraventemplate <class _Tp> 1272227825Stheravenstruct is_destructible 1273227825Stheraven : public __destructible_imp<_Tp> {}; 1274227825Stheraven 1275227825Stheraven// move 1276227825Stheraven 1277227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1278227825Stheraven 1279227825Stheraventemplate <class _Tp> 1280227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1281227825Stheraventypename remove_reference<_Tp>::type&& 1282227825Stheravenmove(_Tp&& __t) _NOEXCEPT 1283227825Stheraven{ 1284227825Stheraven typedef typename remove_reference<_Tp>::type _Up; 1285227825Stheraven return static_cast<_Up&&>(__t); 1286227825Stheraven} 1287227825Stheraven 1288227825Stheraventemplate <class _Tp> 1289227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1290227825Stheraven_Tp&& 1291227825Stheravenforward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT 1292227825Stheraven{ 1293227825Stheraven return static_cast<_Tp&&>(__t); 1294227825Stheraven} 1295227825Stheraven 1296227825Stheraventemplate <class _Tp> 1297227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1298227825Stheraven_Tp&& 1299227825Stheravenforward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT 1300227825Stheraven{ 1301227825Stheraven static_assert(!std::is_lvalue_reference<_Tp>::value, 1302227825Stheraven "Can not forward an rvalue as an lvalue."); 1303227825Stheraven return static_cast<_Tp&&>(__t); 1304227825Stheraven} 1305227825Stheraven 1306227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1307227825Stheraven 1308227825Stheraventemplate <class _Tp> 1309227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1310234976Stheraven_Tp& 1311227825Stheravenmove(_Tp& __t) 1312227825Stheraven{ 1313227825Stheraven return __t; 1314227825Stheraven} 1315227825Stheraven 1316227825Stheraventemplate <class _Tp> 1317227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1318234976Stheravenconst _Tp& 1319232950Stheravenmove(const _Tp& __t) 1320232950Stheraven{ 1321232950Stheraven return __t; 1322232950Stheraven} 1323232950Stheraven 1324232950Stheraventemplate <class _Tp> 1325232950Stheraveninline _LIBCPP_INLINE_VISIBILITY 1326234976Stheraven_Tp& 1327234976Stheravenforward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT 1328227825Stheraven{ 1329227825Stheraven return __t; 1330227825Stheraven} 1331227825Stheraven 1332227825Stheraven 1333234976Stheraventemplate <class _Tp> 1334234976Stheravenclass __rv 1335227825Stheraven{ 1336234976Stheraven typedef typename remove_reference<_Tp>::type _Trr; 1337234976Stheraven _Trr& t_; 1338234976Stheravenpublic: 1339234976Stheraven _LIBCPP_INLINE_VISIBILITY 1340234976Stheraven _Trr* operator->() {return &t_;} 1341234976Stheraven _LIBCPP_INLINE_VISIBILITY 1342234976Stheraven explicit __rv(_Trr& __t) : t_(__t) {} 1343234976Stheraven}; 1344227825Stheraven 1345227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1346227825Stheraven 1347227825Stheraventemplate <class _Tp> 1348227825Stheravenstruct _LIBCPP_VISIBLE decay 1349227825Stheraven{ 1350227825Stheravenprivate: 1351227825Stheraven typedef typename remove_reference<_Tp>::type _Up; 1352227825Stheravenpublic: 1353227825Stheraven typedef typename conditional 1354227825Stheraven < 1355227825Stheraven is_array<_Up>::value, 1356227825Stheraven typename remove_extent<_Up>::type*, 1357227825Stheraven typename conditional 1358227825Stheraven < 1359227825Stheraven is_function<_Up>::value, 1360227825Stheraven typename add_pointer<_Up>::type, 1361227825Stheraven typename remove_cv<_Up>::type 1362227825Stheraven >::type 1363227825Stheraven >::type type; 1364227825Stheraven}; 1365227825Stheraven 1366227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1367227825Stheraven 1368227825Stheraventemplate <class _Tp> 1369227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1370227825Stheraventypename decay<_Tp>::type 1371227825Stheraven__decay_copy(_Tp&& __t) 1372227825Stheraven{ 1373227825Stheraven return _VSTD::forward<_Tp>(__t); 1374227825Stheraven} 1375227825Stheraven 1376227825Stheraven#else 1377227825Stheraven 1378227825Stheraventemplate <class _Tp> 1379227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1380227825Stheraventypename decay<_Tp>::type 1381227825Stheraven__decay_copy(const _Tp& __t) 1382227825Stheraven{ 1383227825Stheraven return _VSTD::forward<_Tp>(__t); 1384227825Stheraven} 1385227825Stheraven 1386227825Stheraven#endif 1387227825Stheraven 1388227825Stheraventemplate <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr> 1389227825Stheravenstruct __member_pointer_traits_imp 1390227825Stheraven{ 1391227825Stheraven}; 1392227825Stheraven 1393227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 1394227825Stheraven 1395232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1396232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> 1397227825Stheraven{ 1398227825Stheraven typedef _Class _ClassType; 1399232950Stheraven typedef _Rp _ReturnType; 1400227825Stheraven}; 1401227825Stheraven 1402232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1403232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> 1404227825Stheraven{ 1405227825Stheraven typedef _Class const _ClassType; 1406232950Stheraven typedef _Rp _ReturnType; 1407227825Stheraven}; 1408227825Stheraven 1409232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1410232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> 1411227825Stheraven{ 1412227825Stheraven typedef _Class volatile _ClassType; 1413232950Stheraven typedef _Rp _ReturnType; 1414227825Stheraven}; 1415227825Stheraven 1416232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1417232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> 1418227825Stheraven{ 1419227825Stheraven typedef _Class const volatile _ClassType; 1420232950Stheraven typedef _Rp _ReturnType; 1421227825Stheraven}; 1422227825Stheraven 1423227825Stheraven#if __has_feature(cxx_reference_qualified_functions) 1424227825Stheraven 1425232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1426232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> 1427227825Stheraven{ 1428227825Stheraven typedef _Class& _ClassType; 1429232950Stheraven typedef _Rp _ReturnType; 1430227825Stheraven}; 1431227825Stheraven 1432232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1433232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> 1434227825Stheraven{ 1435227825Stheraven typedef _Class const& _ClassType; 1436232950Stheraven typedef _Rp _ReturnType; 1437227825Stheraven}; 1438227825Stheraven 1439232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1440232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> 1441227825Stheraven{ 1442227825Stheraven typedef _Class volatile& _ClassType; 1443232950Stheraven typedef _Rp _ReturnType; 1444227825Stheraven}; 1445227825Stheraven 1446232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1447232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> 1448227825Stheraven{ 1449227825Stheraven typedef _Class const volatile& _ClassType; 1450232950Stheraven typedef _Rp _ReturnType; 1451227825Stheraven}; 1452227825Stheraven 1453232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1454232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> 1455227825Stheraven{ 1456227825Stheraven typedef _Class&& _ClassType; 1457232950Stheraven typedef _Rp _ReturnType; 1458227825Stheraven}; 1459227825Stheraven 1460232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1461232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> 1462227825Stheraven{ 1463227825Stheraven typedef _Class const&& _ClassType; 1464232950Stheraven typedef _Rp _ReturnType; 1465227825Stheraven}; 1466227825Stheraven 1467232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1468232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> 1469227825Stheraven{ 1470227825Stheraven typedef _Class volatile&& _ClassType; 1471232950Stheraven typedef _Rp _ReturnType; 1472227825Stheraven}; 1473227825Stheraven 1474232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1475232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> 1476227825Stheraven{ 1477227825Stheraven typedef _Class const volatile&& _ClassType; 1478232950Stheraven typedef _Rp _ReturnType; 1479227825Stheraven}; 1480227825Stheraven 1481227825Stheraven#endif // __has_feature(cxx_reference_qualified_functions) 1482227825Stheraven 1483227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1484227825Stheraven 1485232950Stheraventemplate <class _Rp, class _Class> 1486232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false> 1487227825Stheraven{ 1488227825Stheraven typedef _Class _ClassType; 1489232950Stheraven typedef _Rp _ReturnType; 1490227825Stheraven}; 1491227825Stheraven 1492232950Stheraventemplate <class _Rp, class _Class, class _P0> 1493232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> 1494227825Stheraven{ 1495227825Stheraven typedef _Class _ClassType; 1496232950Stheraven typedef _Rp _ReturnType; 1497227825Stheraven}; 1498227825Stheraven 1499232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1500232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> 1501227825Stheraven{ 1502227825Stheraven typedef _Class _ClassType; 1503232950Stheraven typedef _Rp _ReturnType; 1504227825Stheraven}; 1505227825Stheraven 1506232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1507232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> 1508227825Stheraven{ 1509227825Stheraven typedef _Class _ClassType; 1510232950Stheraven typedef _Rp _ReturnType; 1511227825Stheraven}; 1512227825Stheraven 1513232950Stheraventemplate <class _Rp, class _Class> 1514232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> 1515227825Stheraven{ 1516227825Stheraven typedef _Class const _ClassType; 1517232950Stheraven typedef _Rp _ReturnType; 1518227825Stheraven}; 1519227825Stheraven 1520232950Stheraventemplate <class _Rp, class _Class, class _P0> 1521232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> 1522227825Stheraven{ 1523227825Stheraven typedef _Class const _ClassType; 1524232950Stheraven typedef _Rp _ReturnType; 1525227825Stheraven}; 1526227825Stheraven 1527232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1528232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> 1529227825Stheraven{ 1530227825Stheraven typedef _Class const _ClassType; 1531232950Stheraven typedef _Rp _ReturnType; 1532227825Stheraven}; 1533227825Stheraven 1534232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1535232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false> 1536227825Stheraven{ 1537227825Stheraven typedef _Class const _ClassType; 1538232950Stheraven typedef _Rp _ReturnType; 1539227825Stheraven}; 1540227825Stheraven 1541232950Stheraventemplate <class _Rp, class _Class> 1542232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> 1543227825Stheraven{ 1544227825Stheraven typedef _Class volatile _ClassType; 1545232950Stheraven typedef _Rp _ReturnType; 1546227825Stheraven}; 1547227825Stheraven 1548232950Stheraventemplate <class _Rp, class _Class, class _P0> 1549232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> 1550227825Stheraven{ 1551227825Stheraven typedef _Class volatile _ClassType; 1552232950Stheraven typedef _Rp _ReturnType; 1553227825Stheraven}; 1554227825Stheraven 1555232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1556232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false> 1557227825Stheraven{ 1558227825Stheraven typedef _Class volatile _ClassType; 1559232950Stheraven typedef _Rp _ReturnType; 1560227825Stheraven}; 1561227825Stheraven 1562232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1563232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false> 1564227825Stheraven{ 1565227825Stheraven typedef _Class volatile _ClassType; 1566232950Stheraven typedef _Rp _ReturnType; 1567227825Stheraven}; 1568227825Stheraven 1569232950Stheraventemplate <class _Rp, class _Class> 1570232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false> 1571227825Stheraven{ 1572227825Stheraven typedef _Class const volatile _ClassType; 1573232950Stheraven typedef _Rp _ReturnType; 1574227825Stheraven}; 1575227825Stheraven 1576232950Stheraventemplate <class _Rp, class _Class, class _P0> 1577232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false> 1578227825Stheraven{ 1579227825Stheraven typedef _Class const volatile _ClassType; 1580232950Stheraven typedef _Rp _ReturnType; 1581227825Stheraven}; 1582227825Stheraven 1583232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1584232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false> 1585227825Stheraven{ 1586227825Stheraven typedef _Class const volatile _ClassType; 1587232950Stheraven typedef _Rp _ReturnType; 1588227825Stheraven}; 1589227825Stheraven 1590232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1591232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false> 1592227825Stheraven{ 1593227825Stheraven typedef _Class const volatile _ClassType; 1594232950Stheraven typedef _Rp _ReturnType; 1595227825Stheraven}; 1596227825Stheraven 1597227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 1598227825Stheraven 1599232950Stheraventemplate <class _Rp, class _Class> 1600232950Stheravenstruct __member_pointer_traits_imp<_Rp _Class::*, false, true> 1601227825Stheraven{ 1602227825Stheraven typedef _Class _ClassType; 1603232950Stheraven typedef _Rp _ReturnType; 1604227825Stheraven}; 1605227825Stheraven 1606227825Stheraventemplate <class _MP> 1607227825Stheravenstruct __member_pointer_traits 1608227825Stheraven : public __member_pointer_traits_imp<_MP, 1609227825Stheraven is_member_function_pointer<_MP>::value, 1610227825Stheraven is_member_object_pointer<_MP>::value> 1611227825Stheraven{ 1612227825Stheraven// typedef ... _ClassType; 1613227825Stheraven// typedef ... _ReturnType; 1614227825Stheraven}; 1615227825Stheraven 1616227825Stheraven// result_of 1617227825Stheraven 1618227825Stheraventemplate <class _Callable> class result_of; 1619227825Stheraven 1620241903Sdim#ifdef _LIBCPP_HAS_NO_VARIADICS 1621241903Sdim 1622227825Stheraventemplate <class _Fn, bool, bool> 1623227825Stheravenclass __result_of 1624227825Stheraven{ 1625227825Stheraven}; 1626227825Stheraven 1627227825Stheraventemplate <class _Fn> 1628227825Stheravenclass __result_of<_Fn(), true, false> 1629227825Stheraven{ 1630227825Stheravenpublic: 1631227825Stheraven typedef decltype(declval<_Fn>()()) type; 1632227825Stheraven}; 1633227825Stheraven 1634227825Stheraventemplate <class _Fn, class _A0> 1635227825Stheravenclass __result_of<_Fn(_A0), true, false> 1636227825Stheraven{ 1637227825Stheravenpublic: 1638227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>())) type; 1639227825Stheraven}; 1640227825Stheraven 1641227825Stheraventemplate <class _Fn, class _A0, class _A1> 1642227825Stheravenclass __result_of<_Fn(_A0, _A1), true, false> 1643227825Stheraven{ 1644227825Stheravenpublic: 1645227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type; 1646227825Stheraven}; 1647227825Stheraven 1648227825Stheraventemplate <class _Fn, class _A0, class _A1, class _A2> 1649227825Stheravenclass __result_of<_Fn(_A0, _A1, _A2), true, false> 1650227825Stheraven{ 1651227825Stheravenpublic: 1652227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type; 1653227825Stheraven}; 1654227825Stheraven 1655227825Stheraventemplate <class _MP, class _Tp, bool _IsMemberFunctionPtr> 1656227825Stheravenstruct __result_of_mp; 1657227825Stheraven 1658227825Stheraven// member function pointer 1659227825Stheraven 1660227825Stheraventemplate <class _MP, class _Tp> 1661227825Stheravenstruct __result_of_mp<_MP, _Tp, true> 1662227825Stheraven : public common_type<typename __member_pointer_traits<_MP>::_ReturnType> 1663227825Stheraven{ 1664227825Stheraven}; 1665227825Stheraven 1666227825Stheraven// member data pointer 1667227825Stheraven 1668227825Stheraventemplate <class _MP, class _Tp, bool> 1669227825Stheravenstruct __result_of_mdp; 1670227825Stheraven 1671232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1672232950Stheravenstruct __result_of_mdp<_Rp _Class::*, _Tp, false> 1673227825Stheraven{ 1674232950Stheraven typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type; 1675227825Stheraven}; 1676227825Stheraven 1677232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1678232950Stheravenstruct __result_of_mdp<_Rp _Class::*, _Tp, true> 1679227825Stheraven{ 1680232950Stheraven typedef typename __apply_cv<_Tp, _Rp>::type& type; 1681227825Stheraven}; 1682227825Stheraven 1683232950Stheraventemplate <class _Rp, class _Class, class _Tp> 1684232950Stheravenstruct __result_of_mp<_Rp _Class::*, _Tp, false> 1685232950Stheraven : public __result_of_mdp<_Rp _Class::*, _Tp, 1686227825Stheraven is_base_of<_Class, typename remove_reference<_Tp>::type>::value> 1687227825Stheraven{ 1688227825Stheraven}; 1689227825Stheraven 1690227825Stheraven 1691227825Stheraven 1692227825Stheraventemplate <class _Fn, class _Tp> 1693227825Stheravenclass __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer 1694227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1695227825Stheraven _Tp, 1696227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1697227825Stheraven{ 1698227825Stheraven}; 1699227825Stheraven 1700227825Stheraventemplate <class _Fn, class _Tp, class _A0> 1701227825Stheravenclass __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer 1702227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1703227825Stheraven _Tp, 1704227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1705227825Stheraven{ 1706227825Stheraven}; 1707227825Stheraven 1708227825Stheraventemplate <class _Fn, class _Tp, class _A0, class _A1> 1709227825Stheravenclass __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer 1710227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1711227825Stheraven _Tp, 1712227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1713227825Stheraven{ 1714227825Stheraven}; 1715227825Stheraven 1716227825Stheraventemplate <class _Fn, class _Tp, class _A0, class _A1, class _A2> 1717227825Stheravenclass __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer 1718227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 1719227825Stheraven _Tp, 1720227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 1721227825Stheraven{ 1722227825Stheraven}; 1723227825Stheraven 1724227825Stheraven// result_of 1725227825Stheraven 1726227825Stheraventemplate <class _Fn> 1727227825Stheravenclass _LIBCPP_VISIBLE result_of<_Fn()> 1728227825Stheraven : public __result_of<_Fn(), 1729227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1730227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1731227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1732227825Stheraven > 1733227825Stheraven{ 1734227825Stheraven}; 1735227825Stheraven 1736227825Stheraventemplate <class _Fn, class _A0> 1737227825Stheravenclass _LIBCPP_VISIBLE result_of<_Fn(_A0)> 1738227825Stheraven : public __result_of<_Fn(_A0), 1739227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1740227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1741227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1742227825Stheraven > 1743227825Stheraven{ 1744227825Stheraven}; 1745227825Stheraven 1746227825Stheraventemplate <class _Fn, class _A0, class _A1> 1747227825Stheravenclass _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1)> 1748227825Stheraven : public __result_of<_Fn(_A0, _A1), 1749227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1750227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1751227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1752227825Stheraven > 1753227825Stheraven{ 1754227825Stheraven}; 1755227825Stheraven 1756227825Stheraventemplate <class _Fn, class _A0, class _A1, class _A2> 1757227825Stheravenclass _LIBCPP_VISIBLE result_of<_Fn(_A0, _A1, _A2)> 1758227825Stheraven : public __result_of<_Fn(_A0, _A1, _A2), 1759227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 1760227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 1761227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 1762227825Stheraven > 1763227825Stheraven{ 1764227825Stheraven}; 1765227825Stheraven 1766227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 1767227825Stheraven 1768227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 1769227825Stheraven 1770227825Stheraven// template <class T, class... Args> struct is_constructible; 1771227825Stheraven 1772227825Stheraven// main is_constructible test 1773227825Stheraven 1774227825Stheraventemplate <class _Tp, class ..._Args> 1775227825Stheravendecltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...)), true_type()) 1776227825Stheraven__is_constructible_test(_Tp&&, _Args&& ...); 1777227825Stheraven 1778227825Stheraventemplate <class ..._Args> 1779227825Stheravenfalse_type 1780227825Stheraven__is_constructible_test(__any, _Args&& ...); 1781227825Stheraven 1782227825Stheraventemplate <bool, class _Tp, class... _Args> 1783227825Stheravenstruct __is_constructible // false, _Tp is not a scalar 1784227825Stheraven : public common_type 1785227825Stheraven < 1786227825Stheraven decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...)) 1787227825Stheraven >::type 1788227825Stheraven {}; 1789227825Stheraven 1790227825Stheraven// function types are not constructible 1791227825Stheraven 1792232950Stheraventemplate <class _Rp, class... _A1, class... _A2> 1793232950Stheravenstruct __is_constructible<false, _Rp(_A1...), _A2...> 1794227825Stheraven : public false_type 1795227825Stheraven {}; 1796227825Stheraven 1797227825Stheraven// handle scalars and reference types 1798227825Stheraven 1799227825Stheraven// Scalars are default constructible, references are not 1800227825Stheraven 1801227825Stheraventemplate <class _Tp> 1802227825Stheravenstruct __is_constructible<true, _Tp> 1803227825Stheraven : public is_scalar<_Tp> 1804227825Stheraven {}; 1805227825Stheraven 1806227825Stheraven// Scalars and references are constructible from one arg if that arg is 1807227825Stheraven// implicitly convertible to the scalar or reference. 1808227825Stheraven 1809227825Stheraventemplate <class _Tp> 1810227825Stheravenstruct __is_constructible_ref 1811227825Stheraven{ 1812227825Stheraven true_type static __(_Tp); 1813227825Stheraven false_type static __(...); 1814227825Stheraven}; 1815227825Stheraven 1816227825Stheraventemplate <class _Tp, class _A0> 1817227825Stheravenstruct __is_constructible<true, _Tp, _A0> 1818227825Stheraven : public common_type 1819227825Stheraven < 1820227825Stheraven decltype(__is_constructible_ref<_Tp>::__(declval<_A0>())) 1821227825Stheraven >::type 1822227825Stheraven {}; 1823227825Stheraven 1824227825Stheraven// Scalars and references are not constructible from multiple args. 1825227825Stheraven 1826227825Stheraventemplate <class _Tp, class _A0, class ..._Args> 1827227825Stheravenstruct __is_constructible<true, _Tp, _A0, _Args...> 1828227825Stheraven : public false_type 1829227825Stheraven {}; 1830227825Stheraven 1831227825Stheraven// Treat scalars and reference types separately 1832227825Stheraven 1833227825Stheraventemplate <bool, class _Tp, class... _Args> 1834227825Stheravenstruct __is_constructible_void_check 1835227825Stheraven : public __is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value, 1836227825Stheraven _Tp, _Args...> 1837227825Stheraven {}; 1838227825Stheraven 1839227825Stheraven// If any of T or Args is void, is_constructible should be false 1840227825Stheraven 1841227825Stheraventemplate <class _Tp, class... _Args> 1842227825Stheravenstruct __is_constructible_void_check<true, _Tp, _Args...> 1843227825Stheraven : public false_type 1844227825Stheraven {}; 1845227825Stheraven 1846227825Stheraventemplate <class ..._Args> struct __contains_void; 1847227825Stheraven 1848227825Stheraventemplate <> struct __contains_void<> : false_type {}; 1849227825Stheraven 1850227825Stheraventemplate <class _A0, class ..._Args> 1851227825Stheravenstruct __contains_void<_A0, _Args...> 1852227825Stheraven{ 1853227825Stheraven static const bool value = is_void<_A0>::value || 1854227825Stheraven __contains_void<_Args...>::value; 1855227825Stheraven}; 1856227825Stheraven 1857227825Stheraven// is_constructible entry point 1858227825Stheraven 1859227825Stheraventemplate <class _Tp, class... _Args> 1860227825Stheravenstruct _LIBCPP_VISIBLE is_constructible 1861227825Stheraven : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value 1862227825Stheraven || is_abstract<_Tp>::value, 1863227825Stheraven _Tp, _Args...> 1864227825Stheraven {}; 1865227825Stheraven 1866227825Stheraven// Array types are default constructible if their element type 1867227825Stheraven// is default constructible 1868227825Stheraven 1869232950Stheraventemplate <class _Ap, size_t _Np> 1870232950Stheravenstruct __is_constructible<false, _Ap[_Np]> 1871232950Stheraven : public is_constructible<typename remove_all_extents<_Ap>::type> 1872227825Stheraven {}; 1873227825Stheraven 1874227825Stheraven// Otherwise array types are not constructible by this syntax 1875227825Stheraven 1876232950Stheraventemplate <class _Ap, size_t _Np, class ..._Args> 1877232950Stheravenstruct __is_constructible<false, _Ap[_Np], _Args...> 1878227825Stheraven : public false_type 1879227825Stheraven {}; 1880227825Stheraven 1881227825Stheraven// Incomplete array types are not constructible 1882227825Stheraven 1883232950Stheraventemplate <class _Ap, class ..._Args> 1884232950Stheravenstruct __is_constructible<false, _Ap[], _Args...> 1885227825Stheraven : public false_type 1886227825Stheraven {}; 1887227825Stheraven 1888227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1889227825Stheraven 1890227825Stheraven// template <class T> struct is_constructible0; 1891227825Stheraven 1892227825Stheraven// main is_constructible0 test 1893227825Stheraven 1894227825Stheraventemplate <class _Tp> 1895227825Stheravendecltype((_Tp(), true_type())) 1896227825Stheraven__is_constructible0_test(_Tp&); 1897227825Stheraven 1898227825Stheravenfalse_type 1899227825Stheraven__is_constructible0_test(__any); 1900227825Stheraven 1901227825Stheraventemplate <class _Tp, class _A0> 1902227825Stheravendecltype((_Tp(_VSTD::declval<_A0>()), true_type())) 1903227825Stheraven__is_constructible1_test(_Tp&, _A0&); 1904227825Stheraven 1905227825Stheraventemplate <class _A0> 1906227825Stheravenfalse_type 1907227825Stheraven__is_constructible1_test(__any, _A0&); 1908227825Stheraven 1909227825Stheraventemplate <class _Tp, class _A0, class _A1> 1910227825Stheravendecltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type())) 1911227825Stheraven__is_constructible2_test(_Tp&, _A0&, _A1&); 1912227825Stheraven 1913227825Stheraventemplate <class _A0, class _A1> 1914227825Stheravenfalse_type 1915227825Stheraven__is_constructible2_test(__any, _A0&, _A1&); 1916227825Stheraven 1917227825Stheraventemplate <bool, class _Tp> 1918227825Stheravenstruct __is_constructible0_imp // false, _Tp is not a scalar 1919227825Stheraven : public common_type 1920227825Stheraven < 1921227825Stheraven decltype(__is_constructible0_test(declval<_Tp&>())) 1922227825Stheraven >::type 1923227825Stheraven {}; 1924227825Stheraven 1925227825Stheraventemplate <bool, class _Tp, class _A0> 1926227825Stheravenstruct __is_constructible1_imp // false, _Tp is not a scalar 1927227825Stheraven : public common_type 1928227825Stheraven < 1929227825Stheraven decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>())) 1930227825Stheraven >::type 1931227825Stheraven {}; 1932227825Stheraven 1933227825Stheraventemplate <bool, class _Tp, class _A0, class _A1> 1934227825Stheravenstruct __is_constructible2_imp // false, _Tp is not a scalar 1935227825Stheraven : public common_type 1936227825Stheraven < 1937227825Stheraven decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>())) 1938227825Stheraven >::type 1939227825Stheraven {}; 1940227825Stheraven 1941227825Stheraven// handle scalars and reference types 1942227825Stheraven 1943227825Stheraven// Scalars are default constructible, references are not 1944227825Stheraven 1945227825Stheraventemplate <class _Tp> 1946227825Stheravenstruct __is_constructible0_imp<true, _Tp> 1947227825Stheraven : public is_scalar<_Tp> 1948227825Stheraven {}; 1949227825Stheraven 1950227825Stheraventemplate <class _Tp, class _A0> 1951227825Stheravenstruct __is_constructible1_imp<true, _Tp, _A0> 1952227825Stheraven : public is_convertible<_A0, _Tp> 1953227825Stheraven {}; 1954227825Stheraven 1955227825Stheraventemplate <class _Tp, class _A0, class _A1> 1956227825Stheravenstruct __is_constructible2_imp<true, _Tp, _A0, _A1> 1957227825Stheraven : public false_type 1958227825Stheraven {}; 1959227825Stheraven 1960227825Stheraven// Treat scalars and reference types separately 1961227825Stheraven 1962227825Stheraventemplate <bool, class _Tp> 1963227825Stheravenstruct __is_constructible0_void_check 1964227825Stheraven : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 1965227825Stheraven _Tp> 1966227825Stheraven {}; 1967227825Stheraven 1968227825Stheraventemplate <bool, class _Tp, class _A0> 1969227825Stheravenstruct __is_constructible1_void_check 1970227825Stheraven : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 1971227825Stheraven _Tp, _A0> 1972227825Stheraven {}; 1973227825Stheraven 1974227825Stheraventemplate <bool, class _Tp, class _A0, class _A1> 1975227825Stheravenstruct __is_constructible2_void_check 1976227825Stheraven : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 1977227825Stheraven _Tp, _A0, _A1> 1978227825Stheraven {}; 1979227825Stheraven 1980227825Stheraven// If any of T or Args is void, is_constructible should be false 1981227825Stheraven 1982227825Stheraventemplate <class _Tp> 1983227825Stheravenstruct __is_constructible0_void_check<true, _Tp> 1984227825Stheraven : public false_type 1985227825Stheraven {}; 1986227825Stheraven 1987227825Stheraventemplate <class _Tp, class _A0> 1988227825Stheravenstruct __is_constructible1_void_check<true, _Tp, _A0> 1989227825Stheraven : public false_type 1990227825Stheraven {}; 1991227825Stheraven 1992227825Stheraventemplate <class _Tp, class _A0, class _A1> 1993227825Stheravenstruct __is_constructible2_void_check<true, _Tp, _A0, _A1> 1994227825Stheraven : public false_type 1995227825Stheraven {}; 1996227825Stheraven 1997227825Stheraven// is_constructible entry point 1998227825Stheraven 1999227825Stheravennamespace __is_construct 2000227825Stheraven{ 2001227825Stheraven 2002227825Stheravenstruct __nat {}; 2003227825Stheraven 2004227825Stheraven} 2005227825Stheraven 2006227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2007227825Stheraven class _A1 = __is_construct::__nat> 2008227825Stheravenstruct _LIBCPP_VISIBLE is_constructible 2009227825Stheraven : public __is_constructible2_void_check<is_void<_Tp>::value 2010227825Stheraven || is_abstract<_Tp>::value 2011227825Stheraven || is_function<_Tp>::value 2012227825Stheraven || is_void<_A0>::value 2013227825Stheraven || is_void<_A1>::value, 2014227825Stheraven _Tp, _A0, _A1> 2015227825Stheraven {}; 2016227825Stheraven 2017227825Stheraventemplate <class _Tp> 2018227825Stheravenstruct _LIBCPP_VISIBLE is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> 2019227825Stheraven : public __is_constructible0_void_check<is_void<_Tp>::value 2020227825Stheraven || is_abstract<_Tp>::value 2021227825Stheraven || is_function<_Tp>::value, 2022227825Stheraven _Tp> 2023227825Stheraven {}; 2024227825Stheraven 2025227825Stheraventemplate <class _Tp, class _A0> 2026227825Stheravenstruct _LIBCPP_VISIBLE is_constructible<_Tp, _A0, __is_construct::__nat> 2027227825Stheraven : public __is_constructible1_void_check<is_void<_Tp>::value 2028227825Stheraven || is_abstract<_Tp>::value 2029227825Stheraven || is_function<_Tp>::value 2030227825Stheraven || is_void<_A0>::value, 2031227825Stheraven _Tp, _A0> 2032227825Stheraven {}; 2033227825Stheraven 2034227825Stheraven// Array types are default constructible if their element type 2035227825Stheraven// is default constructible 2036227825Stheraven 2037232950Stheraventemplate <class _Ap, size_t _Np> 2038232950Stheravenstruct __is_constructible0_imp<false, _Ap[_Np]> 2039232950Stheraven : public is_constructible<typename remove_all_extents<_Ap>::type> 2040227825Stheraven {}; 2041227825Stheraven 2042232950Stheraventemplate <class _Ap, size_t _Np, class _A0> 2043232950Stheravenstruct __is_constructible1_imp<false, _Ap[_Np], _A0> 2044227825Stheraven : public false_type 2045227825Stheraven {}; 2046227825Stheraven 2047232950Stheraventemplate <class _Ap, size_t _Np, class _A0, class _A1> 2048232950Stheravenstruct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1> 2049227825Stheraven : public false_type 2050227825Stheraven {}; 2051227825Stheraven 2052227825Stheraven// Incomplete array types are not constructible 2053227825Stheraven 2054232950Stheraventemplate <class _Ap> 2055232950Stheravenstruct __is_constructible0_imp<false, _Ap[]> 2056227825Stheraven : public false_type 2057227825Stheraven {}; 2058227825Stheraven 2059232950Stheraventemplate <class _Ap, class _A0> 2060232950Stheravenstruct __is_constructible1_imp<false, _Ap[], _A0> 2061227825Stheraven : public false_type 2062227825Stheraven {}; 2063227825Stheraven 2064232950Stheraventemplate <class _Ap, class _A0, class _A1> 2065232950Stheravenstruct __is_constructible2_imp<false, _Ap[], _A0, _A1> 2066227825Stheraven : public false_type 2067227825Stheraven {}; 2068227825Stheraven 2069227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2070227825Stheraven 2071227825Stheraven// is_default_constructible 2072227825Stheraven 2073227825Stheraventemplate <class _Tp> 2074227825Stheravenstruct _LIBCPP_VISIBLE is_default_constructible 2075227825Stheraven : public is_constructible<_Tp> 2076227825Stheraven {}; 2077227825Stheraven 2078227825Stheraven// is_copy_constructible 2079227825Stheraven 2080227825Stheraventemplate <class _Tp> 2081227825Stheravenstruct _LIBCPP_VISIBLE is_copy_constructible 2082227825Stheraven : public is_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> 2083227825Stheraven {}; 2084227825Stheraven 2085227825Stheraven// is_move_constructible 2086227825Stheraven 2087227825Stheraventemplate <class _Tp> 2088227825Stheravenstruct _LIBCPP_VISIBLE is_move_constructible 2089227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2090227825Stheraven : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2091227825Stheraven#else 2092227825Stheraven : public is_copy_constructible<_Tp> 2093227825Stheraven#endif 2094227825Stheraven {}; 2095227825Stheraven 2096227825Stheraven// is_trivially_constructible 2097227825Stheraven 2098227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2099227825Stheraven 2100232950Stheraven#if __has_feature(is_trivially_constructible) 2101232950Stheraven 2102227825Stheraventemplate <class _Tp, class... _Args> 2103227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible 2104232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> 2105232950Stheraven{ 2106232950Stheraven}; 2107232950Stheraven 2108232950Stheraven#else // !__has_feature(is_trivially_constructible) 2109232950Stheraven 2110232950Stheraventemplate <class _Tp, class... _Args> 2111232950Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible 2112227825Stheraven : false_type 2113227825Stheraven{ 2114227825Stheraven}; 2115227825Stheraven 2116227825Stheraventemplate <class _Tp> 2117227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp> 2118227825Stheraven#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2119227825Stheraven : integral_constant<bool, __has_trivial_constructor(_Tp)> 2120227825Stheraven#else 2121227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2122227825Stheraven#endif 2123227825Stheraven{ 2124227825Stheraven}; 2125227825Stheraven 2126227825Stheraventemplate <class _Tp> 2127227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2128227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&&> 2129227825Stheraven#else 2130227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp> 2131227825Stheraven#endif 2132227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2133227825Stheraven{ 2134227825Stheraven}; 2135227825Stheraven 2136227825Stheraventemplate <class _Tp> 2137227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&> 2138227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2139227825Stheraven{ 2140227825Stheraven}; 2141227825Stheraven 2142227825Stheraventemplate <class _Tp> 2143227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&> 2144227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2145227825Stheraven{ 2146227825Stheraven}; 2147227825Stheraven 2148232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2149232950Stheraven 2150227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2151227825Stheraven 2152227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2153227825Stheraven class _A1 = __is_construct::__nat> 2154227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible 2155227825Stheraven : false_type 2156227825Stheraven{ 2157227825Stheraven}; 2158227825Stheraven 2159232950Stheraven#if __has_feature(is_trivially_constructible) 2160232950Stheraven 2161227825Stheraventemplate <class _Tp> 2162227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat, 2163227825Stheraven __is_construct::__nat> 2164232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp)> 2165232950Stheraven{ 2166232950Stheraven}; 2167232950Stheraven 2168232950Stheraventemplate <class _Tp> 2169232950Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp, 2170232950Stheraven __is_construct::__nat> 2171232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)> 2172232950Stheraven{ 2173232950Stheraven}; 2174232950Stheraven 2175232950Stheraventemplate <class _Tp> 2176232950Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&, 2177232950Stheraven __is_construct::__nat> 2178232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)> 2179232950Stheraven{ 2180232950Stheraven}; 2181232950Stheraven 2182232950Stheraventemplate <class _Tp> 2183232950Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&, 2184232950Stheraven __is_construct::__nat> 2185232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)> 2186232950Stheraven{ 2187232950Stheraven}; 2188232950Stheraven 2189232950Stheraven#else // !__has_feature(is_trivially_constructible) 2190232950Stheraven 2191232950Stheraventemplate <class _Tp> 2192232950Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat, 2193232950Stheraven __is_construct::__nat> 2194227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2195227825Stheraven{ 2196227825Stheraven}; 2197227825Stheraven 2198227825Stheraventemplate <class _Tp> 2199227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp, 2200227825Stheraven __is_construct::__nat> 2201227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2202227825Stheraven{ 2203227825Stheraven}; 2204227825Stheraven 2205227825Stheraventemplate <class _Tp> 2206227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&, 2207227825Stheraven __is_construct::__nat> 2208227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2209227825Stheraven{ 2210227825Stheraven}; 2211227825Stheraven 2212227825Stheraventemplate <class _Tp> 2213227825Stheravenstruct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&, 2214227825Stheraven __is_construct::__nat> 2215227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2216227825Stheraven{ 2217227825Stheraven}; 2218227825Stheraven 2219232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2220232950Stheraven 2221227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2222227825Stheraven 2223227825Stheraven// is_trivially_default_constructible 2224227825Stheraven 2225227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_default_constructible 2226227825Stheraven : public is_trivially_constructible<_Tp> 2227227825Stheraven {}; 2228227825Stheraven 2229227825Stheraven// is_trivially_copy_constructible 2230227825Stheraven 2231227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copy_constructible 2232227825Stheraven : public is_trivially_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> 2233227825Stheraven {}; 2234227825Stheraven 2235227825Stheraven// is_trivially_move_constructible 2236227825Stheraven 2237227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_move_constructible 2238227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2239227825Stheraven : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2240227825Stheraven#else 2241227825Stheraven : public is_trivially_copy_constructible<_Tp> 2242227825Stheraven#endif 2243227825Stheraven {}; 2244227825Stheraven 2245227825Stheraven// is_trivially_assignable 2246227825Stheraven 2247232950Stheraven#if __has_feature(is_trivially_constructible) 2248232950Stheraven 2249227825Stheraventemplate <class _Tp, class _Arg> 2250227825Stheravenstruct is_trivially_assignable 2251232950Stheraven : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> 2252232950Stheraven{ 2253232950Stheraven}; 2254232950Stheraven 2255232950Stheraven#else // !__has_feature(is_trivially_constructible) 2256232950Stheraven 2257232950Stheraventemplate <class _Tp, class _Arg> 2258232950Stheravenstruct is_trivially_assignable 2259227825Stheraven : public false_type {}; 2260227825Stheraven 2261227825Stheraventemplate <class _Tp> 2262227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp> 2263227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2264227825Stheraven 2265227825Stheraventemplate <class _Tp> 2266227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp&> 2267227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2268227825Stheraven 2269227825Stheraventemplate <class _Tp> 2270227825Stheravenstruct is_trivially_assignable<_Tp&, const _Tp&> 2271227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2272227825Stheraven 2273227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2274227825Stheraven 2275227825Stheraventemplate <class _Tp> 2276227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp&&> 2277227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2278227825Stheraven 2279227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2280227825Stheraven 2281232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2282232950Stheraven 2283227825Stheraven// is_trivially_copy_assignable 2284227825Stheraven 2285227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copy_assignable 2286227825Stheraven : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2287227825Stheraven const typename add_lvalue_reference<_Tp>::type> 2288227825Stheraven {}; 2289227825Stheraven 2290227825Stheraven// is_trivially_move_assignable 2291227825Stheraven 2292227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_move_assignable 2293227825Stheraven : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2294227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2295227825Stheraven typename add_rvalue_reference<_Tp>::type> 2296227825Stheraven#else 2297227825Stheraven typename add_lvalue_reference<_Tp>::type> 2298227825Stheraven#endif 2299227825Stheraven {}; 2300227825Stheraven 2301227825Stheraven// is_trivially_destructible 2302227825Stheraven 2303227825Stheraven#if __has_feature(has_trivial_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2304227825Stheraven 2305227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_destructible 2306227825Stheraven : public integral_constant<bool, __has_trivial_destructor(_Tp)> {}; 2307227825Stheraven 2308227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 2309227825Stheraven 2310227825Stheraventemplate <class _Tp> struct __libcpp_trivial_destructor 2311227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 2312227825Stheraven is_reference<_Tp>::value> {}; 2313227825Stheraven 2314227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_destructible 2315227825Stheraven : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {}; 2316227825Stheraven 2317227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 2318227825Stheraven 2319227825Stheraven// is_nothrow_constructible 2320227825Stheraven 2321227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2322227825Stheraven 2323227825Stheraven#if __has_feature(cxx_noexcept) 2324227825Stheraven 2325227825Stheraventemplate <bool, class _Tp, class... _Args> struct __is_nothrow_constructible; 2326227825Stheraven 2327227825Stheraventemplate <class _Tp, class... _Args> 2328227825Stheravenstruct __is_nothrow_constructible<true, _Tp, _Args...> 2329227825Stheraven : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> 2330227825Stheraven{ 2331227825Stheraven}; 2332227825Stheraven 2333227825Stheraventemplate <class _Tp, class... _Args> 2334227825Stheravenstruct __is_nothrow_constructible<false, _Tp, _Args...> 2335227825Stheraven : public false_type 2336227825Stheraven{ 2337227825Stheraven}; 2338227825Stheraven 2339227825Stheraventemplate <class _Tp, class... _Args> 2340227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible 2341227825Stheraven : __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...> 2342227825Stheraven{ 2343227825Stheraven}; 2344227825Stheraven 2345227825Stheraventemplate <class _Tp, size_t _Ns> 2346227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp[_Ns]> 2347227825Stheraven : __is_nothrow_constructible<is_constructible<_Tp>::value, _Tp> 2348227825Stheraven{ 2349227825Stheraven}; 2350227825Stheraven 2351227825Stheraven#else // __has_feature(cxx_noexcept) 2352227825Stheraven 2353227825Stheraventemplate <class _Tp, class... _Args> 2354227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible 2355227825Stheraven : false_type 2356227825Stheraven{ 2357227825Stheraven}; 2358227825Stheraven 2359227825Stheraventemplate <class _Tp> 2360227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp> 2361227825Stheraven#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2362227825Stheraven : integral_constant<bool, __has_nothrow_constructor(_Tp)> 2363227825Stheraven#else 2364227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2365227825Stheraven#endif 2366227825Stheraven{ 2367227825Stheraven}; 2368227825Stheraven 2369227825Stheraventemplate <class _Tp> 2370227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2371227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&&> 2372227825Stheraven#else 2373227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp> 2374227825Stheraven#endif 2375227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2376227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2377227825Stheraven#else 2378227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2379227825Stheraven#endif 2380227825Stheraven{ 2381227825Stheraven}; 2382227825Stheraven 2383227825Stheraventemplate <class _Tp> 2384227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&> 2385227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2386227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2387227825Stheraven#else 2388227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2389227825Stheraven#endif 2390227825Stheraven{ 2391227825Stheraven}; 2392227825Stheraven 2393227825Stheraventemplate <class _Tp> 2394227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&> 2395227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2396227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2397227825Stheraven#else 2398227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2399227825Stheraven#endif 2400227825Stheraven{ 2401227825Stheraven}; 2402227825Stheraven 2403227825Stheraven#endif // __has_feature(cxx_noexcept) 2404227825Stheraven 2405227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2406227825Stheraven 2407227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2408227825Stheraven class _A1 = __is_construct::__nat> 2409227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible 2410227825Stheraven : false_type 2411227825Stheraven{ 2412227825Stheraven}; 2413227825Stheraven 2414227825Stheraventemplate <class _Tp> 2415227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, __is_construct::__nat, 2416227825Stheraven __is_construct::__nat> 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> 2426227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp, 2427227825Stheraven __is_construct::__nat> 2428227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2429227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2430227825Stheraven#else 2431227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2432227825Stheraven#endif 2433227825Stheraven{ 2434227825Stheraven}; 2435227825Stheraven 2436227825Stheraventemplate <class _Tp> 2437227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&, 2438227825Stheraven __is_construct::__nat> 2439227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2440227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2441227825Stheraven#else 2442227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2443227825Stheraven#endif 2444227825Stheraven{ 2445227825Stheraven}; 2446227825Stheraven 2447227825Stheraventemplate <class _Tp> 2448227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&, 2449227825Stheraven __is_construct::__nat> 2450227825Stheraven#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2451227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2452227825Stheraven#else 2453227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2454227825Stheraven#endif 2455227825Stheraven{ 2456227825Stheraven}; 2457227825Stheraven 2458227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2459227825Stheraven 2460227825Stheraven// is_nothrow_default_constructible 2461227825Stheraven 2462227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_default_constructible 2463227825Stheraven : public is_nothrow_constructible<_Tp> 2464227825Stheraven {}; 2465227825Stheraven 2466227825Stheraven// is_nothrow_copy_constructible 2467227825Stheraven 2468227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_copy_constructible 2469227825Stheraven : public is_nothrow_constructible<_Tp, const typename add_lvalue_reference<_Tp>::type> 2470227825Stheraven {}; 2471227825Stheraven 2472227825Stheraven// is_nothrow_move_constructible 2473227825Stheraven 2474227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_move_constructible 2475227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2476227825Stheraven : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2477227825Stheraven#else 2478227825Stheraven : public is_nothrow_copy_constructible<_Tp> 2479227825Stheraven#endif 2480227825Stheraven {}; 2481227825Stheraven 2482227825Stheraven// is_nothrow_assignable 2483227825Stheraven 2484227825Stheraven#if __has_feature(cxx_noexcept) 2485227825Stheraven 2486227825Stheraventemplate <bool, class _Tp, class _Arg> struct __is_nothrow_assignable; 2487227825Stheraven 2488227825Stheraventemplate <class _Tp, class _Arg> 2489227825Stheravenstruct __is_nothrow_assignable<false, _Tp, _Arg> 2490227825Stheraven : public false_type 2491227825Stheraven{ 2492227825Stheraven}; 2493227825Stheraven 2494227825Stheraventemplate <class _Tp, class _Arg> 2495227825Stheravenstruct __is_nothrow_assignable<true, _Tp, _Arg> 2496227825Stheraven : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) > 2497227825Stheraven{ 2498227825Stheraven}; 2499227825Stheraven 2500227825Stheraventemplate <class _Tp, class _Arg> 2501227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_assignable 2502227825Stheraven : public __is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg> 2503227825Stheraven{ 2504227825Stheraven}; 2505227825Stheraven 2506227825Stheraven#else // __has_feature(cxx_noexcept) 2507227825Stheraven 2508227825Stheraventemplate <class _Tp, class _Arg> 2509227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_assignable 2510227825Stheraven : public false_type {}; 2511227825Stheraven 2512227825Stheraventemplate <class _Tp> 2513227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp> 2514227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2515227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2516227825Stheraven#else 2517227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2518227825Stheraven#endif 2519227825Stheraven 2520227825Stheraventemplate <class _Tp> 2521227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp&> 2522227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2523227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2524227825Stheraven#else 2525227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2526227825Stheraven#endif 2527227825Stheraven 2528227825Stheraventemplate <class _Tp> 2529227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, const _Tp&> 2530227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2531227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2532227825Stheraven#else 2533227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2534227825Stheraven#endif 2535227825Stheraven 2536227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2537227825Stheraven 2538227825Stheraventemplate <class _Tp> 2539227825Stheravenstruct is_nothrow_assignable<_Tp&, _Tp&&> 2540227825Stheraven#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2541227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 2542227825Stheraven#else 2543227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2544227825Stheraven#endif 2545227825Stheraven 2546227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2547227825Stheraven 2548227825Stheraven#endif // __has_feature(cxx_noexcept) 2549227825Stheraven 2550227825Stheraven// is_nothrow_copy_assignable 2551227825Stheraven 2552227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_copy_assignable 2553227825Stheraven : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 2554227825Stheraven const typename add_lvalue_reference<_Tp>::type> 2555227825Stheraven {}; 2556227825Stheraven 2557227825Stheraven// is_nothrow_move_assignable 2558227825Stheraven 2559227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_move_assignable 2560227825Stheraven : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 2561227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2562227825Stheraven typename add_rvalue_reference<_Tp>::type> 2563227825Stheraven#else 2564227825Stheraven typename add_lvalue_reference<_Tp>::type> 2565227825Stheraven#endif 2566227825Stheraven {}; 2567227825Stheraven 2568227825Stheraven// is_nothrow_destructible 2569227825Stheraven 2570227825Stheraven#if __has_feature(cxx_noexcept) 2571227825Stheraven 2572227825Stheraventemplate <bool, class _Tp> struct __is_nothrow_destructible; 2573227825Stheraven 2574227825Stheraventemplate <class _Tp> 2575227825Stheravenstruct __is_nothrow_destructible<false, _Tp> 2576227825Stheraven : public false_type 2577227825Stheraven{ 2578227825Stheraven}; 2579227825Stheraven 2580227825Stheraventemplate <class _Tp> 2581227825Stheravenstruct __is_nothrow_destructible<true, _Tp> 2582227825Stheraven : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) > 2583227825Stheraven{ 2584227825Stheraven}; 2585227825Stheraven 2586227825Stheraventemplate <class _Tp> 2587227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_destructible 2588227825Stheraven : public __is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> 2589227825Stheraven{ 2590227825Stheraven}; 2591227825Stheraven 2592227825Stheraventemplate <class _Tp, size_t _Ns> 2593227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp[_Ns]> 2594227825Stheraven : public is_nothrow_destructible<_Tp> 2595227825Stheraven{ 2596227825Stheraven}; 2597227825Stheraven 2598227825Stheraventemplate <class _Tp> 2599227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp&> 2600227825Stheraven : public true_type 2601227825Stheraven{ 2602227825Stheraven}; 2603227825Stheraven 2604227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2605227825Stheraven 2606227825Stheraventemplate <class _Tp> 2607227825Stheravenstruct _LIBCPP_VISIBLE is_nothrow_destructible<_Tp&&> 2608227825Stheraven : public true_type 2609227825Stheraven{ 2610227825Stheraven}; 2611227825Stheraven 2612227825Stheraven#endif 2613227825Stheraven 2614227825Stheraven#else 2615227825Stheraven 2616227825Stheraventemplate <class _Tp> struct __libcpp_nothrow_destructor 2617227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 2618227825Stheraven is_reference<_Tp>::value> {}; 2619227825Stheraven 2620227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_nothrow_destructible 2621227825Stheraven : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {}; 2622227825Stheraven 2623227825Stheraven#endif 2624227825Stheraven 2625227825Stheraven// is_pod 2626227825Stheraven 2627227825Stheraven#if __has_feature(is_pod) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) 2628227825Stheraven 2629227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_pod 2630227825Stheraven : public integral_constant<bool, __is_pod(_Tp)> {}; 2631227825Stheraven 2632227825Stheraven#else // _LIBCPP_HAS_TYPE_TRAITS 2633227825Stheraven 2634227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_pod 2635227825Stheraven : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value && 2636227825Stheraven is_trivially_copy_constructible<_Tp>::value && 2637227825Stheraven is_trivially_copy_assignable<_Tp>::value && 2638227825Stheraven is_trivially_destructible<_Tp>::value> {}; 2639227825Stheraven 2640227825Stheraven#endif // _LIBCPP_HAS_TYPE_TRAITS 2641227825Stheraven 2642227825Stheraven// is_literal_type; 2643227825Stheraven 2644227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_literal_type 2645227825Stheraven#if __has_feature(is_literal) 2646227825Stheraven : public integral_constant<bool, __is_literal(_Tp)> 2647227825Stheraven#else 2648227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value || 2649227825Stheraven is_reference<typename remove_all_extents<_Tp>::type>::value> 2650227825Stheraven#endif 2651227825Stheraven {}; 2652227825Stheraven 2653227825Stheraven// is_standard_layout; 2654227825Stheraven 2655227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_standard_layout 2656227825Stheraven#if __has_feature(is_standard_layout) 2657227825Stheraven : public integral_constant<bool, __is_standard_layout(_Tp)> 2658227825Stheraven#else 2659227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 2660227825Stheraven#endif 2661227825Stheraven {}; 2662227825Stheraven 2663227825Stheraven// is_trivially_copyable; 2664227825Stheraven 2665227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copyable 2666227825Stheraven#if __has_feature(is_trivially_copyable) 2667227825Stheraven : public integral_constant<bool, __is_trivially_copyable(_Tp)> 2668227825Stheraven#else 2669227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 2670227825Stheraven#endif 2671227825Stheraven {}; 2672227825Stheraven 2673227825Stheraven// is_trivial; 2674227825Stheraven 2675227825Stheraventemplate <class _Tp> struct _LIBCPP_VISIBLE is_trivial 2676227825Stheraven#if __has_feature(is_trivial) 2677227825Stheraven : public integral_constant<bool, __is_trivial(_Tp)> 2678227825Stheraven#else 2679227825Stheraven : integral_constant<bool, is_trivially_copyable<_Tp>::value && 2680227825Stheraven is_trivially_default_constructible<_Tp>::value> 2681227825Stheraven#endif 2682227825Stheraven {}; 2683227825Stheraven 2684227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2685227825Stheraven 2686227825Stheraven// Check for complete types 2687227825Stheraven 2688232950Stheraventemplate <class ..._Tp> struct __check_complete; 2689227825Stheraven 2690227825Stheraventemplate <> 2691227825Stheravenstruct __check_complete<> 2692227825Stheraven{ 2693227825Stheraven}; 2694227825Stheraven 2695232950Stheraventemplate <class _Hp, class _T0, class ..._Tp> 2696232950Stheravenstruct __check_complete<_Hp, _T0, _Tp...> 2697232950Stheraven : private __check_complete<_Hp>, 2698232950Stheraven private __check_complete<_T0, _Tp...> 2699227825Stheraven{ 2700227825Stheraven}; 2701227825Stheraven 2702232950Stheraventemplate <class _Hp> 2703232950Stheravenstruct __check_complete<_Hp, _Hp> 2704232950Stheraven : private __check_complete<_Hp> 2705227825Stheraven{ 2706227825Stheraven}; 2707227825Stheraven 2708232950Stheraventemplate <class _Tp> 2709232950Stheravenstruct __check_complete<_Tp> 2710227825Stheraven{ 2711232950Stheraven static_assert(sizeof(_Tp) > 0, "Type must be complete."); 2712227825Stheraven}; 2713227825Stheraven 2714232950Stheraventemplate <class _Tp> 2715232950Stheravenstruct __check_complete<_Tp&> 2716232950Stheraven : private __check_complete<_Tp> 2717227825Stheraven{ 2718227825Stheraven}; 2719227825Stheraven 2720232950Stheraventemplate <class _Tp> 2721232950Stheravenstruct __check_complete<_Tp&&> 2722232950Stheraven : private __check_complete<_Tp> 2723227825Stheraven{ 2724227825Stheraven}; 2725227825Stheraven 2726232950Stheraventemplate <class _Rp, class ..._Param> 2727232950Stheravenstruct __check_complete<_Rp (*)(_Param...)> 2728241903Sdim : private __check_complete<_Rp> 2729227825Stheraven{ 2730227825Stheraven}; 2731227825Stheraven 2732232950Stheraventemplate <class _Rp, class ..._Param> 2733232950Stheravenstruct __check_complete<_Rp (_Param...)> 2734241903Sdim : private __check_complete<_Rp> 2735227825Stheraven{ 2736227825Stheraven}; 2737227825Stheraven 2738232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2739232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...)> 2740241903Sdim : private __check_complete<_Class> 2741227825Stheraven{ 2742227825Stheraven}; 2743227825Stheraven 2744232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2745232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const> 2746241903Sdim : private __check_complete<_Class> 2747227825Stheraven{ 2748227825Stheraven}; 2749227825Stheraven 2750232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2751232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile> 2752241903Sdim : private __check_complete<_Class> 2753227825Stheraven{ 2754227825Stheraven}; 2755227825Stheraven 2756232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2757232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile> 2758241903Sdim : private __check_complete<_Class> 2759227825Stheraven{ 2760227825Stheraven}; 2761227825Stheraven 2762227825Stheraven#if __has_feature(cxx_reference_qualified_functions) 2763227825Stheraven 2764232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2765232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) &> 2766241903Sdim : private __check_complete<_Class> 2767227825Stheraven{ 2768227825Stheraven}; 2769227825Stheraven 2770232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2771232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const&> 2772241903Sdim : private __check_complete<_Class> 2773227825Stheraven{ 2774227825Stheraven}; 2775227825Stheraven 2776232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2777232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile&> 2778241903Sdim : private __check_complete<_Class> 2779227825Stheraven{ 2780227825Stheraven}; 2781227825Stheraven 2782232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2783232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> 2784241903Sdim : private __check_complete<_Class> 2785227825Stheraven{ 2786227825Stheraven}; 2787227825Stheraven 2788232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2789232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) &&> 2790241903Sdim : private __check_complete<_Class> 2791227825Stheraven{ 2792227825Stheraven}; 2793227825Stheraven 2794232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2795232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const&&> 2796241903Sdim : private __check_complete<_Class> 2797227825Stheraven{ 2798227825Stheraven}; 2799227825Stheraven 2800232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2801232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> 2802241903Sdim : private __check_complete<_Class> 2803227825Stheraven{ 2804227825Stheraven}; 2805227825Stheraven 2806232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 2807232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> 2808241903Sdim : private __check_complete<_Class> 2809227825Stheraven{ 2810227825Stheraven}; 2811227825Stheraven 2812227825Stheraven#endif 2813227825Stheraven 2814232950Stheraventemplate <class _Rp, class _Class> 2815232950Stheravenstruct __check_complete<_Rp _Class::*> 2816227825Stheraven : private __check_complete<_Class> 2817227825Stheraven{ 2818227825Stheraven}; 2819227825Stheraven 2820227825Stheraven// __invoke forward declarations 2821227825Stheraven 2822227825Stheraven// fall back - none of the bullets 2823227825Stheraven 2824227825Stheraventemplate <class ..._Args> 2825227825Stheravenauto 2826227825Stheraven__invoke(__any, _Args&& ...__args) 2827227825Stheraven -> __nat; 2828227825Stheraven 2829227825Stheraven// bullets 1 and 2 2830227825Stheraven 2831232950Stheraventemplate <class _Fp, class _A0, class ..._Args> 2832241903Sdim_LIBCPP_INLINE_VISIBILITY 2833227825Stheravenauto 2834232950Stheraven__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 2835227825Stheraven -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)); 2836227825Stheraven 2837232950Stheraventemplate <class _Fp, class _A0, class ..._Args> 2838241903Sdim_LIBCPP_INLINE_VISIBILITY 2839227825Stheravenauto 2840232950Stheraven__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 2841227825Stheraven -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)); 2842227825Stheraven 2843227825Stheraven// bullets 3 and 4 2844227825Stheraven 2845232950Stheraventemplate <class _Fp, class _A0> 2846241903Sdim_LIBCPP_INLINE_VISIBILITY 2847227825Stheravenauto 2848232950Stheraven__invoke(_Fp&& __f, _A0&& __a0) 2849227825Stheraven -> decltype(_VSTD::forward<_A0>(__a0).*__f); 2850227825Stheraven 2851232950Stheraventemplate <class _Fp, class _A0> 2852241903Sdim_LIBCPP_INLINE_VISIBILITY 2853227825Stheravenauto 2854232950Stheraven__invoke(_Fp&& __f, _A0&& __a0) 2855227825Stheraven -> decltype((*_VSTD::forward<_A0>(__a0)).*__f); 2856227825Stheraven 2857227825Stheraven// bullet 5 2858227825Stheraven 2859232950Stheraventemplate <class _Fp, class ..._Args> 2860241903Sdim_LIBCPP_INLINE_VISIBILITY 2861227825Stheravenauto 2862232950Stheraven__invoke(_Fp&& __f, _Args&& ...__args) 2863232950Stheraven -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)); 2864227825Stheraven 2865227825Stheraven// __invokable 2866227825Stheraven 2867232950Stheraventemplate <class _Fp, class ..._Args> 2868227825Stheravenstruct __invokable_imp 2869241903Sdim : private __check_complete<_Fp> 2870227825Stheraven{ 2871227825Stheraven typedef decltype( 2872232950Stheraven __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...) 2873227825Stheraven ) type; 2874227825Stheraven static const bool value = !is_same<type, __nat>::value; 2875227825Stheraven}; 2876227825Stheraven 2877232950Stheraventemplate <class _Fp, class ..._Args> 2878227825Stheravenstruct __invokable 2879227825Stheraven : public integral_constant<bool, 2880232950Stheraven __invokable_imp<_Fp, _Args...>::value> 2881227825Stheraven{ 2882227825Stheraven}; 2883227825Stheraven 2884227825Stheraven// __invoke_of 2885227825Stheraven 2886232950Stheraventemplate <bool _Invokable, class _Fp, class ..._Args> 2887227825Stheravenstruct __invoke_of_imp // false 2888227825Stheraven{ 2889227825Stheraven}; 2890227825Stheraven 2891232950Stheraventemplate <class _Fp, class ..._Args> 2892232950Stheravenstruct __invoke_of_imp<true, _Fp, _Args...> 2893227825Stheraven{ 2894232950Stheraven typedef typename __invokable_imp<_Fp, _Args...>::type type; 2895227825Stheraven}; 2896227825Stheraven 2897232950Stheraventemplate <class _Fp, class ..._Args> 2898227825Stheravenstruct __invoke_of 2899232950Stheraven : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...> 2900227825Stheraven{ 2901227825Stheraven}; 2902227825Stheraven 2903241903Sdimtemplate <class _Fp, class ..._Args> 2904241903Sdimclass _LIBCPP_VISIBLE result_of<_Fp(_Args...)> 2905241903Sdim : public __invoke_of<_Fp, _Args...> 2906241903Sdim{ 2907241903Sdim}; 2908241903Sdim 2909227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2910227825Stheraven 2911227825Stheraventemplate <class _Tp> 2912227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2913227825Stheraven#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE 2914227825Stheraventypename enable_if 2915227825Stheraven< 2916227825Stheraven is_move_constructible<_Tp>::value && 2917227825Stheraven is_move_assignable<_Tp>::value 2918227825Stheraven>::type 2919227825Stheraven#else 2920227825Stheravenvoid 2921227825Stheraven#endif 2922227825Stheravenswap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && 2923227825Stheraven is_nothrow_move_assignable<_Tp>::value) 2924227825Stheraven{ 2925227825Stheraven _Tp __t(_VSTD::move(__x)); 2926227825Stheraven __x = _VSTD::move(__y); 2927227825Stheraven __y = _VSTD::move(__t); 2928227825Stheraven} 2929227825Stheraven 2930227825Stheraventemplate <class _ForwardIterator1, class _ForwardIterator2> 2931227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 2932227825Stheravenvoid 2933227825Stheraveniter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) 2934227825Stheraven // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b))) 2935227825Stheraven _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(), 2936227825Stheraven *_VSTD::declval<_ForwardIterator2>()))) 2937227825Stheraven{ 2938227825Stheraven swap(*__a, *__b); 2939227825Stheraven} 2940227825Stheraven 2941227825Stheraven// __swappable 2942227825Stheraven 2943227825Stheravennamespace __detail 2944227825Stheraven{ 2945227825Stheraven 2946227825Stheravenusing _VSTD::swap; 2947227825Stheraven__nat swap(__any, __any); 2948227825Stheraven 2949227825Stheraventemplate <class _Tp> 2950227825Stheravenstruct __swappable 2951227825Stheraven{ 2952227825Stheraven typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type; 2953227825Stheraven static const bool value = !is_same<type, __nat>::value; 2954227825Stheraven}; 2955227825Stheraven 2956227825Stheraven} // __detail 2957227825Stheraven 2958227825Stheraventemplate <class _Tp> 2959227825Stheravenstruct __is_swappable 2960227825Stheraven : public integral_constant<bool, __detail::__swappable<_Tp>::value> 2961227825Stheraven{ 2962227825Stheraven}; 2963227825Stheraven 2964227825Stheraven#if __has_feature(cxx_noexcept) 2965227825Stheraven 2966227825Stheraventemplate <bool, class _Tp> 2967227825Stheravenstruct __is_nothrow_swappable_imp 2968227825Stheraven : public integral_constant<bool, noexcept(swap(_VSTD::declval<_Tp&>(), 2969227825Stheraven _VSTD::declval<_Tp&>()))> 2970227825Stheraven{ 2971227825Stheraven}; 2972227825Stheraven 2973227825Stheraventemplate <class _Tp> 2974227825Stheravenstruct __is_nothrow_swappable_imp<false, _Tp> 2975227825Stheraven : public false_type 2976227825Stheraven{ 2977227825Stheraven}; 2978227825Stheraven 2979227825Stheraventemplate <class _Tp> 2980227825Stheravenstruct __is_nothrow_swappable 2981227825Stheraven : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp> 2982227825Stheraven{ 2983227825Stheraven}; 2984227825Stheraven 2985227825Stheraven#else // __has_feature(cxx_noexcept) 2986227825Stheraven 2987227825Stheraventemplate <class _Tp> 2988227825Stheravenstruct __is_nothrow_swappable 2989227825Stheraven : public false_type 2990227825Stheraven{ 2991227825Stheraven}; 2992227825Stheraven 2993227825Stheraven#endif // __has_feature(cxx_noexcept) 2994227825Stheraven 2995227825Stheraven#ifdef _LIBCXX_UNDERLYING_TYPE 2996227825Stheraven 2997227825Stheraventemplate <class _Tp> 2998227825Stheravenstruct underlying_type 2999227825Stheraven{ 3000227825Stheraven typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type; 3001227825Stheraven}; 3002227825Stheraven 3003227825Stheraven#else // _LIBCXX_UNDERLYING_TYPE 3004227825Stheraven 3005227825Stheraventemplate <class _Tp, bool _Support = false> 3006227825Stheravenstruct underlying_type 3007227825Stheraven{ 3008227825Stheraven static_assert(_Support, "The underyling_type trait requires compiler " 3009227825Stheraven "support. Either no such support exists or " 3010227825Stheraven "libc++ does not know how to use it."); 3011227825Stheraven}; 3012227825Stheraven 3013227825Stheraven#endif // _LIBCXX_UNDERLYING_TYPE 3014227825Stheraven 3015227825Stheraven_LIBCPP_END_NAMESPACE_STD 3016227825Stheraven 3017227825Stheraven#endif // _LIBCPP_TYPE_TRAITS 3018