1227825Stheraven// -*- C++ -*- 2227825Stheraven//===------------------------ type_traits ---------------------------------===// 3227825Stheraven// 4227825Stheraven// The LLVM Compiler Infrastructure 5227825Stheraven// 6227825Stheraven// This file is dual licensed under the MIT and the University of Illinois Open 7227825Stheraven// Source Licenses. See LICENSE.TXT for details. 8227825Stheraven// 9227825Stheraven//===----------------------------------------------------------------------===// 10227825Stheraven 11227825Stheraven#ifndef _LIBCPP_TYPE_TRAITS 12227825Stheraven#define _LIBCPP_TYPE_TRAITS 13227825Stheraven 14227825Stheraven/* 15227825Stheraven type_traits synopsis 16227825Stheraven 17227825Stheravennamespace std 18227825Stheraven{ 19227825Stheraven 20227825Stheraven // helper class: 21227825Stheraven template <class T, T v> struct integral_constant; 22227825Stheraven typedef integral_constant<bool, true> true_type; 23227825Stheraven typedef integral_constant<bool, false> false_type; 24227825Stheraven 25227825Stheraven // helper traits 26227825Stheraven template <bool, class T = void> struct enable_if; 27227825Stheraven template <bool, class T, class F> struct conditional; 28227825Stheraven 29227825Stheraven // Primary classification traits: 30227825Stheraven template <class T> struct is_void; 31262801Sdim template <class T> struct is_null_pointer; // C++14 32227825Stheraven template <class T> struct is_integral; 33227825Stheraven template <class T> struct is_floating_point; 34227825Stheraven template <class T> struct is_array; 35227825Stheraven template <class T> struct is_pointer; 36227825Stheraven template <class T> struct is_lvalue_reference; 37227825Stheraven template <class T> struct is_rvalue_reference; 38227825Stheraven template <class T> struct is_member_object_pointer; 39227825Stheraven template <class T> struct is_member_function_pointer; 40227825Stheraven template <class T> struct is_enum; 41227825Stheraven template <class T> struct is_union; 42227825Stheraven template <class T> struct is_class; 43227825Stheraven template <class T> struct is_function; 44227825Stheraven 45227825Stheraven // Secondary classification traits: 46227825Stheraven template <class T> struct is_reference; 47227825Stheraven template <class T> struct is_arithmetic; 48227825Stheraven template <class T> struct is_fundamental; 49227825Stheraven template <class T> struct is_member_pointer; 50227825Stheraven template <class T> struct is_scalar; 51227825Stheraven template <class T> struct is_object; 52227825Stheraven template <class T> struct is_compound; 53227825Stheraven 54227825Stheraven // Const-volatile properties and transformations: 55227825Stheraven template <class T> struct is_const; 56227825Stheraven template <class T> struct is_volatile; 57227825Stheraven template <class T> struct remove_const; 58227825Stheraven template <class T> struct remove_volatile; 59227825Stheraven template <class T> struct remove_cv; 60227825Stheraven template <class T> struct add_const; 61227825Stheraven template <class T> struct add_volatile; 62227825Stheraven template <class T> struct add_cv; 63227825Stheraven 64227825Stheraven // Reference transformations: 65227825Stheraven template <class T> struct remove_reference; 66227825Stheraven template <class T> struct add_lvalue_reference; 67227825Stheraven template <class T> struct add_rvalue_reference; 68227825Stheraven 69227825Stheraven // Pointer transformations: 70227825Stheraven template <class T> struct remove_pointer; 71227825Stheraven template <class T> struct add_pointer; 72227825Stheraven 73227825Stheraven // Integral properties: 74227825Stheraven template <class T> struct is_signed; 75227825Stheraven template <class T> struct is_unsigned; 76227825Stheraven template <class T> struct make_signed; 77227825Stheraven template <class T> struct make_unsigned; 78227825Stheraven 79227825Stheraven // Array properties and transformations: 80227825Stheraven template <class T> struct rank; 81227825Stheraven template <class T, unsigned I = 0> struct extent; 82227825Stheraven template <class T> struct remove_extent; 83227825Stheraven template <class T> struct remove_all_extents; 84227825Stheraven 85227825Stheraven // Member introspection: 86227825Stheraven template <class T> struct is_pod; 87227825Stheraven template <class T> struct is_trivial; 88227825Stheraven template <class T> struct is_trivially_copyable; 89227825Stheraven template <class T> struct is_standard_layout; 90227825Stheraven template <class T> struct is_literal_type; 91227825Stheraven template <class T> struct is_empty; 92227825Stheraven template <class T> struct is_polymorphic; 93227825Stheraven template <class T> struct is_abstract; 94278724Sdim template <class T> struct is_final; // C++14 95227825Stheraven 96227825Stheraven template <class T, class... Args> struct is_constructible; 97227825Stheraven template <class T> struct is_default_constructible; 98227825Stheraven template <class T> struct is_copy_constructible; 99227825Stheraven template <class T> struct is_move_constructible; 100227825Stheraven template <class T, class U> struct is_assignable; 101227825Stheraven template <class T> struct is_copy_assignable; 102227825Stheraven template <class T> struct is_move_assignable; 103227825Stheraven template <class T> struct is_destructible; 104227825Stheraven 105227825Stheraven template <class T, class... Args> struct is_trivially_constructible; 106227825Stheraven template <class T> struct is_trivially_default_constructible; 107227825Stheraven template <class T> struct is_trivially_copy_constructible; 108227825Stheraven template <class T> struct is_trivially_move_constructible; 109227825Stheraven template <class T, class U> struct is_trivially_assignable; 110227825Stheraven template <class T> struct is_trivially_copy_assignable; 111227825Stheraven template <class T> struct is_trivially_move_assignable; 112227825Stheraven template <class T> struct is_trivially_destructible; 113227825Stheraven 114227825Stheraven template <class T, class... Args> struct is_nothrow_constructible; 115227825Stheraven template <class T> struct is_nothrow_default_constructible; 116227825Stheraven template <class T> struct is_nothrow_copy_constructible; 117227825Stheraven template <class T> struct is_nothrow_move_constructible; 118227825Stheraven template <class T, class U> struct is_nothrow_assignable; 119227825Stheraven template <class T> struct is_nothrow_copy_assignable; 120227825Stheraven template <class T> struct is_nothrow_move_assignable; 121227825Stheraven template <class T> struct is_nothrow_destructible; 122227825Stheraven 123227825Stheraven template <class T> struct has_virtual_destructor; 124227825Stheraven 125227825Stheraven // Relationships between types: 126227825Stheraven template <class T, class U> struct is_same; 127227825Stheraven template <class Base, class Derived> struct is_base_of; 128227825Stheraven template <class From, class To> struct is_convertible; 129227825Stheraven 130227825Stheraven // Alignment properties and transformations: 131227825Stheraven template <class T> struct alignment_of; 132227825Stheraven template <size_t Len, size_t Align = most_stringent_alignment_requirement> 133227825Stheraven struct aligned_storage; 134249998Sdim template <size_t Len, class... Types> struct aligned_union; 135227825Stheraven 136227825Stheraven template <class T> struct decay; 137227825Stheraven template <class... T> struct common_type; 138227825Stheraven template <class T> struct underlying_type; 139227825Stheraven template <class> class result_of; // undefined 140227825Stheraven template <class Fn, class... ArgTypes> class result_of<Fn(ArgTypes...)>; 141227825Stheraven 142253159Stheraven // const-volatile modifications: 143253159Stheraven template <class T> 144253159Stheraven using remove_const_t = typename remove_const<T>::type; // C++14 145253159Stheraven template <class T> 146253159Stheraven using remove_volatile_t = typename remove_volatile<T>::type; // C++14 147253159Stheraven template <class T> 148253159Stheraven using remove_cv_t = typename remove_cv<T>::type; // C++14 149253159Stheraven template <class T> 150253159Stheraven using add_const_t = typename add_const<T>::type; // C++14 151253159Stheraven template <class T> 152253159Stheraven using add_volatile_t = typename add_volatile<T>::type; // C++14 153253159Stheraven template <class T> 154253159Stheraven using add_cv_t = typename add_cv<T>::type; // C++14 155253159Stheraven 156253159Stheraven // reference modifications: 157253159Stheraven template <class T> 158253159Stheraven using remove_reference_t = typename remove_reference<T>::type; // C++14 159253159Stheraven template <class T> 160253159Stheraven using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; // C++14 161253159Stheraven template <class T> 162253159Stheraven using add_rvalue_reference_t = typename add_rvalue_reference<T>::type; // C++14 163253159Stheraven 164253159Stheraven // sign modifications: 165253159Stheraven template <class T> 166253159Stheraven using make_signed_t = typename make_signed<T>::type; // C++14 167253159Stheraven template <class T> 168253159Stheraven using make_unsigned_t = typename make_unsigned<T>::type; // C++14 169253159Stheraven 170253159Stheraven // array modifications: 171253159Stheraven template <class T> 172253159Stheraven using remove_extent_t = typename remove_extent<T>::type; // C++14 173253159Stheraven template <class T> 174253159Stheraven using remove_all_extents_t = typename remove_all_extents<T>::type; // C++14 175253159Stheraven 176253159Stheraven // pointer modifications: 177253159Stheraven template <class T> 178253159Stheraven using remove_pointer_t = typename remove_pointer<T>::type; // C++14 179253159Stheraven template <class T> 180253159Stheraven using add_pointer_t = typename add_pointer<T>::type; // C++14 181253159Stheraven 182253159Stheraven // other transformations: 183253159Stheraven template <size_t Len, std::size_t Align=default-alignment> 184253159Stheraven using aligned_storage_t = typename aligned_storage<Len,Align>::type; // C++14 185253159Stheraven template <std::size_t Len, class... Types> 186253159Stheraven using aligned_union_t = typename aligned_union<Len,Types...>::type; // C++14 187253159Stheraven template <class T> 188253159Stheraven using decay_t = typename decay<T>::type; // C++14 189253159Stheraven template <bool b, class T=void> 190253159Stheraven using enable_if_t = typename enable_if<b,T>::type; // C++14 191253159Stheraven template <bool b, class T, class F> 192253159Stheraven using conditional_t = typename conditional<b,T,F>::type; // C++14 193253159Stheraven template <class... T> 194253159Stheraven using common_type_t = typename common_type<T...>::type; // C++14 195253159Stheraven template <class T> 196253159Stheraven using underlying_type_t = typename underlying_type<T>::type; // C++14 197253159Stheraven template <class F, class... ArgTypes> 198253159Stheraven using result_of_t = typename result_of<F(ArgTypes...)>::type; // C++14 199253159Stheraven 200278724Sdim template <class...> 201278724Sdim using void_t = void; 202278724Sdim} // C++17 203227825Stheraven 204227825Stheraven*/ 205227825Stheraven#include <__config> 206227825Stheraven#include <cstddef> 207227825Stheraven 208227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 209227825Stheraven#pragma GCC system_header 210227825Stheraven#endif 211227825Stheraven 212227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD 213227825Stheraven 214278724Sdim#ifndef _LIBCPP_HAS_NO_VARIADICS 215278724Sdimtemplate <class...> 216278724Sdimstruct __void_t { typedef void type; }; 217278724Sdim#endif 218278724Sdim 219232950Stheraventemplate <bool _Bp, class _If, class _Then> 220262801Sdim struct _LIBCPP_TYPE_VIS_ONLY conditional {typedef _If type;}; 221227825Stheraventemplate <class _If, class _Then> 222262801Sdim struct _LIBCPP_TYPE_VIS_ONLY conditional<false, _If, _Then> {typedef _Then type;}; 223227825Stheraven 224253159Stheraven#if _LIBCPP_STD_VER > 11 225253159Stheraventemplate <bool _Bp, class _If, class _Then> using conditional_t = typename conditional<_Bp, _If, _Then>::type; 226253159Stheraven#endif 227253159Stheraven 228278724Sdimtemplate <bool, class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if {}; 229278724Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __lazy_enable_if<true, _Tp> {typedef typename _Tp::type type;}; 230278724Sdim 231262801Sdimtemplate <bool, class _Tp = void> struct _LIBCPP_TYPE_VIS_ONLY enable_if {}; 232262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY enable_if<true, _Tp> {typedef _Tp type;}; 233227825Stheraven 234253159Stheraven#if _LIBCPP_STD_VER > 11 235253159Stheraventemplate <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type; 236253159Stheraven#endif 237253159Stheraven 238253159Stheraven 239242945Stheravenstruct __two {char __lx[2];}; 240227825Stheraven 241227825Stheraven// helper class: 242227825Stheraven 243227825Stheraventemplate <class _Tp, _Tp __v> 244262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY integral_constant 245227825Stheraven{ 246234976Stheraven static _LIBCPP_CONSTEXPR const _Tp value = __v; 247227825Stheraven typedef _Tp value_type; 248227825Stheraven typedef integral_constant type; 249227825Stheraven _LIBCPP_INLINE_VISIBILITY 250278724Sdim _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;} 251262801Sdim#if _LIBCPP_STD_VER > 11 252262801Sdim _LIBCPP_INLINE_VISIBILITY 253278724Sdim constexpr value_type operator ()() const _NOEXCEPT {return value;} 254262801Sdim#endif 255227825Stheraven}; 256227825Stheraven 257227825Stheraventemplate <class _Tp, _Tp __v> 258234976Stheraven_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value; 259227825Stheraven 260227825Stheraventypedef integral_constant<bool, true> true_type; 261227825Stheraventypedef integral_constant<bool, false> false_type; 262227825Stheraven 263227825Stheraven// is_const 264227825Stheraven 265262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const : public false_type {}; 266262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const<_Tp const> : public true_type {}; 267227825Stheraven 268227825Stheraven// is_volatile 269227825Stheraven 270262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile : public false_type {}; 271262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile<_Tp volatile> : public true_type {}; 272227825Stheraven 273227825Stheraven// remove_const 274227825Stheraven 275262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const {typedef _Tp type;}; 276262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const<const _Tp> {typedef _Tp type;}; 277253159Stheraven#if _LIBCPP_STD_VER > 11 278253159Stheraventemplate <class _Tp> using remove_const_t = typename remove_const<_Tp>::type; 279253159Stheraven#endif 280227825Stheraven 281227825Stheraven// remove_volatile 282227825Stheraven 283262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile {typedef _Tp type;}; 284262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_volatile<volatile _Tp> {typedef _Tp type;}; 285253159Stheraven#if _LIBCPP_STD_VER > 11 286253159Stheraventemplate <class _Tp> using remove_volatile_t = typename remove_volatile<_Tp>::type; 287253159Stheraven#endif 288227825Stheraven 289227825Stheraven// remove_cv 290227825Stheraven 291262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_cv 292227825Stheraven{typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;}; 293253159Stheraven#if _LIBCPP_STD_VER > 11 294253159Stheraventemplate <class _Tp> using remove_cv_t = typename remove_cv<_Tp>::type; 295253159Stheraven#endif 296227825Stheraven 297227825Stheraven// is_void 298227825Stheraven 299260263Sdimtemplate <class _Tp> struct __libcpp_is_void : public false_type {}; 300260263Sdimtemplate <> struct __libcpp_is_void<void> : public true_type {}; 301227825Stheraven 302262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void 303260263Sdim : public __libcpp_is_void<typename remove_cv<_Tp>::type> {}; 304227825Stheraven 305227825Stheraven// __is_nullptr_t 306227825Stheraven 307278724Sdimtemplate <class _Tp> struct __is_nullptr_t_impl : public false_type {}; 308278724Sdimtemplate <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {}; 309227825Stheraven 310262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t 311278724Sdim : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; 312227825Stheraven 313262801Sdim#if _LIBCPP_STD_VER > 11 314262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer 315278724Sdim : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {}; 316262801Sdim#endif 317262801Sdim 318227825Stheraven// is_integral 319227825Stheraven 320260263Sdimtemplate <class _Tp> struct __libcpp_is_integral : public false_type {}; 321260263Sdimtemplate <> struct __libcpp_is_integral<bool> : public true_type {}; 322260263Sdimtemplate <> struct __libcpp_is_integral<char> : public true_type {}; 323260263Sdimtemplate <> struct __libcpp_is_integral<signed char> : public true_type {}; 324260263Sdimtemplate <> struct __libcpp_is_integral<unsigned char> : public true_type {}; 325260263Sdimtemplate <> struct __libcpp_is_integral<wchar_t> : public true_type {}; 326227825Stheraven#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS 327260263Sdimtemplate <> struct __libcpp_is_integral<char16_t> : public true_type {}; 328260263Sdimtemplate <> struct __libcpp_is_integral<char32_t> : public true_type {}; 329227825Stheraven#endif // _LIBCPP_HAS_NO_UNICODE_CHARS 330260263Sdimtemplate <> struct __libcpp_is_integral<short> : public true_type {}; 331260263Sdimtemplate <> struct __libcpp_is_integral<unsigned short> : public true_type {}; 332260263Sdimtemplate <> struct __libcpp_is_integral<int> : public true_type {}; 333260263Sdimtemplate <> struct __libcpp_is_integral<unsigned int> : public true_type {}; 334260263Sdimtemplate <> struct __libcpp_is_integral<long> : public true_type {}; 335260263Sdimtemplate <> struct __libcpp_is_integral<unsigned long> : public true_type {}; 336260263Sdimtemplate <> struct __libcpp_is_integral<long long> : public true_type {}; 337260263Sdimtemplate <> struct __libcpp_is_integral<unsigned long long> : public true_type {}; 338278724Sdim#ifndef _LIBCPP_HAS_NO_INT128 339278724Sdimtemplate <> struct __libcpp_is_integral<__int128_t> : public true_type {}; 340278724Sdimtemplate <> struct __libcpp_is_integral<__uint128_t> : public true_type {}; 341278724Sdim#endif 342227825Stheraven 343262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral 344260263Sdim : public __libcpp_is_integral<typename remove_cv<_Tp>::type> {}; 345227825Stheraven 346227825Stheraven// is_floating_point 347227825Stheraven 348260263Sdimtemplate <class _Tp> struct __libcpp_is_floating_point : public false_type {}; 349260263Sdimtemplate <> struct __libcpp_is_floating_point<float> : public true_type {}; 350260263Sdimtemplate <> struct __libcpp_is_floating_point<double> : public true_type {}; 351260263Sdimtemplate <> struct __libcpp_is_floating_point<long double> : public true_type {}; 352227825Stheraven 353262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_floating_point 354260263Sdim : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {}; 355227825Stheraven 356227825Stheraven// is_array 357227825Stheraven 358262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array 359227825Stheraven : public false_type {}; 360262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[]> 361227825Stheraven : public true_type {}; 362262801Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]> 363227825Stheraven : public true_type {}; 364227825Stheraven 365227825Stheraven// is_pointer 366227825Stheraven 367260263Sdimtemplate <class _Tp> struct __libcpp_is_pointer : public false_type {}; 368260263Sdimtemplate <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {}; 369227825Stheraven 370262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pointer 371260263Sdim : public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {}; 372227825Stheraven 373227825Stheraven// is_reference 374227825Stheraven 375262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference : public false_type {}; 376262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference<_Tp&> : public true_type {}; 377227825Stheraven 378262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference : public false_type {}; 379227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 380262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_rvalue_reference<_Tp&&> : public true_type {}; 381227825Stheraven#endif 382227825Stheraven 383262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference : public false_type {}; 384262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&> : public true_type {}; 385227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 386262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public true_type {}; 387227825Stheraven#endif 388227825Stheraven 389227825Stheraven// is_union 390227825Stheraven 391278724Sdim#if __has_feature(is_union) || (_GNUC_VER >= 403) 392227825Stheraven 393262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union 394227825Stheraven : public integral_constant<bool, __is_union(_Tp)> {}; 395227825Stheraven 396227825Stheraven#else 397227825Stheraven 398227825Stheraventemplate <class _Tp> struct __libcpp_union : public false_type {}; 399262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union 400227825Stheraven : public __libcpp_union<typename remove_cv<_Tp>::type> {}; 401227825Stheraven 402227825Stheraven#endif 403227825Stheraven 404227825Stheraven// is_class 405227825Stheraven 406278724Sdim#if __has_feature(is_class) || (_GNUC_VER >= 403) 407227825Stheraven 408262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class 409227825Stheraven : public integral_constant<bool, __is_class(_Tp)> {}; 410227825Stheraven 411227825Stheraven#else 412227825Stheraven 413227825Stheravennamespace __is_class_imp 414227825Stheraven{ 415227825Stheraventemplate <class _Tp> char __test(int _Tp::*); 416227825Stheraventemplate <class _Tp> __two __test(...); 417227825Stheraven} 418227825Stheraven 419262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class 420227825Stheraven : public integral_constant<bool, sizeof(__is_class_imp::__test<_Tp>(0)) == 1 && !is_union<_Tp>::value> {}; 421227825Stheraven 422227825Stheraven#endif 423227825Stheraven 424227825Stheraven// is_same 425227825Stheraven 426262801Sdimtemplate <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS_ONLY is_same : public false_type {}; 427262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> : public true_type {}; 428227825Stheraven 429227825Stheraven// is_function 430227825Stheraven 431278724Sdimnamespace __libcpp_is_function_imp 432227825Stheraven{ 433227825Stheraventemplate <class _Tp> char __test(_Tp*); 434227825Stheraventemplate <class _Tp> __two __test(...); 435227825Stheraventemplate <class _Tp> _Tp& __source(); 436227825Stheraven} 437227825Stheraven 438227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value || 439227825Stheraven is_union<_Tp>::value || 440227825Stheraven is_void<_Tp>::value || 441227825Stheraven is_reference<_Tp>::value || 442262801Sdim __is_nullptr_t<_Tp>::value > 443260263Sdimstruct __libcpp_is_function 444278724Sdim : public integral_constant<bool, sizeof(__libcpp_is_function_imp::__test<_Tp>(__libcpp_is_function_imp::__source<_Tp>())) == 1> 445227825Stheraven {}; 446260263Sdimtemplate <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type {}; 447227825Stheraven 448262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function 449260263Sdim : public __libcpp_is_function<_Tp> {}; 450227825Stheraven 451227825Stheraven// is_member_function_pointer 452227825Stheraven 453275472Sdim// template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {}; 454275472Sdim// template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {}; 455275472Sdim// 456227825Stheraven 457275472Sdimtemplate <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr> 458275472Sdimstruct __member_pointer_traits_imp 459275472Sdim{ // forward declaration; specializations later 460275472Sdim}; 461275472Sdim 462275472Sdim 463275472Sdimnamespace __libcpp_is_member_function_pointer_imp { 464278724Sdim template <typename _Tp> 465278724Sdim char __test(typename std::__member_pointer_traits_imp<_Tp, true, false>::_FnType *); 466275472Sdim 467278724Sdim template <typename> 468278724Sdim std::__two __test(...); 469275472Sdim}; 470278724Sdim 471275472Sdimtemplate <class _Tp> struct __libcpp_is_member_function_pointer 472275472Sdim : public integral_constant<bool, sizeof(__libcpp_is_member_function_pointer_imp::__test<_Tp>(nullptr)) == 1> {}; 473275472Sdim 474262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer 475260263Sdim : public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type> {}; 476227825Stheraven 477227825Stheraven// is_member_pointer 478227825Stheraven 479260263Sdimtemplate <class _Tp> struct __libcpp_is_member_pointer : public false_type {}; 480260263Sdimtemplate <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> : public true_type {}; 481227825Stheraven 482262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer 483260263Sdim : public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {}; 484227825Stheraven 485227825Stheraven// is_member_object_pointer 486227825Stheraven 487262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer 488227825Stheraven : public integral_constant<bool, is_member_pointer<_Tp>::value && 489227825Stheraven !is_member_function_pointer<_Tp>::value> {}; 490227825Stheraven 491227825Stheraven// is_enum 492227825Stheraven 493278724Sdim#if __has_feature(is_enum) || (_GNUC_VER >= 403) 494227825Stheraven 495262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum 496227825Stheraven : public integral_constant<bool, __is_enum(_Tp)> {}; 497227825Stheraven 498227825Stheraven#else 499227825Stheraven 500262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum 501227825Stheraven : public integral_constant<bool, !is_void<_Tp>::value && 502227825Stheraven !is_integral<_Tp>::value && 503227825Stheraven !is_floating_point<_Tp>::value && 504227825Stheraven !is_array<_Tp>::value && 505227825Stheraven !is_pointer<_Tp>::value && 506227825Stheraven !is_reference<_Tp>::value && 507227825Stheraven !is_member_pointer<_Tp>::value && 508227825Stheraven !is_union<_Tp>::value && 509227825Stheraven !is_class<_Tp>::value && 510227825Stheraven !is_function<_Tp>::value > {}; 511227825Stheraven 512227825Stheraven#endif 513227825Stheraven 514227825Stheraven// is_arithmetic 515227825Stheraven 516262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_arithmetic 517227825Stheraven : public integral_constant<bool, is_integral<_Tp>::value || 518227825Stheraven is_floating_point<_Tp>::value> {}; 519227825Stheraven 520227825Stheraven// is_fundamental 521227825Stheraven 522262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental 523227825Stheraven : public integral_constant<bool, is_void<_Tp>::value || 524227825Stheraven __is_nullptr_t<_Tp>::value || 525227825Stheraven is_arithmetic<_Tp>::value> {}; 526227825Stheraven 527227825Stheraven// is_scalar 528227825Stheraven 529262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar 530227825Stheraven : public integral_constant<bool, is_arithmetic<_Tp>::value || 531227825Stheraven is_member_pointer<_Tp>::value || 532227825Stheraven is_pointer<_Tp>::value || 533227825Stheraven __is_nullptr_t<_Tp>::value || 534227825Stheraven is_enum<_Tp>::value > {}; 535227825Stheraven 536262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar<nullptr_t> : public true_type {}; 537227825Stheraven 538227825Stheraven// is_object 539227825Stheraven 540262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object 541227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 542227825Stheraven is_array<_Tp>::value || 543227825Stheraven is_union<_Tp>::value || 544227825Stheraven is_class<_Tp>::value > {}; 545227825Stheraven 546227825Stheraven// is_compound 547227825Stheraven 548262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_compound 549227825Stheraven : public integral_constant<bool, !is_fundamental<_Tp>::value> {}; 550227825Stheraven 551227825Stheraven// add_const 552227825Stheraven 553227825Stheraventemplate <class _Tp, bool = is_reference<_Tp>::value || 554227825Stheraven is_function<_Tp>::value || 555227825Stheraven is_const<_Tp>::value > 556227825Stheravenstruct __add_const {typedef _Tp type;}; 557227825Stheraven 558227825Stheraventemplate <class _Tp> 559227825Stheravenstruct __add_const<_Tp, false> {typedef const _Tp type;}; 560227825Stheraven 561262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_const 562227825Stheraven {typedef typename __add_const<_Tp>::type type;}; 563227825Stheraven 564253159Stheraven#if _LIBCPP_STD_VER > 11 565253159Stheraventemplate <class _Tp> using add_const_t = typename add_const<_Tp>::type; 566253159Stheraven#endif 567253159Stheraven 568227825Stheraven// add_volatile 569227825Stheraven 570227825Stheraventemplate <class _Tp, bool = is_reference<_Tp>::value || 571227825Stheraven is_function<_Tp>::value || 572227825Stheraven is_volatile<_Tp>::value > 573227825Stheravenstruct __add_volatile {typedef _Tp type;}; 574227825Stheraven 575227825Stheraventemplate <class _Tp> 576227825Stheravenstruct __add_volatile<_Tp, false> {typedef volatile _Tp type;}; 577227825Stheraven 578262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_volatile 579227825Stheraven {typedef typename __add_volatile<_Tp>::type type;}; 580227825Stheraven 581253159Stheraven#if _LIBCPP_STD_VER > 11 582253159Stheraventemplate <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type; 583253159Stheraven#endif 584253159Stheraven 585227825Stheraven// add_cv 586227825Stheraven 587262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_cv 588227825Stheraven {typedef typename add_const<typename add_volatile<_Tp>::type>::type type;}; 589227825Stheraven 590253159Stheraven#if _LIBCPP_STD_VER > 11 591253159Stheraventemplate <class _Tp> using add_cv_t = typename add_cv<_Tp>::type; 592253159Stheraven#endif 593253159Stheraven 594227825Stheraven// remove_reference 595227825Stheraven 596262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference {typedef _Tp type;}; 597262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&> {typedef _Tp type;}; 598227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 599262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_reference<_Tp&&> {typedef _Tp type;}; 600227825Stheraven#endif 601227825Stheraven 602253159Stheraven#if _LIBCPP_STD_VER > 11 603253159Stheraventemplate <class _Tp> using remove_reference_t = typename remove_reference<_Tp>::type; 604253159Stheraven#endif 605253159Stheraven 606227825Stheraven// add_lvalue_reference 607227825Stheraven 608262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference {typedef _Tp& type;}; 609262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<_Tp&> {typedef _Tp& type;}; // for older compiler 610262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<void> {typedef void type;}; 611262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const void> {typedef const void type;}; 612262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<volatile void> {typedef volatile void type;}; 613262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_lvalue_reference<const volatile void> {typedef const volatile void type;}; 614227825Stheraven 615253159Stheraven#if _LIBCPP_STD_VER > 11 616253159Stheraventemplate <class _Tp> using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; 617253159Stheraven#endif 618253159Stheraven 619227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 620227825Stheraven 621262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference {typedef _Tp&& type;}; 622262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<void> {typedef void type;}; 623262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const void> {typedef const void type;}; 624262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<volatile void> {typedef volatile void type;}; 625262801Sdimtemplate <> struct _LIBCPP_TYPE_VIS_ONLY add_rvalue_reference<const volatile void> {typedef const volatile void type;}; 626227825Stheraven 627253159Stheraven#if _LIBCPP_STD_VER > 11 628253159Stheraventemplate <class _Tp> using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; 629253159Stheraven#endif 630253159Stheraven 631227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 632227825Stheraven 633227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 634227825Stheraven 635227825Stheraventemplate <class _Tp> 636227825Stheraventypename add_rvalue_reference<_Tp>::type 637227825Stheravendeclval() _NOEXCEPT; 638227825Stheraven 639227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 640227825Stheraven 641227825Stheraventemplate <class _Tp> 642227825Stheraventypename add_lvalue_reference<_Tp>::type 643227825Stheravendeclval(); 644227825Stheraven 645227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 646227825Stheraven 647227825Stheravenstruct __any 648227825Stheraven{ 649227825Stheraven __any(...); 650227825Stheraven}; 651227825Stheraven 652227825Stheraven// remove_pointer 653227825Stheraven 654262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer {typedef _Tp type;}; 655262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp*> {typedef _Tp type;}; 656262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const> {typedef _Tp type;}; 657262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* volatile> {typedef _Tp type;}; 658262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_pointer<_Tp* const volatile> {typedef _Tp type;}; 659227825Stheraven 660253159Stheraven#if _LIBCPP_STD_VER > 11 661253159Stheraventemplate <class _Tp> using remove_pointer_t = typename remove_pointer<_Tp>::type; 662253159Stheraven#endif 663253159Stheraven 664227825Stheraven// add_pointer 665227825Stheraven 666262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY add_pointer 667227825Stheraven {typedef typename remove_reference<_Tp>::type* type;}; 668227825Stheraven 669253159Stheraven#if _LIBCPP_STD_VER > 11 670253159Stheraventemplate <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type; 671253159Stheraven#endif 672253159Stheraven 673227825Stheraven// is_signed 674227825Stheraven 675227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value> 676278724Sdimstruct __libcpp_is_signed_impl : public integral_constant<bool, _Tp(-1) < _Tp(0)> {}; 677227825Stheraven 678227825Stheraventemplate <class _Tp> 679278724Sdimstruct __libcpp_is_signed_impl<_Tp, false> : public true_type {}; // floating point 680227825Stheraven 681227825Stheraventemplate <class _Tp, bool = is_arithmetic<_Tp>::value> 682278724Sdimstruct __libcpp_is_signed : public __libcpp_is_signed_impl<_Tp> {}; 683227825Stheraven 684260263Sdimtemplate <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {}; 685227825Stheraven 686262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {}; 687227825Stheraven 688227825Stheraven// is_unsigned 689227825Stheraven 690227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value> 691278724Sdimstruct __libcpp_is_unsigned_impl : public integral_constant<bool, _Tp(0) < _Tp(-1)> {}; 692227825Stheraven 693227825Stheraventemplate <class _Tp> 694278724Sdimstruct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {}; // floating point 695227825Stheraven 696227825Stheraventemplate <class _Tp, bool = is_arithmetic<_Tp>::value> 697278724Sdimstruct __libcpp_is_unsigned : public __libcpp_is_unsigned_impl<_Tp> {}; 698227825Stheraven 699260263Sdimtemplate <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {}; 700227825Stheraven 701262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {}; 702227825Stheraven 703227825Stheraven// rank 704227825Stheraven 705262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank 706227825Stheraven : public integral_constant<size_t, 0> {}; 707262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[]> 708227825Stheraven : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 709262801Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[_Np]> 710227825Stheraven : public integral_constant<size_t, rank<_Tp>::value + 1> {}; 711227825Stheraven 712227825Stheraven// extent 713227825Stheraven 714262801Sdimtemplate <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TYPE_VIS_ONLY extent 715227825Stheraven : public integral_constant<size_t, 0> {}; 716262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], 0> 717227825Stheraven : public integral_constant<size_t, 0> {}; 718262801Sdimtemplate <class _Tp, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[], _Ip> 719227825Stheraven : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 720262801Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], 0> 721227825Stheraven : public integral_constant<size_t, _Np> {}; 722262801Sdimtemplate <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], _Ip> 723227825Stheraven : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; 724227825Stheraven 725227825Stheraven// remove_extent 726227825Stheraven 727262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent 728227825Stheraven {typedef _Tp type;}; 729262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[]> 730227825Stheraven {typedef _Tp type;}; 731262801Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_extent<_Tp[_Np]> 732227825Stheraven {typedef _Tp type;}; 733227825Stheraven 734253159Stheraven#if _LIBCPP_STD_VER > 11 735253159Stheraventemplate <class _Tp> using remove_extent_t = typename remove_extent<_Tp>::type; 736253159Stheraven#endif 737253159Stheraven 738227825Stheraven// remove_all_extents 739227825Stheraven 740262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents 741227825Stheraven {typedef _Tp type;}; 742262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[]> 743227825Stheraven {typedef typename remove_all_extents<_Tp>::type type;}; 744262801Sdimtemplate <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY remove_all_extents<_Tp[_Np]> 745227825Stheraven {typedef typename remove_all_extents<_Tp>::type type;}; 746227825Stheraven 747253159Stheraven#if _LIBCPP_STD_VER > 11 748253159Stheraventemplate <class _Tp> using remove_all_extents_t = typename remove_all_extents<_Tp>::type; 749253159Stheraven#endif 750253159Stheraven 751262801Sdim// decay 752262801Sdim 753262801Sdimtemplate <class _Tp> 754262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY decay 755262801Sdim{ 756262801Sdimprivate: 757262801Sdim typedef typename remove_reference<_Tp>::type _Up; 758262801Sdimpublic: 759262801Sdim typedef typename conditional 760262801Sdim < 761262801Sdim is_array<_Up>::value, 762262801Sdim typename remove_extent<_Up>::type*, 763262801Sdim typename conditional 764262801Sdim < 765262801Sdim is_function<_Up>::value, 766262801Sdim typename add_pointer<_Up>::type, 767262801Sdim typename remove_cv<_Up>::type 768262801Sdim >::type 769262801Sdim >::type type; 770262801Sdim}; 771262801Sdim 772262801Sdim#if _LIBCPP_STD_VER > 11 773262801Sdimtemplate <class _Tp> using decay_t = typename decay<_Tp>::type; 774262801Sdim#endif 775262801Sdim 776227825Stheraven// is_abstract 777227825Stheraven 778227825Stheravennamespace __is_abstract_imp 779227825Stheraven{ 780227825Stheraventemplate <class _Tp> char __test(_Tp (*)[1]); 781227825Stheraventemplate <class _Tp> __two __test(...); 782227825Stheraven} 783227825Stheraven 784227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value> 785227825Stheravenstruct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {}; 786227825Stheraven 787227825Stheraventemplate <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {}; 788227825Stheraven 789262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {}; 790227825Stheraven 791278724Sdim// is_final 792278724Sdim 793278724Sdim#if _LIBCPP_STD_VER > 11 && __has_feature(is_final) 794278724Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY 795278724Sdimis_final : public integral_constant<bool, __is_final(_Tp)> {}; 796278724Sdim#endif 797278724Sdim 798241903Sdim// is_base_of 799241903Sdim 800262801Sdim#ifdef _LIBCPP_HAS_IS_BASE_OF 801241903Sdim 802241903Sdimtemplate <class _Bp, class _Dp> 803262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_base_of 804241903Sdim : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; 805241903Sdim 806278724Sdim#else // _LIBCPP_HAS_IS_BASE_OF 807241903Sdim 808246487Stheravennamespace __is_base_of_imp 809246487Stheraven{ 810246487Stheraventemplate <class _Tp> 811246487Stheravenstruct _Dst 812246487Stheraven{ 813246487Stheraven _Dst(const volatile _Tp &); 814246487Stheraven}; 815246487Stheraventemplate <class _Tp> 816246487Stheravenstruct _Src 817246487Stheraven{ 818246487Stheraven operator const volatile _Tp &(); 819246487Stheraven template <class _Up> operator const _Dst<_Up> &(); 820246487Stheraven}; 821246487Stheraventemplate <size_t> struct __one { typedef char type; }; 822246487Stheraventemplate <class _Bp, class _Dp> typename __one<sizeof(_Dst<_Bp>(declval<_Src<_Dp> >()))>::type __test(int); 823246487Stheraventemplate <class _Bp, class _Dp> __two __test(...); 824246487Stheraven} 825241903Sdim 826246487Stheraventemplate <class _Bp, class _Dp> 827262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_base_of 828246487Stheraven : public integral_constant<bool, is_class<_Bp>::value && 829246487Stheraven sizeof(__is_base_of_imp::__test<_Bp, _Dp>(0)) == 2> {}; 830246487Stheraven 831278724Sdim#endif // _LIBCPP_HAS_IS_BASE_OF 832241903Sdim 833227825Stheraven// is_convertible 834227825Stheraven 835227825Stheraven#if __has_feature(is_convertible_to) 836227825Stheraven 837262801Sdimtemplate <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible 838241903Sdim : public integral_constant<bool, __is_convertible_to(_T1, _T2) && 839241903Sdim !is_abstract<_T2>::value> {}; 840227825Stheraven 841227825Stheraven#else // __has_feature(is_convertible_to) 842227825Stheraven 843227825Stheravennamespace __is_convertible_imp 844227825Stheraven{ 845281149Sdimtemplate <class _Tp> void __test_convert(_Tp); 846281149Sdim 847281149Sdimtemplate <class _From, class _To, class = void> 848281149Sdimstruct __is_convertible_test : public false_type {}; 849281149Sdim 850281149Sdimtemplate <class _From, class _To> 851281149Sdimstruct __is_convertible_test<_From, _To, 852281149Sdim decltype(__test_convert<_To>(_VSTD::declval<_From>()))> : public true_type 853281149Sdim{}; 854281149Sdim 855227825Stheraventemplate <class _Tp> __two __test(...); 856227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 857227825Stheraventemplate <class _Tp> _Tp&& __source(); 858227825Stheraven#else 859227825Stheraventemplate <class _Tp> typename remove_reference<_Tp>::type& __source(); 860227825Stheraven#endif 861227825Stheraven 862227825Stheraventemplate <class _Tp, bool _IsArray = is_array<_Tp>::value, 863227825Stheraven bool _IsFunction = is_function<_Tp>::value, 864227825Stheraven bool _IsVoid = is_void<_Tp>::value> 865227825Stheraven struct __is_array_function_or_void {enum {value = 0};}; 866227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};}; 867227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};}; 868227825Stheraventemplate <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};}; 869227825Stheraven} 870227825Stheraven 871227825Stheraventemplate <class _Tp, 872227825Stheraven unsigned = __is_convertible_imp::__is_array_function_or_void<typename remove_reference<_Tp>::type>::value> 873227825Stheravenstruct __is_convertible_check 874227825Stheraven{ 875227825Stheraven static const size_t __v = 0; 876227825Stheraven}; 877227825Stheraven 878227825Stheraventemplate <class _Tp> 879227825Stheravenstruct __is_convertible_check<_Tp, 0> 880227825Stheraven{ 881227825Stheraven static const size_t __v = sizeof(_Tp); 882227825Stheraven}; 883227825Stheraven 884227825Stheraventemplate <class _T1, class _T2, 885227825Stheraven unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value, 886227825Stheraven unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value> 887227825Stheravenstruct __is_convertible 888227825Stheraven : public integral_constant<bool, 889281149Sdim __is_convertible_imp::__is_convertible_test<_T1, _T2>::value 890281149Sdim#if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) 891241903Sdim && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value 892241903Sdim && (!is_const<typename remove_reference<_T2>::type>::value 893241903Sdim || is_volatile<typename remove_reference<_T2>::type>::value) 894241903Sdim && (is_same<typename remove_cv<_T1>::type, 895241903Sdim typename remove_cv<typename remove_reference<_T2>::type>::type>::value 896241903Sdim || is_base_of<typename remove_reference<_T2>::type, _T1>::value)) 897241903Sdim#endif 898227825Stheraven > 899227825Stheraven{}; 900227825Stheraven 901227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 0> : false_type {}; 902227825Stheraven 903227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const _T1&, 1, 0> : true_type {}; 904227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 905227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1&&, 1, 0> : true_type {}; 906227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const _T1&&, 1, 0> : true_type {}; 907227825Stheraventemplate <class _T1> struct __is_convertible<_T1, volatile _T1&&, 1, 0> : true_type {}; 908227825Stheraventemplate <class _T1> struct __is_convertible<_T1, const volatile _T1&&, 1, 0> : true_type {}; 909227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 910227825Stheraven 911227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2*, 1, 0> 912227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*>::value> {}; 913227825Stheraven 914227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* const, 1, 0> 915227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const>::value> {}; 916227825Stheraven 917227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* volatile, 1, 0> 918227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*volatile>::value> {}; 919227825Stheraven 920227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2* const volatile, 1, 0> 921227825Stheraven : public integral_constant<bool, __is_convertible<typename remove_all_extents<_T1>::type*, _T2*const volatile>::value> {}; 922227825Stheraven 923227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0> : public false_type {}; 924227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 925227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1&&, 2, 0> : public true_type {}; 926227825Stheraven#endif 927241903Sdimtemplate <class _T1> struct __is_convertible<_T1, _T1&, 2, 0> : public true_type {}; 928227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*, 2, 0> : public true_type {}; 929227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*const, 2, 0> : public true_type {}; 930227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {}; 931227825Stheraventemplate <class _T1> struct __is_convertible<_T1, _T1*const volatile, 2, 0> : public true_type {}; 932227825Stheraven 933227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 0> : public false_type {}; 934227825Stheraven 935227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {}; 936227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {}; 937227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {}; 938227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {}; 939227825Stheraven 940227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {}; 941227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {}; 942227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {}; 943227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {}; 944227825Stheraven 945227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {}; 946227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {}; 947227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {}; 948227825Stheraventemplate <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {}; 949227825Stheraven 950262801Sdimtemplate <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible 951227825Stheraven : public __is_convertible<_T1, _T2> 952227825Stheraven{ 953227825Stheraven static const size_t __complete_check1 = __is_convertible_check<_T1>::__v; 954227825Stheraven static const size_t __complete_check2 = __is_convertible_check<_T2>::__v; 955227825Stheraven}; 956227825Stheraven 957227825Stheraven#endif // __has_feature(is_convertible_to) 958227825Stheraven 959227825Stheraven// is_empty 960227825Stheraven 961278724Sdim#if __has_feature(is_empty) || (_GNUC_VER >= 407) 962232950Stheraven 963227825Stheraventemplate <class _Tp> 964262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_empty 965232950Stheraven : public integral_constant<bool, __is_empty(_Tp)> {}; 966232950Stheraven 967232950Stheraven#else // __has_feature(is_empty) 968232950Stheraven 969232950Stheraventemplate <class _Tp> 970227825Stheravenstruct __is_empty1 971227825Stheraven : public _Tp 972227825Stheraven{ 973242945Stheraven double __lx; 974227825Stheraven}; 975227825Stheraven 976227825Stheravenstruct __is_empty2 977227825Stheraven{ 978242945Stheraven double __lx; 979227825Stheraven}; 980227825Stheraven 981227825Stheraventemplate <class _Tp, bool = is_class<_Tp>::value> 982227825Stheravenstruct __libcpp_empty : public integral_constant<bool, sizeof(__is_empty1<_Tp>) == sizeof(__is_empty2)> {}; 983227825Stheraven 984227825Stheraventemplate <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {}; 985227825Stheraven 986262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_empty : public __libcpp_empty<_Tp> {}; 987227825Stheraven 988232950Stheraven#endif // __has_feature(is_empty) 989232950Stheraven 990227825Stheraven// is_polymorphic 991227825Stheraven 992278724Sdim#if __has_feature(is_polymorphic) || defined(_LIBCPP_MSVC) 993232950Stheraven 994232950Stheraventemplate <class _Tp> 995262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_polymorphic 996232950Stheraven : public integral_constant<bool, __is_polymorphic(_Tp)> {}; 997232950Stheraven 998232950Stheraven#else 999232950Stheraven 1000249998Sdimtemplate<typename _Tp> char &__is_polymorphic_impl( 1001249998Sdim typename enable_if<sizeof((_Tp*)dynamic_cast<const volatile void*>(declval<_Tp*>())) != 0, 1002249998Sdim int>::type); 1003249998Sdimtemplate<typename _Tp> __two &__is_polymorphic_impl(...); 1004227825Stheraven 1005262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic 1006249998Sdim : public integral_constant<bool, sizeof(__is_polymorphic_impl<_Tp>(0)) == 1> {}; 1007227825Stheraven 1008232950Stheraven#endif // __has_feature(is_polymorphic) 1009232950Stheraven 1010227825Stheraven// has_virtual_destructor 1011227825Stheraven 1012278724Sdim#if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403) 1013227825Stheraven 1014262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor 1015227825Stheraven : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; 1016227825Stheraven 1017278724Sdim#else 1018227825Stheraven 1019262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor 1020227825Stheraven : public false_type {}; 1021227825Stheraven 1022278724Sdim#endif 1023227825Stheraven 1024227825Stheraven// alignment_of 1025227825Stheraven 1026262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY alignment_of 1027249998Sdim : public integral_constant<size_t, __alignof__(_Tp)> {}; 1028227825Stheraven 1029227825Stheraven// aligned_storage 1030227825Stheraven 1031227825Stheraventemplate <class _Hp, class _Tp> 1032227825Stheravenstruct __type_list 1033227825Stheraven{ 1034227825Stheraven typedef _Hp _Head; 1035227825Stheraven typedef _Tp _Tail; 1036227825Stheraven}; 1037227825Stheraven 1038227825Stheravenstruct __nat 1039227825Stheraven{ 1040227825Stheraven#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS 1041227825Stheraven __nat() = delete; 1042227825Stheraven __nat(const __nat&) = delete; 1043227825Stheraven __nat& operator=(const __nat&) = delete; 1044227825Stheraven ~__nat() = delete; 1045227825Stheraven#endif 1046227825Stheraven}; 1047227825Stheraven 1048227825Stheraventemplate <class _Tp> 1049227825Stheravenstruct __align_type 1050227825Stheraven{ 1051227825Stheraven static const size_t value = alignment_of<_Tp>::value; 1052227825Stheraven typedef _Tp type; 1053227825Stheraven}; 1054227825Stheraven 1055242945Stheravenstruct __struct_double {long double __lx;}; 1056242945Stheravenstruct __struct_double4 {double __lx[4];}; 1057227825Stheraven 1058227825Stheraventypedef 1059227825Stheraven __type_list<__align_type<unsigned char>, 1060227825Stheraven __type_list<__align_type<unsigned short>, 1061227825Stheraven __type_list<__align_type<unsigned int>, 1062227825Stheraven __type_list<__align_type<unsigned long>, 1063227825Stheraven __type_list<__align_type<unsigned long long>, 1064227825Stheraven __type_list<__align_type<double>, 1065227825Stheraven __type_list<__align_type<long double>, 1066227825Stheraven __type_list<__align_type<__struct_double>, 1067227825Stheraven __type_list<__align_type<__struct_double4>, 1068227825Stheraven __type_list<__align_type<int*>, 1069227825Stheraven __nat 1070227825Stheraven > > > > > > > > > > __all_types; 1071227825Stheraven 1072227825Stheraventemplate <class _TL, size_t _Align> struct __find_pod; 1073227825Stheraven 1074227825Stheraventemplate <class _Hp, size_t _Align> 1075227825Stheravenstruct __find_pod<__type_list<_Hp, __nat>, _Align> 1076227825Stheraven{ 1077227825Stheraven typedef typename conditional< 1078227825Stheraven _Align == _Hp::value, 1079227825Stheraven typename _Hp::type, 1080227825Stheraven void 1081227825Stheraven >::type type; 1082227825Stheraven}; 1083227825Stheraven 1084227825Stheraventemplate <class _Hp, class _Tp, size_t _Align> 1085227825Stheravenstruct __find_pod<__type_list<_Hp, _Tp>, _Align> 1086227825Stheraven{ 1087227825Stheraven typedef typename conditional< 1088227825Stheraven _Align == _Hp::value, 1089227825Stheraven typename _Hp::type, 1090227825Stheraven typename __find_pod<_Tp, _Align>::type 1091227825Stheraven >::type type; 1092227825Stheraven}; 1093227825Stheraven 1094227825Stheraventemplate <class _TL, size_t _Len> struct __find_max_align; 1095227825Stheraven 1096227825Stheraventemplate <class _Hp, size_t _Len> 1097227825Stheravenstruct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {}; 1098227825Stheraven 1099227825Stheraventemplate <size_t _Len, size_t _A1, size_t _A2> 1100227825Stheravenstruct __select_align 1101227825Stheraven{ 1102227825Stheravenprivate: 1103227825Stheraven static const size_t __min = _A2 < _A1 ? _A2 : _A1; 1104227825Stheraven static const size_t __max = _A1 < _A2 ? _A2 : _A1; 1105227825Stheravenpublic: 1106227825Stheraven static const size_t value = _Len < __max ? __min : __max; 1107227825Stheraven}; 1108227825Stheraven 1109227825Stheraventemplate <class _Hp, class _Tp, size_t _Len> 1110227825Stheravenstruct __find_max_align<__type_list<_Hp, _Tp>, _Len> 1111227825Stheraven : public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {}; 1112227825Stheraven 1113253159Stheraventemplate <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> 1114262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY aligned_storage 1115227825Stheraven{ 1116227825Stheraven typedef typename __find_pod<__all_types, _Align>::type _Aligner; 1117227825Stheraven static_assert(!is_void<_Aligner>::value, ""); 1118227825Stheraven union type 1119227825Stheraven { 1120227825Stheraven _Aligner __align; 1121227825Stheraven unsigned char __data[_Len]; 1122227825Stheraven }; 1123227825Stheraven}; 1124227825Stheraven 1125253159Stheraven#if _LIBCPP_STD_VER > 11 1126253159Stheraventemplate <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> 1127253159Stheraven using aligned_storage_t = typename aligned_storage<_Len, _Align>::type; 1128253159Stheraven#endif 1129253159Stheraven 1130227825Stheraven#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ 1131227825Stheraventemplate <size_t _Len>\ 1132262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY aligned_storage<_Len, n>\ 1133227825Stheraven{\ 1134227825Stheraven struct _ALIGNAS(n) type\ 1135227825Stheraven {\ 1136242945Stheraven unsigned char __lx[_Len];\ 1137227825Stheraven };\ 1138227825Stheraven} 1139227825Stheraven 1140227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1); 1141227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2); 1142227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4); 1143227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x8); 1144227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x10); 1145227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x20); 1146227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x40); 1147227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x80); 1148227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x100); 1149227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x200); 1150227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x400); 1151227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x800); 1152227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1000); 1153227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2000); 1154227825Stheraven// MSDN says that MSVC does not support alignment beyond 8192 (=0x2000) 1155262801Sdim#if !defined(_LIBCPP_MSVC) 1156227825Stheraven_CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x4000); 1157262801Sdim#endif // !_LIBCPP_MSVC 1158227825Stheraven 1159227825Stheraven#undef _CREATE_ALIGNED_STORAGE_SPECIALIZATION 1160227825Stheraven 1161249998Sdim#ifndef _LIBCPP_HAS_NO_VARIADICS 1162249998Sdim 1163249998Sdim// aligned_union 1164249998Sdim 1165249998Sdimtemplate <size_t _I0, size_t ..._In> 1166249998Sdimstruct __static_max; 1167249998Sdim 1168249998Sdimtemplate <size_t _I0> 1169249998Sdimstruct __static_max<_I0> 1170249998Sdim{ 1171249998Sdim static const size_t value = _I0; 1172249998Sdim}; 1173249998Sdim 1174249998Sdimtemplate <size_t _I0, size_t _I1, size_t ..._In> 1175249998Sdimstruct __static_max<_I0, _I1, _In...> 1176249998Sdim{ 1177249998Sdim static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value : 1178249998Sdim __static_max<_I1, _In...>::value; 1179249998Sdim}; 1180249998Sdim 1181249998Sdimtemplate <size_t _Len, class _Type0, class ..._Types> 1182249998Sdimstruct aligned_union 1183249998Sdim{ 1184249998Sdim static const size_t alignment_value = __static_max<__alignof__(_Type0), 1185249998Sdim __alignof__(_Types)...>::value; 1186249998Sdim static const size_t __len = __static_max<_Len, sizeof(_Type0), 1187249998Sdim sizeof(_Types)...>::value; 1188249998Sdim typedef typename aligned_storage<__len, alignment_value>::type type; 1189249998Sdim}; 1190249998Sdim 1191253159Stheraven#if _LIBCPP_STD_VER > 11 1192253159Stheraventemplate <size_t _Len, class ..._Types> using aligned_union_t = typename aligned_union<_Len, _Types...>::type; 1193253159Stheraven#endif 1194253159Stheraven 1195249998Sdim#endif // _LIBCPP_HAS_NO_VARIADICS 1196249998Sdim 1197278724Sdimtemplate <class _Tp> 1198278724Sdimstruct __numeric_type 1199278724Sdim{ 1200278724Sdim static void __test(...); 1201278724Sdim static float __test(float); 1202278724Sdim static double __test(char); 1203278724Sdim static double __test(int); 1204278724Sdim static double __test(unsigned); 1205278724Sdim static double __test(long); 1206278724Sdim static double __test(unsigned long); 1207278724Sdim static double __test(long long); 1208278724Sdim static double __test(unsigned long long); 1209278724Sdim static double __test(double); 1210278724Sdim static long double __test(long double); 1211278724Sdim 1212278724Sdim typedef decltype(__test(declval<_Tp>())) type; 1213278724Sdim static const bool value = !is_same<type, void>::value; 1214278724Sdim}; 1215278724Sdim 1216278724Sdimtemplate <> 1217278724Sdimstruct __numeric_type<void> 1218278724Sdim{ 1219278724Sdim static const bool value = true; 1220278724Sdim}; 1221278724Sdim 1222227825Stheraven// __promote 1223227825Stheraven 1224227825Stheraventemplate <class _A1, class _A2 = void, class _A3 = void, 1225278724Sdim bool = __numeric_type<_A1>::value && 1226278724Sdim __numeric_type<_A2>::value && 1227278724Sdim __numeric_type<_A3>::value> 1228278724Sdimclass __promote_imp 1229278724Sdim{ 1230278724Sdimpublic: 1231278724Sdim static const bool value = false; 1232278724Sdim}; 1233227825Stheraven 1234227825Stheraventemplate <class _A1, class _A2, class _A3> 1235278724Sdimclass __promote_imp<_A1, _A2, _A3, true> 1236227825Stheraven{ 1237227825Stheravenprivate: 1238278724Sdim typedef typename __promote_imp<_A1>::type __type1; 1239278724Sdim typedef typename __promote_imp<_A2>::type __type2; 1240278724Sdim typedef typename __promote_imp<_A3>::type __type3; 1241227825Stheravenpublic: 1242227825Stheraven typedef decltype(__type1() + __type2() + __type3()) type; 1243278724Sdim static const bool value = true; 1244227825Stheraven}; 1245227825Stheraven 1246227825Stheraventemplate <class _A1, class _A2> 1247278724Sdimclass __promote_imp<_A1, _A2, void, true> 1248227825Stheraven{ 1249227825Stheravenprivate: 1250278724Sdim typedef typename __promote_imp<_A1>::type __type1; 1251278724Sdim typedef typename __promote_imp<_A2>::type __type2; 1252227825Stheravenpublic: 1253227825Stheraven typedef decltype(__type1() + __type2()) type; 1254278724Sdim static const bool value = true; 1255227825Stheraven}; 1256227825Stheraven 1257227825Stheraventemplate <class _A1> 1258278724Sdimclass __promote_imp<_A1, void, void, true> 1259227825Stheraven{ 1260227825Stheravenpublic: 1261278724Sdim typedef typename __numeric_type<_A1>::type type; 1262278724Sdim static const bool value = true; 1263227825Stheraven}; 1264227825Stheraven 1265278724Sdimtemplate <class _A1, class _A2 = void, class _A3 = void> 1266278724Sdimclass __promote : public __promote_imp<_A1, _A2, _A3> {}; 1267278724Sdim 1268227825Stheraven#ifdef _LIBCPP_STORE_AS_OPTIMIZATION 1269227825Stheraven 1270227825Stheraven// __transform 1271227825Stheraven 1272227825Stheraventemplate <class _Tp, size_t = sizeof(_Tp), bool = is_scalar<_Tp>::value> struct __transform {typedef _Tp type;}; 1273227825Stheraventemplate <class _Tp> struct __transform<_Tp, 1, true> {typedef unsigned char type;}; 1274227825Stheraventemplate <class _Tp> struct __transform<_Tp, 2, true> {typedef unsigned short type;}; 1275227825Stheraventemplate <class _Tp> struct __transform<_Tp, 4, true> {typedef unsigned int type;}; 1276227825Stheraventemplate <class _Tp> struct __transform<_Tp, 8, true> {typedef unsigned long long type;}; 1277227825Stheraven 1278227825Stheraven#endif // _LIBCPP_STORE_AS_OPTIMIZATION 1279227825Stheraven 1280227825Stheraven// make_signed / make_unsigned 1281227825Stheraven 1282227825Stheraventypedef 1283227825Stheraven __type_list<signed char, 1284227825Stheraven __type_list<signed short, 1285227825Stheraven __type_list<signed int, 1286227825Stheraven __type_list<signed long, 1287227825Stheraven __type_list<signed long long, 1288278724Sdim#ifndef _LIBCPP_HAS_NO_INT128 1289278724Sdim __type_list<__int128_t, 1290278724Sdim#endif 1291227825Stheraven __nat 1292278724Sdim#ifndef _LIBCPP_HAS_NO_INT128 1293278724Sdim > 1294278724Sdim#endif 1295227825Stheraven > > > > > __signed_types; 1296227825Stheraven 1297227825Stheraventypedef 1298227825Stheraven __type_list<unsigned char, 1299227825Stheraven __type_list<unsigned short, 1300227825Stheraven __type_list<unsigned int, 1301227825Stheraven __type_list<unsigned long, 1302227825Stheraven __type_list<unsigned long long, 1303278724Sdim#ifndef _LIBCPP_HAS_NO_INT128 1304278724Sdim __type_list<__uint128_t, 1305278724Sdim#endif 1306227825Stheraven __nat 1307278724Sdim#ifndef _LIBCPP_HAS_NO_INT128 1308278724Sdim > 1309278724Sdim#endif 1310227825Stheraven > > > > > __unsigned_types; 1311227825Stheraven 1312227825Stheraventemplate <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first; 1313227825Stheraven 1314227825Stheraventemplate <class _Hp, class _Tp, size_t _Size> 1315227825Stheravenstruct __find_first<__type_list<_Hp, _Tp>, _Size, true> 1316227825Stheraven{ 1317227825Stheraven typedef _Hp type; 1318227825Stheraven}; 1319227825Stheraven 1320227825Stheraventemplate <class _Hp, class _Tp, size_t _Size> 1321227825Stheravenstruct __find_first<__type_list<_Hp, _Tp>, _Size, false> 1322227825Stheraven{ 1323227825Stheraven typedef typename __find_first<_Tp, _Size>::type type; 1324227825Stheraven}; 1325227825Stheraven 1326227825Stheraventemplate <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value, 1327227825Stheraven bool = is_volatile<typename remove_reference<_Tp>::type>::value> 1328227825Stheravenstruct __apply_cv 1329227825Stheraven{ 1330227825Stheraven typedef _Up type; 1331227825Stheraven}; 1332227825Stheraven 1333227825Stheraventemplate <class _Tp, class _Up> 1334227825Stheravenstruct __apply_cv<_Tp, _Up, true, false> 1335227825Stheraven{ 1336227825Stheraven typedef const _Up type; 1337227825Stheraven}; 1338227825Stheraven 1339227825Stheraventemplate <class _Tp, class _Up> 1340227825Stheravenstruct __apply_cv<_Tp, _Up, false, true> 1341227825Stheraven{ 1342227825Stheraven typedef volatile _Up type; 1343227825Stheraven}; 1344227825Stheraven 1345227825Stheraventemplate <class _Tp, class _Up> 1346227825Stheravenstruct __apply_cv<_Tp, _Up, true, true> 1347227825Stheraven{ 1348227825Stheraven typedef const volatile _Up type; 1349227825Stheraven}; 1350227825Stheraven 1351227825Stheraventemplate <class _Tp, class _Up> 1352227825Stheravenstruct __apply_cv<_Tp&, _Up, false, false> 1353227825Stheraven{ 1354227825Stheraven typedef _Up& type; 1355227825Stheraven}; 1356227825Stheraven 1357227825Stheraventemplate <class _Tp, class _Up> 1358227825Stheravenstruct __apply_cv<_Tp&, _Up, true, false> 1359227825Stheraven{ 1360227825Stheraven typedef const _Up& type; 1361227825Stheraven}; 1362227825Stheraven 1363227825Stheraventemplate <class _Tp, class _Up> 1364227825Stheravenstruct __apply_cv<_Tp&, _Up, false, true> 1365227825Stheraven{ 1366227825Stheraven typedef volatile _Up& type; 1367227825Stheraven}; 1368227825Stheraven 1369227825Stheraventemplate <class _Tp, class _Up> 1370227825Stheravenstruct __apply_cv<_Tp&, _Up, true, true> 1371227825Stheraven{ 1372227825Stheraven typedef const volatile _Up& type; 1373227825Stheraven}; 1374227825Stheraven 1375227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1376227825Stheravenstruct __make_signed {}; 1377227825Stheraven 1378227825Stheraventemplate <class _Tp> 1379227825Stheravenstruct __make_signed<_Tp, true> 1380227825Stheraven{ 1381227825Stheraven typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type; 1382227825Stheraven}; 1383227825Stheraven 1384227825Stheraventemplate <> struct __make_signed<bool, true> {}; 1385227825Stheraventemplate <> struct __make_signed< signed short, true> {typedef short type;}; 1386227825Stheraventemplate <> struct __make_signed<unsigned short, true> {typedef short type;}; 1387227825Stheraventemplate <> struct __make_signed< signed int, true> {typedef int type;}; 1388227825Stheraventemplate <> struct __make_signed<unsigned int, true> {typedef int type;}; 1389227825Stheraventemplate <> struct __make_signed< signed long, true> {typedef long type;}; 1390227825Stheraventemplate <> struct __make_signed<unsigned long, true> {typedef long type;}; 1391227825Stheraventemplate <> struct __make_signed< signed long long, true> {typedef long long type;}; 1392227825Stheraventemplate <> struct __make_signed<unsigned long long, true> {typedef long long type;}; 1393278724Sdim#ifndef _LIBCPP_HAS_NO_INT128 1394278724Sdimtemplate <> struct __make_signed<__int128_t, true> {typedef __int128_t type;}; 1395278724Sdimtemplate <> struct __make_signed<__uint128_t, true> {typedef __int128_t type;}; 1396278724Sdim#endif 1397227825Stheraven 1398227825Stheraventemplate <class _Tp> 1399262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY make_signed 1400227825Stheraven{ 1401227825Stheraven typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type; 1402227825Stheraven}; 1403227825Stheraven 1404253159Stheraven#if _LIBCPP_STD_VER > 11 1405253159Stheraventemplate <class _Tp> using make_signed_t = typename make_signed<_Tp>::type; 1406253159Stheraven#endif 1407253159Stheraven 1408227825Stheraventemplate <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value> 1409227825Stheravenstruct __make_unsigned {}; 1410227825Stheraven 1411227825Stheraventemplate <class _Tp> 1412227825Stheravenstruct __make_unsigned<_Tp, true> 1413227825Stheraven{ 1414227825Stheraven typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type; 1415227825Stheraven}; 1416227825Stheraven 1417227825Stheraventemplate <> struct __make_unsigned<bool, true> {}; 1418227825Stheraventemplate <> struct __make_unsigned< signed short, true> {typedef unsigned short type;}; 1419227825Stheraventemplate <> struct __make_unsigned<unsigned short, true> {typedef unsigned short type;}; 1420227825Stheraventemplate <> struct __make_unsigned< signed int, true> {typedef unsigned int type;}; 1421227825Stheraventemplate <> struct __make_unsigned<unsigned int, true> {typedef unsigned int type;}; 1422227825Stheraventemplate <> struct __make_unsigned< signed long, true> {typedef unsigned long type;}; 1423227825Stheraventemplate <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;}; 1424227825Stheraventemplate <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;}; 1425227825Stheraventemplate <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;}; 1426278724Sdim#ifndef _LIBCPP_HAS_NO_INT128 1427278724Sdimtemplate <> struct __make_unsigned<__int128_t, true> {typedef __uint128_t type;}; 1428278724Sdimtemplate <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_t type;}; 1429278724Sdim#endif 1430227825Stheraven 1431227825Stheraventemplate <class _Tp> 1432262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY make_unsigned 1433227825Stheraven{ 1434227825Stheraven typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type; 1435227825Stheraven}; 1436227825Stheraven 1437253159Stheraven#if _LIBCPP_STD_VER > 11 1438253159Stheraventemplate <class _Tp> using make_unsigned_t = typename make_unsigned<_Tp>::type; 1439253159Stheraven#endif 1440253159Stheraven 1441227825Stheraven#ifdef _LIBCPP_HAS_NO_VARIADICS 1442227825Stheraven 1443227825Stheraventemplate <class _Tp, class _Up = void, class V = void> 1444262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type 1445227825Stheraven{ 1446227825Stheravenpublic: 1447227825Stheraven typedef typename common_type<typename common_type<_Tp, _Up>::type, V>::type type; 1448227825Stheraven}; 1449227825Stheraven 1450227825Stheraventemplate <class _Tp> 1451262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, void, void> 1452227825Stheraven{ 1453227825Stheravenpublic: 1454278724Sdim typedef typename decay<_Tp>::type type; 1455227825Stheraven}; 1456227825Stheraven 1457227825Stheraventemplate <class _Tp, class _Up> 1458262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, void> 1459227825Stheraven{ 1460227825Stheravenprivate: 1461227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1462227825Stheraven static _Tp&& __t(); 1463227825Stheraven static _Up&& __u(); 1464227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1465227825Stheraven static _Tp __t(); 1466227825Stheraven static _Up __u(); 1467227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1468227825Stheravenpublic: 1469232950Stheraven typedef typename remove_reference<decltype(true ? __t() : __u())>::type type; 1470227825Stheraven}; 1471227825Stheraven 1472227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1473227825Stheraven 1474227825Stheraventemplate <class ..._Tp> struct common_type; 1475227825Stheraven 1476227825Stheraventemplate <class _Tp> 1477262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp> 1478227825Stheraven{ 1479262801Sdim typedef typename decay<_Tp>::type type; 1480227825Stheraven}; 1481227825Stheraven 1482227825Stheraventemplate <class _Tp, class _Up> 1483262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up> 1484227825Stheraven{ 1485227825Stheravenprivate: 1486227825Stheraven static _Tp&& __t(); 1487227825Stheraven static _Up&& __u(); 1488227825Stheraven static bool __f(); 1489227825Stheravenpublic: 1490262801Sdim typedef typename decay<decltype(__f() ? __t() : __u())>::type type; 1491227825Stheraven}; 1492227825Stheraven 1493227825Stheraventemplate <class _Tp, class _Up, class ..._Vp> 1494262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, _Vp...> 1495227825Stheraven{ 1496227825Stheraven typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type; 1497227825Stheraven}; 1498227825Stheraven 1499253159Stheraven#if _LIBCPP_STD_VER > 11 1500253159Stheraventemplate <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type; 1501253159Stheraven#endif 1502253159Stheraven 1503227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 1504227825Stheraven 1505227825Stheraven// is_assignable 1506227825Stheraven 1507262801Sdimtemplate<typename, typename _Tp> struct __select_2nd { typedef _Tp type; }; 1508262801Sdim 1509227825Stheraventemplate <class _Tp, class _Arg> 1510262801Sdimtypename __select_2nd<decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>())), true_type>::type 1511227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1512227825Stheraven__is_assignable_test(_Tp&&, _Arg&&); 1513227825Stheraven#else 1514227825Stheraven__is_assignable_test(_Tp, _Arg&); 1515227825Stheraven#endif 1516227825Stheraven 1517227825Stheraventemplate <class _Arg> 1518227825Stheravenfalse_type 1519227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1520227825Stheraven__is_assignable_test(__any, _Arg&&); 1521227825Stheraven#else 1522227825Stheraven__is_assignable_test(__any, _Arg&); 1523227825Stheraven#endif 1524227825Stheraven 1525227825Stheraventemplate <class _Tp, class _Arg, bool = is_void<_Tp>::value || is_void<_Arg>::value> 1526227825Stheravenstruct __is_assignable_imp 1527227825Stheraven : public common_type 1528227825Stheraven < 1529227825Stheraven decltype(__is_assignable_test(declval<_Tp>(), declval<_Arg>())) 1530227825Stheraven >::type {}; 1531227825Stheraven 1532227825Stheraventemplate <class _Tp, class _Arg> 1533227825Stheravenstruct __is_assignable_imp<_Tp, _Arg, true> 1534227825Stheraven : public false_type 1535227825Stheraven{ 1536227825Stheraven}; 1537227825Stheraven 1538227825Stheraventemplate <class _Tp, class _Arg> 1539227825Stheravenstruct is_assignable 1540227825Stheraven : public __is_assignable_imp<_Tp, _Arg> {}; 1541227825Stheraven 1542227825Stheraven// is_copy_assignable 1543227825Stheraven 1544262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_copy_assignable 1545227825Stheraven : public is_assignable<typename add_lvalue_reference<_Tp>::type, 1546278724Sdim typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 1547227825Stheraven 1548227825Stheraven// is_move_assignable 1549227825Stheraven 1550262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_move_assignable 1551227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1552227825Stheraven : public is_assignable<typename add_lvalue_reference<_Tp>::type, 1553227825Stheraven const typename add_rvalue_reference<_Tp>::type> {}; 1554227825Stheraven#else 1555227825Stheraven : public is_copy_assignable<_Tp> {}; 1556227825Stheraven#endif 1557227825Stheraven 1558227825Stheraven// is_destructible 1559227825Stheraven 1560278724Sdim// if it's a reference, return true 1561278724Sdim// if it's a function, return false 1562278724Sdim// if it's void, return false 1563278724Sdim// if it's an array of unknown bound, return false 1564278724Sdim// Otherwise, return "std::declval<_Up&>().~_Up()" is well-formed 1565278724Sdim// where _Up is remove_all_extents<_Tp>::type 1566278724Sdim 1567278724Sdimtemplate <class> 1568278724Sdimstruct __is_destructible_apply { typedef int type; }; 1569278724Sdim 1570278724Sdimtemplate <typename _Tp> 1571278724Sdimstruct __is_destructor_wellformed { 1572278724Sdim template <typename _Tp1> 1573278724Sdim static char __test ( 1574278724Sdim typename __is_destructible_apply<decltype(_VSTD::declval<_Tp1&>().~_Tp1())>::type 1575278724Sdim ); 1576278724Sdim 1577278724Sdim template <typename _Tp1> 1578278724Sdim static __two __test (...); 1579278724Sdim 1580278724Sdim static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char); 1581227825Stheraven}; 1582227825Stheraven 1583278724Sdimtemplate <class _Tp, bool> 1584278724Sdimstruct __destructible_imp; 1585278724Sdim 1586227825Stheraventemplate <class _Tp> 1587278724Sdimstruct __destructible_imp<_Tp, false> 1588278724Sdim : public _VSTD::integral_constant<bool, 1589278724Sdim __is_destructor_wellformed<typename _VSTD::remove_all_extents<_Tp>::type>::value> {}; 1590227825Stheraven 1591278724Sdimtemplate <class _Tp> 1592278724Sdimstruct __destructible_imp<_Tp, true> 1593278724Sdim : public _VSTD::true_type {}; 1594227825Stheraven 1595278724Sdimtemplate <class _Tp, bool> 1596278724Sdimstruct __destructible_false; 1597227825Stheraven 1598227825Stheraventemplate <class _Tp> 1599278724Sdimstruct __destructible_false<_Tp, false> : public __destructible_imp<_Tp, _VSTD::is_reference<_Tp>::value> {}; 1600227825Stheraven 1601227825Stheraventemplate <class _Tp> 1602278724Sdimstruct __destructible_false<_Tp, true> : public _VSTD::false_type {}; 1603278724Sdim 1604278724Sdimtemplate <class _Tp> 1605227825Stheravenstruct is_destructible 1606278724Sdim : public __destructible_false<_Tp, _VSTD::is_function<_Tp>::value> {}; 1607227825Stheraven 1608262801Sdimtemplate <class _Tp> 1609262801Sdimstruct is_destructible<_Tp[]> 1610278724Sdim : public _VSTD::false_type {}; 1611262801Sdim 1612278724Sdimtemplate <> 1613278724Sdimstruct is_destructible<void> 1614278724Sdim : public _VSTD::false_type {}; 1615278724Sdim 1616227825Stheraven// move 1617227825Stheraven 1618227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1619227825Stheraven 1620227825Stheraventemplate <class _Tp> 1621262801Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1622227825Stheraventypename remove_reference<_Tp>::type&& 1623227825Stheravenmove(_Tp&& __t) _NOEXCEPT 1624227825Stheraven{ 1625227825Stheraven typedef typename remove_reference<_Tp>::type _Up; 1626227825Stheraven return static_cast<_Up&&>(__t); 1627227825Stheraven} 1628227825Stheraven 1629227825Stheraventemplate <class _Tp> 1630262801Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1631227825Stheraven_Tp&& 1632227825Stheravenforward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT 1633227825Stheraven{ 1634227825Stheraven return static_cast<_Tp&&>(__t); 1635227825Stheraven} 1636227825Stheraven 1637227825Stheraventemplate <class _Tp> 1638262801Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1639227825Stheraven_Tp&& 1640227825Stheravenforward(typename std::remove_reference<_Tp>::type&& __t) _NOEXCEPT 1641227825Stheraven{ 1642227825Stheraven static_assert(!std::is_lvalue_reference<_Tp>::value, 1643227825Stheraven "Can not forward an rvalue as an lvalue."); 1644227825Stheraven return static_cast<_Tp&&>(__t); 1645227825Stheraven} 1646227825Stheraven 1647227825Stheraven#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1648227825Stheraven 1649227825Stheraventemplate <class _Tp> 1650227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1651234976Stheraven_Tp& 1652227825Stheravenmove(_Tp& __t) 1653227825Stheraven{ 1654227825Stheraven return __t; 1655227825Stheraven} 1656227825Stheraven 1657227825Stheraventemplate <class _Tp> 1658227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1659234976Stheravenconst _Tp& 1660232950Stheravenmove(const _Tp& __t) 1661232950Stheraven{ 1662232950Stheraven return __t; 1663232950Stheraven} 1664232950Stheraven 1665232950Stheraventemplate <class _Tp> 1666232950Stheraveninline _LIBCPP_INLINE_VISIBILITY 1667234976Stheraven_Tp& 1668234976Stheravenforward(typename std::remove_reference<_Tp>::type& __t) _NOEXCEPT 1669227825Stheraven{ 1670227825Stheraven return __t; 1671227825Stheraven} 1672227825Stheraven 1673227825Stheraven 1674234976Stheraventemplate <class _Tp> 1675234976Stheravenclass __rv 1676227825Stheraven{ 1677234976Stheraven typedef typename remove_reference<_Tp>::type _Trr; 1678234976Stheraven _Trr& t_; 1679234976Stheravenpublic: 1680234976Stheraven _LIBCPP_INLINE_VISIBILITY 1681234976Stheraven _Trr* operator->() {return &t_;} 1682234976Stheraven _LIBCPP_INLINE_VISIBILITY 1683234976Stheraven explicit __rv(_Trr& __t) : t_(__t) {} 1684234976Stheraven}; 1685227825Stheraven 1686227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 1687227825Stheraven 1688227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1689227825Stheraven 1690227825Stheraventemplate <class _Tp> 1691227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1692227825Stheraventypename decay<_Tp>::type 1693227825Stheraven__decay_copy(_Tp&& __t) 1694227825Stheraven{ 1695227825Stheraven return _VSTD::forward<_Tp>(__t); 1696227825Stheraven} 1697227825Stheraven 1698227825Stheraven#else 1699227825Stheraven 1700227825Stheraventemplate <class _Tp> 1701227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 1702227825Stheraventypename decay<_Tp>::type 1703227825Stheraven__decay_copy(const _Tp& __t) 1704227825Stheraven{ 1705227825Stheraven return _VSTD::forward<_Tp>(__t); 1706227825Stheraven} 1707227825Stheraven 1708227825Stheraven#endif 1709227825Stheraven 1710227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 1711227825Stheraven 1712232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1713232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> 1714227825Stheraven{ 1715227825Stheraven typedef _Class _ClassType; 1716232950Stheraven typedef _Rp _ReturnType; 1717275472Sdim typedef _Rp (_FnType) (_Param...); 1718227825Stheraven}; 1719227825Stheraven 1720232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1721278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false> 1722278724Sdim{ 1723278724Sdim typedef _Class _ClassType; 1724278724Sdim typedef _Rp _ReturnType; 1725278724Sdim typedef _Rp (_FnType) (_Param..., ...); 1726278724Sdim}; 1727278724Sdim 1728278724Sdimtemplate <class _Rp, class _Class, class ..._Param> 1729232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> 1730227825Stheraven{ 1731227825Stheraven typedef _Class const _ClassType; 1732232950Stheraven typedef _Rp _ReturnType; 1733275472Sdim typedef _Rp (_FnType) (_Param...); 1734227825Stheraven}; 1735227825Stheraven 1736232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1737278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false> 1738278724Sdim{ 1739278724Sdim typedef _Class const _ClassType; 1740278724Sdim typedef _Rp _ReturnType; 1741278724Sdim typedef _Rp (_FnType) (_Param..., ...); 1742278724Sdim}; 1743278724Sdim 1744278724Sdimtemplate <class _Rp, class _Class, class ..._Param> 1745232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> 1746227825Stheraven{ 1747227825Stheraven typedef _Class volatile _ClassType; 1748232950Stheraven typedef _Rp _ReturnType; 1749275472Sdim typedef _Rp (_FnType) (_Param...); 1750227825Stheraven}; 1751227825Stheraven 1752232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1753278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false> 1754278724Sdim{ 1755278724Sdim typedef _Class volatile _ClassType; 1756278724Sdim typedef _Rp _ReturnType; 1757278724Sdim typedef _Rp (_FnType) (_Param..., ...); 1758278724Sdim}; 1759278724Sdim 1760278724Sdimtemplate <class _Rp, class _Class, class ..._Param> 1761232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> 1762227825Stheraven{ 1763227825Stheraven typedef _Class const volatile _ClassType; 1764232950Stheraven typedef _Rp _ReturnType; 1765275472Sdim typedef _Rp (_FnType) (_Param...); 1766227825Stheraven}; 1767227825Stheraven 1768278724Sdimtemplate <class _Rp, class _Class, class ..._Param> 1769278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false> 1770278724Sdim{ 1771278724Sdim typedef _Class const volatile _ClassType; 1772278724Sdim typedef _Rp _ReturnType; 1773278724Sdim typedef _Rp (_FnType) (_Param..., ...); 1774278724Sdim}; 1775278724Sdim 1776227825Stheraven#if __has_feature(cxx_reference_qualified_functions) 1777227825Stheraven 1778232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1779232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> 1780227825Stheraven{ 1781227825Stheraven typedef _Class& _ClassType; 1782232950Stheraven typedef _Rp _ReturnType; 1783275472Sdim typedef _Rp (_FnType) (_Param...); 1784227825Stheraven}; 1785227825Stheraven 1786232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1787278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false> 1788278724Sdim{ 1789278724Sdim typedef _Class& _ClassType; 1790278724Sdim typedef _Rp _ReturnType; 1791278724Sdim typedef _Rp (_FnType) (_Param..., ...); 1792278724Sdim}; 1793278724Sdim 1794278724Sdimtemplate <class _Rp, class _Class, class ..._Param> 1795232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> 1796227825Stheraven{ 1797227825Stheraven typedef _Class const& _ClassType; 1798232950Stheraven typedef _Rp _ReturnType; 1799275472Sdim typedef _Rp (_FnType) (_Param...); 1800227825Stheraven}; 1801227825Stheraven 1802232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1803278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false> 1804278724Sdim{ 1805278724Sdim typedef _Class const& _ClassType; 1806278724Sdim typedef _Rp _ReturnType; 1807278724Sdim typedef _Rp (_FnType) (_Param..., ...); 1808278724Sdim}; 1809278724Sdim 1810278724Sdimtemplate <class _Rp, class _Class, class ..._Param> 1811232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> 1812227825Stheraven{ 1813227825Stheraven typedef _Class volatile& _ClassType; 1814232950Stheraven typedef _Rp _ReturnType; 1815275472Sdim typedef _Rp (_FnType) (_Param...); 1816227825Stheraven}; 1817227825Stheraven 1818232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1819278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false> 1820278724Sdim{ 1821278724Sdim typedef _Class volatile& _ClassType; 1822278724Sdim typedef _Rp _ReturnType; 1823278724Sdim typedef _Rp (_FnType) (_Param..., ...); 1824278724Sdim}; 1825278724Sdim 1826278724Sdimtemplate <class _Rp, class _Class, class ..._Param> 1827232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> 1828227825Stheraven{ 1829227825Stheraven typedef _Class const volatile& _ClassType; 1830232950Stheraven typedef _Rp _ReturnType; 1831275472Sdim typedef _Rp (_FnType) (_Param...); 1832227825Stheraven}; 1833227825Stheraven 1834232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1835278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false> 1836278724Sdim{ 1837278724Sdim typedef _Class const volatile& _ClassType; 1838278724Sdim typedef _Rp _ReturnType; 1839278724Sdim typedef _Rp (_FnType) (_Param..., ...); 1840278724Sdim}; 1841278724Sdim 1842278724Sdimtemplate <class _Rp, class _Class, class ..._Param> 1843232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false> 1844227825Stheraven{ 1845227825Stheraven typedef _Class&& _ClassType; 1846232950Stheraven typedef _Rp _ReturnType; 1847275472Sdim typedef _Rp (_FnType) (_Param...); 1848227825Stheraven}; 1849227825Stheraven 1850232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1851278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false> 1852278724Sdim{ 1853278724Sdim typedef _Class&& _ClassType; 1854278724Sdim typedef _Rp _ReturnType; 1855278724Sdim typedef _Rp (_FnType) (_Param..., ...); 1856278724Sdim}; 1857278724Sdim 1858278724Sdimtemplate <class _Rp, class _Class, class ..._Param> 1859232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> 1860227825Stheraven{ 1861227825Stheraven typedef _Class const&& _ClassType; 1862232950Stheraven typedef _Rp _ReturnType; 1863275472Sdim typedef _Rp (_FnType) (_Param...); 1864227825Stheraven}; 1865227825Stheraven 1866232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1867278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false> 1868278724Sdim{ 1869278724Sdim typedef _Class const&& _ClassType; 1870278724Sdim typedef _Rp _ReturnType; 1871278724Sdim typedef _Rp (_FnType) (_Param..., ...); 1872278724Sdim}; 1873278724Sdim 1874278724Sdimtemplate <class _Rp, class _Class, class ..._Param> 1875232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> 1876227825Stheraven{ 1877227825Stheraven typedef _Class volatile&& _ClassType; 1878232950Stheraven typedef _Rp _ReturnType; 1879275472Sdim typedef _Rp (_FnType) (_Param...); 1880227825Stheraven}; 1881227825Stheraven 1882232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 1883278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false> 1884278724Sdim{ 1885278724Sdim typedef _Class volatile&& _ClassType; 1886278724Sdim typedef _Rp _ReturnType; 1887278724Sdim typedef _Rp (_FnType) (_Param..., ...); 1888278724Sdim}; 1889278724Sdim 1890278724Sdimtemplate <class _Rp, class _Class, class ..._Param> 1891232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> 1892227825Stheraven{ 1893227825Stheraven typedef _Class const volatile&& _ClassType; 1894232950Stheraven typedef _Rp _ReturnType; 1895275472Sdim typedef _Rp (_FnType) (_Param...); 1896227825Stheraven}; 1897227825Stheraven 1898278724Sdimtemplate <class _Rp, class _Class, class ..._Param> 1899278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false> 1900278724Sdim{ 1901278724Sdim typedef _Class const volatile&& _ClassType; 1902278724Sdim typedef _Rp _ReturnType; 1903278724Sdim typedef _Rp (_FnType) (_Param..., ...); 1904278724Sdim}; 1905278724Sdim 1906227825Stheraven#endif // __has_feature(cxx_reference_qualified_functions) 1907227825Stheraven 1908227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 1909227825Stheraven 1910232950Stheraventemplate <class _Rp, class _Class> 1911232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false> 1912227825Stheraven{ 1913227825Stheraven typedef _Class _ClassType; 1914232950Stheraven typedef _Rp _ReturnType; 1915275472Sdim typedef _Rp (_FnType) (); 1916227825Stheraven}; 1917227825Stheraven 1918278724Sdimtemplate <class _Rp, class _Class> 1919278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(...), true, false> 1920278724Sdim{ 1921278724Sdim typedef _Class _ClassType; 1922278724Sdim typedef _Rp _ReturnType; 1923278724Sdim typedef _Rp (_FnType) (...); 1924278724Sdim}; 1925278724Sdim 1926232950Stheraventemplate <class _Rp, class _Class, class _P0> 1927232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false> 1928227825Stheraven{ 1929227825Stheraven typedef _Class _ClassType; 1930232950Stheraven typedef _Rp _ReturnType; 1931275472Sdim typedef _Rp (_FnType) (_P0); 1932227825Stheraven}; 1933227825Stheraven 1934278724Sdimtemplate <class _Rp, class _Class, class _P0> 1935278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...), true, false> 1936278724Sdim{ 1937278724Sdim typedef _Class _ClassType; 1938278724Sdim typedef _Rp _ReturnType; 1939278724Sdim typedef _Rp (_FnType) (_P0, ...); 1940278724Sdim}; 1941278724Sdim 1942232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 1943232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false> 1944227825Stheraven{ 1945227825Stheraven typedef _Class _ClassType; 1946232950Stheraven typedef _Rp _ReturnType; 1947275472Sdim typedef _Rp (_FnType) (_P0, _P1); 1948227825Stheraven}; 1949227825Stheraven 1950278724Sdimtemplate <class _Rp, class _Class, class _P0, class _P1> 1951278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...), true, false> 1952278724Sdim{ 1953278724Sdim typedef _Class _ClassType; 1954278724Sdim typedef _Rp _ReturnType; 1955278724Sdim typedef _Rp (_FnType) (_P0, _P1, ...); 1956278724Sdim}; 1957278724Sdim 1958232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1959232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false> 1960227825Stheraven{ 1961227825Stheraven typedef _Class _ClassType; 1962232950Stheraven typedef _Rp _ReturnType; 1963275472Sdim typedef _Rp (_FnType) (_P0, _P1, _P2); 1964227825Stheraven}; 1965227825Stheraven 1966278724Sdimtemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 1967278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...), true, false> 1968278724Sdim{ 1969278724Sdim typedef _Class _ClassType; 1970278724Sdim typedef _Rp _ReturnType; 1971278724Sdim typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 1972278724Sdim}; 1973278724Sdim 1974232950Stheraventemplate <class _Rp, class _Class> 1975232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false> 1976227825Stheraven{ 1977227825Stheraven typedef _Class const _ClassType; 1978232950Stheraven typedef _Rp _ReturnType; 1979275472Sdim typedef _Rp (_FnType) (); 1980227825Stheraven}; 1981227825Stheraven 1982278724Sdimtemplate <class _Rp, class _Class> 1983278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(...) const, true, false> 1984278724Sdim{ 1985278724Sdim typedef _Class const _ClassType; 1986278724Sdim typedef _Rp _ReturnType; 1987278724Sdim typedef _Rp (_FnType) (...); 1988278724Sdim}; 1989278724Sdim 1990232950Stheraventemplate <class _Rp, class _Class, class _P0> 1991232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false> 1992227825Stheraven{ 1993227825Stheraven typedef _Class const _ClassType; 1994232950Stheraven typedef _Rp _ReturnType; 1995275472Sdim typedef _Rp (_FnType) (_P0); 1996227825Stheraven}; 1997227825Stheraven 1998278724Sdimtemplate <class _Rp, class _Class, class _P0> 1999278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const, true, false> 2000278724Sdim{ 2001278724Sdim typedef _Class const _ClassType; 2002278724Sdim typedef _Rp _ReturnType; 2003278724Sdim typedef _Rp (_FnType) (_P0, ...); 2004278724Sdim}; 2005278724Sdim 2006232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 2007232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false> 2008227825Stheraven{ 2009227825Stheraven typedef _Class const _ClassType; 2010232950Stheraven typedef _Rp _ReturnType; 2011275472Sdim typedef _Rp (_FnType) (_P0, _P1); 2012227825Stheraven}; 2013227825Stheraven 2014278724Sdimtemplate <class _Rp, class _Class, class _P0, class _P1> 2015278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const, true, false> 2016278724Sdim{ 2017278724Sdim typedef _Class const _ClassType; 2018278724Sdim typedef _Rp _ReturnType; 2019278724Sdim typedef _Rp (_FnType) (_P0, _P1, ...); 2020278724Sdim}; 2021278724Sdim 2022232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 2023232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false> 2024227825Stheraven{ 2025227825Stheraven typedef _Class const _ClassType; 2026232950Stheraven typedef _Rp _ReturnType; 2027275472Sdim typedef _Rp (_FnType) (_P0, _P1, _P2); 2028227825Stheraven}; 2029227825Stheraven 2030278724Sdimtemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 2031278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const, true, false> 2032278724Sdim{ 2033278724Sdim typedef _Class const _ClassType; 2034278724Sdim typedef _Rp _ReturnType; 2035278724Sdim typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2036278724Sdim}; 2037278724Sdim 2038232950Stheraventemplate <class _Rp, class _Class> 2039232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false> 2040227825Stheraven{ 2041227825Stheraven typedef _Class volatile _ClassType; 2042232950Stheraven typedef _Rp _ReturnType; 2043275472Sdim typedef _Rp (_FnType) (); 2044227825Stheraven}; 2045227825Stheraven 2046278724Sdimtemplate <class _Rp, class _Class> 2047278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(...) volatile, true, false> 2048278724Sdim{ 2049278724Sdim typedef _Class volatile _ClassType; 2050278724Sdim typedef _Rp _ReturnType; 2051278724Sdim typedef _Rp (_FnType) (...); 2052278724Sdim}; 2053278724Sdim 2054232950Stheraventemplate <class _Rp, class _Class, class _P0> 2055232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false> 2056227825Stheraven{ 2057227825Stheraven typedef _Class volatile _ClassType; 2058232950Stheraven typedef _Rp _ReturnType; 2059275472Sdim typedef _Rp (_FnType) (_P0); 2060227825Stheraven}; 2061227825Stheraven 2062278724Sdimtemplate <class _Rp, class _Class, class _P0> 2063278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) volatile, true, false> 2064278724Sdim{ 2065278724Sdim typedef _Class volatile _ClassType; 2066278724Sdim typedef _Rp _ReturnType; 2067278724Sdim typedef _Rp (_FnType) (_P0, ...); 2068278724Sdim}; 2069278724Sdim 2070232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 2071232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false> 2072227825Stheraven{ 2073227825Stheraven typedef _Class volatile _ClassType; 2074232950Stheraven typedef _Rp _ReturnType; 2075275472Sdim typedef _Rp (_FnType) (_P0, _P1); 2076227825Stheraven}; 2077227825Stheraven 2078278724Sdimtemplate <class _Rp, class _Class, class _P0, class _P1> 2079278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) volatile, true, false> 2080278724Sdim{ 2081278724Sdim typedef _Class volatile _ClassType; 2082278724Sdim typedef _Rp _ReturnType; 2083278724Sdim typedef _Rp (_FnType) (_P0, _P1, ...); 2084278724Sdim}; 2085278724Sdim 2086232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 2087232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false> 2088227825Stheraven{ 2089227825Stheraven typedef _Class volatile _ClassType; 2090232950Stheraven typedef _Rp _ReturnType; 2091275472Sdim typedef _Rp (_FnType) (_P0, _P1, _P2); 2092227825Stheraven}; 2093227825Stheraven 2094278724Sdimtemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 2095278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) volatile, true, false> 2096278724Sdim{ 2097278724Sdim typedef _Class volatile _ClassType; 2098278724Sdim typedef _Rp _ReturnType; 2099278724Sdim typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2100278724Sdim}; 2101278724Sdim 2102232950Stheraventemplate <class _Rp, class _Class> 2103232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false> 2104227825Stheraven{ 2105227825Stheraven typedef _Class const volatile _ClassType; 2106232950Stheraven typedef _Rp _ReturnType; 2107275472Sdim typedef _Rp (_FnType) (); 2108227825Stheraven}; 2109227825Stheraven 2110278724Sdimtemplate <class _Rp, class _Class> 2111278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(...) const volatile, true, false> 2112278724Sdim{ 2113278724Sdim typedef _Class const volatile _ClassType; 2114278724Sdim typedef _Rp _ReturnType; 2115278724Sdim typedef _Rp (_FnType) (...); 2116278724Sdim}; 2117278724Sdim 2118232950Stheraventemplate <class _Rp, class _Class, class _P0> 2119232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false> 2120227825Stheraven{ 2121227825Stheraven typedef _Class const volatile _ClassType; 2122232950Stheraven typedef _Rp _ReturnType; 2123275472Sdim typedef _Rp (_FnType) (_P0); 2124227825Stheraven}; 2125227825Stheraven 2126278724Sdimtemplate <class _Rp, class _Class, class _P0> 2127278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, ...) const volatile, true, false> 2128278724Sdim{ 2129278724Sdim typedef _Class const volatile _ClassType; 2130278724Sdim typedef _Rp _ReturnType; 2131278724Sdim typedef _Rp (_FnType) (_P0, ...); 2132278724Sdim}; 2133278724Sdim 2134232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1> 2135232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false> 2136227825Stheraven{ 2137227825Stheraven typedef _Class const volatile _ClassType; 2138232950Stheraven typedef _Rp _ReturnType; 2139275472Sdim typedef _Rp (_FnType) (_P0, _P1); 2140227825Stheraven}; 2141227825Stheraven 2142278724Sdimtemplate <class _Rp, class _Class, class _P0, class _P1> 2143278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, ...) const volatile, true, false> 2144278724Sdim{ 2145278724Sdim typedef _Class const volatile _ClassType; 2146278724Sdim typedef _Rp _ReturnType; 2147278724Sdim typedef _Rp (_FnType) (_P0, _P1, ...); 2148278724Sdim}; 2149278724Sdim 2150232950Stheraventemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 2151232950Stheravenstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false> 2152227825Stheraven{ 2153227825Stheraven typedef _Class const volatile _ClassType; 2154232950Stheraven typedef _Rp _ReturnType; 2155275472Sdim typedef _Rp (_FnType) (_P0, _P1, _P2); 2156227825Stheraven}; 2157227825Stheraven 2158278724Sdimtemplate <class _Rp, class _Class, class _P0, class _P1, class _P2> 2159278724Sdimstruct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2, ...) const volatile, true, false> 2160278724Sdim{ 2161278724Sdim typedef _Class const volatile _ClassType; 2162278724Sdim typedef _Rp _ReturnType; 2163278724Sdim typedef _Rp (_FnType) (_P0, _P1, _P2, ...); 2164278724Sdim}; 2165278724Sdim 2166227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2167227825Stheraven 2168232950Stheraventemplate <class _Rp, class _Class> 2169232950Stheravenstruct __member_pointer_traits_imp<_Rp _Class::*, false, true> 2170227825Stheraven{ 2171227825Stheraven typedef _Class _ClassType; 2172232950Stheraven typedef _Rp _ReturnType; 2173227825Stheraven}; 2174227825Stheraven 2175227825Stheraventemplate <class _MP> 2176227825Stheravenstruct __member_pointer_traits 2177253159Stheraven : public __member_pointer_traits_imp<typename remove_cv<_MP>::type, 2178227825Stheraven is_member_function_pointer<_MP>::value, 2179227825Stheraven is_member_object_pointer<_MP>::value> 2180227825Stheraven{ 2181227825Stheraven// typedef ... _ClassType; 2182227825Stheraven// typedef ... _ReturnType; 2183275472Sdim// typedef ... _FnType; 2184227825Stheraven}; 2185227825Stheraven 2186227825Stheraven// result_of 2187227825Stheraven 2188227825Stheraventemplate <class _Callable> class result_of; 2189227825Stheraven 2190241903Sdim#ifdef _LIBCPP_HAS_NO_VARIADICS 2191241903Sdim 2192227825Stheraventemplate <class _Fn, bool, bool> 2193227825Stheravenclass __result_of 2194227825Stheraven{ 2195227825Stheraven}; 2196227825Stheraven 2197227825Stheraventemplate <class _Fn> 2198227825Stheravenclass __result_of<_Fn(), true, false> 2199227825Stheraven{ 2200227825Stheravenpublic: 2201227825Stheraven typedef decltype(declval<_Fn>()()) type; 2202227825Stheraven}; 2203227825Stheraven 2204227825Stheraventemplate <class _Fn, class _A0> 2205227825Stheravenclass __result_of<_Fn(_A0), true, false> 2206227825Stheraven{ 2207227825Stheravenpublic: 2208227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>())) type; 2209227825Stheraven}; 2210227825Stheraven 2211227825Stheraventemplate <class _Fn, class _A0, class _A1> 2212227825Stheravenclass __result_of<_Fn(_A0, _A1), true, false> 2213227825Stheraven{ 2214227825Stheravenpublic: 2215227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type; 2216227825Stheraven}; 2217227825Stheraven 2218227825Stheraventemplate <class _Fn, class _A0, class _A1, class _A2> 2219227825Stheravenclass __result_of<_Fn(_A0, _A1, _A2), true, false> 2220227825Stheraven{ 2221227825Stheravenpublic: 2222227825Stheraven typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type; 2223227825Stheraven}; 2224227825Stheraven 2225227825Stheraventemplate <class _MP, class _Tp, bool _IsMemberFunctionPtr> 2226227825Stheravenstruct __result_of_mp; 2227227825Stheraven 2228227825Stheraven// member function pointer 2229227825Stheraven 2230227825Stheraventemplate <class _MP, class _Tp> 2231227825Stheravenstruct __result_of_mp<_MP, _Tp, true> 2232227825Stheraven : public common_type<typename __member_pointer_traits<_MP>::_ReturnType> 2233227825Stheraven{ 2234227825Stheraven}; 2235227825Stheraven 2236227825Stheraven// member data pointer 2237227825Stheraven 2238227825Stheraventemplate <class _MP, class _Tp, bool> 2239227825Stheravenstruct __result_of_mdp; 2240227825Stheraven 2241232950Stheraventemplate <class _Rp, class _Class, class _Tp> 2242232950Stheravenstruct __result_of_mdp<_Rp _Class::*, _Tp, false> 2243227825Stheraven{ 2244232950Stheraven typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type; 2245227825Stheraven}; 2246227825Stheraven 2247232950Stheraventemplate <class _Rp, class _Class, class _Tp> 2248232950Stheravenstruct __result_of_mdp<_Rp _Class::*, _Tp, true> 2249227825Stheraven{ 2250232950Stheraven typedef typename __apply_cv<_Tp, _Rp>::type& type; 2251227825Stheraven}; 2252227825Stheraven 2253232950Stheraventemplate <class _Rp, class _Class, class _Tp> 2254232950Stheravenstruct __result_of_mp<_Rp _Class::*, _Tp, false> 2255232950Stheraven : public __result_of_mdp<_Rp _Class::*, _Tp, 2256227825Stheraven is_base_of<_Class, typename remove_reference<_Tp>::type>::value> 2257227825Stheraven{ 2258227825Stheraven}; 2259227825Stheraven 2260227825Stheraven 2261227825Stheraven 2262227825Stheraventemplate <class _Fn, class _Tp> 2263227825Stheravenclass __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer 2264227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 2265227825Stheraven _Tp, 2266227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2267227825Stheraven{ 2268227825Stheraven}; 2269227825Stheraven 2270227825Stheraventemplate <class _Fn, class _Tp, class _A0> 2271227825Stheravenclass __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer 2272227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 2273227825Stheraven _Tp, 2274227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2275227825Stheraven{ 2276227825Stheraven}; 2277227825Stheraven 2278227825Stheraventemplate <class _Fn, class _Tp, class _A0, class _A1> 2279227825Stheravenclass __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer 2280227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 2281227825Stheraven _Tp, 2282227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2283227825Stheraven{ 2284227825Stheraven}; 2285227825Stheraven 2286227825Stheraventemplate <class _Fn, class _Tp, class _A0, class _A1, class _A2> 2287227825Stheravenclass __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer 2288227825Stheraven : public __result_of_mp<typename remove_reference<_Fn>::type, 2289227825Stheraven _Tp, 2290227825Stheraven is_member_function_pointer<typename remove_reference<_Fn>::type>::value> 2291227825Stheraven{ 2292227825Stheraven}; 2293227825Stheraven 2294227825Stheraven// result_of 2295227825Stheraven 2296227825Stheraventemplate <class _Fn> 2297262801Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fn()> 2298227825Stheraven : public __result_of<_Fn(), 2299227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 2300227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 2301227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 2302227825Stheraven > 2303227825Stheraven{ 2304227825Stheraven}; 2305227825Stheraven 2306227825Stheraventemplate <class _Fn, class _A0> 2307262801Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0)> 2308227825Stheraven : public __result_of<_Fn(_A0), 2309227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 2310227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 2311227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 2312227825Stheraven > 2313227825Stheraven{ 2314227825Stheraven}; 2315227825Stheraven 2316227825Stheraventemplate <class _Fn, class _A0, class _A1> 2317262801Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1)> 2318227825Stheraven : public __result_of<_Fn(_A0, _A1), 2319227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 2320227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 2321227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 2322227825Stheraven > 2323227825Stheraven{ 2324227825Stheraven}; 2325227825Stheraven 2326227825Stheraventemplate <class _Fn, class _A0, class _A1, class _A2> 2327262801Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fn(_A0, _A1, _A2)> 2328227825Stheraven : public __result_of<_Fn(_A0, _A1, _A2), 2329227825Stheraven is_class<typename remove_reference<_Fn>::type>::value || 2330227825Stheraven is_function<typename remove_reference<_Fn>::type>::value, 2331227825Stheraven is_member_pointer<typename remove_reference<_Fn>::type>::value 2332227825Stheraven > 2333227825Stheraven{ 2334227825Stheraven}; 2335227825Stheraven 2336227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2337227825Stheraven 2338277299Sdim// template <class T, class... Args> struct is_constructible; 2339277299Sdim 2340277299Sdimnamespace __is_construct 2341277299Sdim{ 2342277299Sdimstruct __nat {}; 2343277299Sdim} 2344277299Sdim 2345277299Sdim#if __has_feature(is_constructible) 2346277299Sdim 2347277299Sdimtemplate <class _Tp, class ..._Args> 2348277299Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible 2349277299Sdim : public integral_constant<bool, __is_constructible(_Tp, _Args...)> 2350277299Sdim {}; 2351277299Sdim 2352277299Sdim#else 2353277299Sdim 2354227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2355227825Stheraven 2356227825Stheraven// main is_constructible test 2357227825Stheraven 2358227825Stheraventemplate <class _Tp, class ..._Args> 2359242945Stheraventypename __select_2nd<decltype(_VSTD::move(_Tp(_VSTD::declval<_Args>()...))), true_type>::type 2360227825Stheraven__is_constructible_test(_Tp&&, _Args&& ...); 2361227825Stheraven 2362227825Stheraventemplate <class ..._Args> 2363227825Stheravenfalse_type 2364227825Stheraven__is_constructible_test(__any, _Args&& ...); 2365227825Stheraven 2366227825Stheraventemplate <bool, class _Tp, class... _Args> 2367277299Sdimstruct __libcpp_is_constructible // false, _Tp is not a scalar 2368227825Stheraven : public common_type 2369227825Stheraven < 2370227825Stheraven decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...)) 2371227825Stheraven >::type 2372227825Stheraven {}; 2373227825Stheraven 2374227825Stheraven// function types are not constructible 2375227825Stheraven 2376232950Stheraventemplate <class _Rp, class... _A1, class... _A2> 2377277299Sdimstruct __libcpp_is_constructible<false, _Rp(_A1...), _A2...> 2378227825Stheraven : public false_type 2379227825Stheraven {}; 2380227825Stheraven 2381227825Stheraven// handle scalars and reference types 2382227825Stheraven 2383227825Stheraven// Scalars are default constructible, references are not 2384227825Stheraven 2385227825Stheraventemplate <class _Tp> 2386277299Sdimstruct __libcpp_is_constructible<true, _Tp> 2387227825Stheraven : public is_scalar<_Tp> 2388227825Stheraven {}; 2389227825Stheraven 2390227825Stheraven// Scalars and references are constructible from one arg if that arg is 2391227825Stheraven// implicitly convertible to the scalar or reference. 2392227825Stheraven 2393227825Stheraventemplate <class _Tp> 2394227825Stheravenstruct __is_constructible_ref 2395227825Stheraven{ 2396242945Stheraven true_type static __lxx(_Tp); 2397242945Stheraven false_type static __lxx(...); 2398227825Stheraven}; 2399227825Stheraven 2400227825Stheraventemplate <class _Tp, class _A0> 2401277299Sdimstruct __libcpp_is_constructible<true, _Tp, _A0> 2402227825Stheraven : public common_type 2403227825Stheraven < 2404242945Stheraven decltype(__is_constructible_ref<_Tp>::__lxx(declval<_A0>())) 2405227825Stheraven >::type 2406227825Stheraven {}; 2407227825Stheraven 2408227825Stheraven// Scalars and references are not constructible from multiple args. 2409227825Stheraven 2410227825Stheraventemplate <class _Tp, class _A0, class ..._Args> 2411277299Sdimstruct __libcpp_is_constructible<true, _Tp, _A0, _Args...> 2412227825Stheraven : public false_type 2413227825Stheraven {}; 2414227825Stheraven 2415227825Stheraven// Treat scalars and reference types separately 2416227825Stheraven 2417227825Stheraventemplate <bool, class _Tp, class... _Args> 2418227825Stheravenstruct __is_constructible_void_check 2419277299Sdim : public __libcpp_is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2420227825Stheraven _Tp, _Args...> 2421227825Stheraven {}; 2422227825Stheraven 2423227825Stheraven// If any of T or Args is void, is_constructible should be false 2424227825Stheraven 2425227825Stheraventemplate <class _Tp, class... _Args> 2426227825Stheravenstruct __is_constructible_void_check<true, _Tp, _Args...> 2427227825Stheraven : public false_type 2428227825Stheraven {}; 2429227825Stheraven 2430227825Stheraventemplate <class ..._Args> struct __contains_void; 2431227825Stheraven 2432227825Stheraventemplate <> struct __contains_void<> : false_type {}; 2433227825Stheraven 2434227825Stheraventemplate <class _A0, class ..._Args> 2435227825Stheravenstruct __contains_void<_A0, _Args...> 2436227825Stheraven{ 2437227825Stheraven static const bool value = is_void<_A0>::value || 2438227825Stheraven __contains_void<_Args...>::value; 2439227825Stheraven}; 2440227825Stheraven 2441227825Stheraven// is_constructible entry point 2442227825Stheraven 2443227825Stheraventemplate <class _Tp, class... _Args> 2444262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible 2445227825Stheraven : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value 2446227825Stheraven || is_abstract<_Tp>::value, 2447227825Stheraven _Tp, _Args...> 2448227825Stheraven {}; 2449227825Stheraven 2450227825Stheraven// Array types are default constructible if their element type 2451227825Stheraven// is default constructible 2452227825Stheraven 2453232950Stheraventemplate <class _Ap, size_t _Np> 2454277299Sdimstruct __libcpp_is_constructible<false, _Ap[_Np]> 2455232950Stheraven : public is_constructible<typename remove_all_extents<_Ap>::type> 2456227825Stheraven {}; 2457227825Stheraven 2458227825Stheraven// Otherwise array types are not constructible by this syntax 2459227825Stheraven 2460232950Stheraventemplate <class _Ap, size_t _Np, class ..._Args> 2461277299Sdimstruct __libcpp_is_constructible<false, _Ap[_Np], _Args...> 2462227825Stheraven : public false_type 2463227825Stheraven {}; 2464227825Stheraven 2465227825Stheraven// Incomplete array types are not constructible 2466227825Stheraven 2467232950Stheraventemplate <class _Ap, class ..._Args> 2468277299Sdimstruct __libcpp_is_constructible<false, _Ap[], _Args...> 2469227825Stheraven : public false_type 2470227825Stheraven {}; 2471227825Stheraven 2472227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2473227825Stheraven 2474227825Stheraven// template <class T> struct is_constructible0; 2475227825Stheraven 2476227825Stheraven// main is_constructible0 test 2477227825Stheraven 2478227825Stheraventemplate <class _Tp> 2479227825Stheravendecltype((_Tp(), true_type())) 2480227825Stheraven__is_constructible0_test(_Tp&); 2481227825Stheraven 2482227825Stheravenfalse_type 2483227825Stheraven__is_constructible0_test(__any); 2484227825Stheraven 2485227825Stheraventemplate <class _Tp, class _A0> 2486227825Stheravendecltype((_Tp(_VSTD::declval<_A0>()), true_type())) 2487227825Stheraven__is_constructible1_test(_Tp&, _A0&); 2488227825Stheraven 2489227825Stheraventemplate <class _A0> 2490227825Stheravenfalse_type 2491227825Stheraven__is_constructible1_test(__any, _A0&); 2492227825Stheraven 2493227825Stheraventemplate <class _Tp, class _A0, class _A1> 2494227825Stheravendecltype((_Tp(_VSTD::declval<_A0>(), _VSTD::declval<_A1>()), true_type())) 2495227825Stheraven__is_constructible2_test(_Tp&, _A0&, _A1&); 2496227825Stheraven 2497227825Stheraventemplate <class _A0, class _A1> 2498227825Stheravenfalse_type 2499227825Stheraven__is_constructible2_test(__any, _A0&, _A1&); 2500227825Stheraven 2501227825Stheraventemplate <bool, class _Tp> 2502227825Stheravenstruct __is_constructible0_imp // false, _Tp is not a scalar 2503227825Stheraven : public common_type 2504227825Stheraven < 2505227825Stheraven decltype(__is_constructible0_test(declval<_Tp&>())) 2506227825Stheraven >::type 2507227825Stheraven {}; 2508227825Stheraven 2509227825Stheraventemplate <bool, class _Tp, class _A0> 2510227825Stheravenstruct __is_constructible1_imp // false, _Tp is not a scalar 2511227825Stheraven : public common_type 2512227825Stheraven < 2513227825Stheraven decltype(__is_constructible1_test(declval<_Tp&>(), declval<_A0&>())) 2514227825Stheraven >::type 2515227825Stheraven {}; 2516227825Stheraven 2517227825Stheraventemplate <bool, class _Tp, class _A0, class _A1> 2518227825Stheravenstruct __is_constructible2_imp // false, _Tp is not a scalar 2519227825Stheraven : public common_type 2520227825Stheraven < 2521227825Stheraven decltype(__is_constructible2_test(declval<_Tp&>(), declval<_A0>(), declval<_A1>())) 2522227825Stheraven >::type 2523227825Stheraven {}; 2524227825Stheraven 2525227825Stheraven// handle scalars and reference types 2526227825Stheraven 2527227825Stheraven// Scalars are default constructible, references are not 2528227825Stheraven 2529227825Stheraventemplate <class _Tp> 2530227825Stheravenstruct __is_constructible0_imp<true, _Tp> 2531227825Stheraven : public is_scalar<_Tp> 2532227825Stheraven {}; 2533227825Stheraven 2534227825Stheraventemplate <class _Tp, class _A0> 2535227825Stheravenstruct __is_constructible1_imp<true, _Tp, _A0> 2536227825Stheraven : public is_convertible<_A0, _Tp> 2537227825Stheraven {}; 2538227825Stheraven 2539227825Stheraventemplate <class _Tp, class _A0, class _A1> 2540227825Stheravenstruct __is_constructible2_imp<true, _Tp, _A0, _A1> 2541227825Stheraven : public false_type 2542227825Stheraven {}; 2543227825Stheraven 2544227825Stheraven// Treat scalars and reference types separately 2545227825Stheraven 2546227825Stheraventemplate <bool, class _Tp> 2547227825Stheravenstruct __is_constructible0_void_check 2548227825Stheraven : public __is_constructible0_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2549227825Stheraven _Tp> 2550227825Stheraven {}; 2551227825Stheraven 2552227825Stheraventemplate <bool, class _Tp, class _A0> 2553227825Stheravenstruct __is_constructible1_void_check 2554227825Stheraven : public __is_constructible1_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2555227825Stheraven _Tp, _A0> 2556227825Stheraven {}; 2557227825Stheraven 2558227825Stheraventemplate <bool, class _Tp, class _A0, class _A1> 2559227825Stheravenstruct __is_constructible2_void_check 2560227825Stheraven : public __is_constructible2_imp<is_scalar<_Tp>::value || is_reference<_Tp>::value, 2561227825Stheraven _Tp, _A0, _A1> 2562227825Stheraven {}; 2563227825Stheraven 2564227825Stheraven// If any of T or Args is void, is_constructible should be false 2565227825Stheraven 2566227825Stheraventemplate <class _Tp> 2567227825Stheravenstruct __is_constructible0_void_check<true, _Tp> 2568227825Stheraven : public false_type 2569227825Stheraven {}; 2570227825Stheraven 2571227825Stheraventemplate <class _Tp, class _A0> 2572227825Stheravenstruct __is_constructible1_void_check<true, _Tp, _A0> 2573227825Stheraven : public false_type 2574227825Stheraven {}; 2575227825Stheraven 2576227825Stheraventemplate <class _Tp, class _A0, class _A1> 2577227825Stheravenstruct __is_constructible2_void_check<true, _Tp, _A0, _A1> 2578227825Stheraven : public false_type 2579227825Stheraven {}; 2580227825Stheraven 2581227825Stheraven// is_constructible entry point 2582227825Stheraven 2583227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2584227825Stheraven class _A1 = __is_construct::__nat> 2585262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible 2586227825Stheraven : public __is_constructible2_void_check<is_void<_Tp>::value 2587227825Stheraven || is_abstract<_Tp>::value 2588227825Stheraven || is_function<_Tp>::value 2589227825Stheraven || is_void<_A0>::value 2590227825Stheraven || is_void<_A1>::value, 2591227825Stheraven _Tp, _A0, _A1> 2592227825Stheraven {}; 2593227825Stheraven 2594227825Stheraventemplate <class _Tp> 2595262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> 2596227825Stheraven : public __is_constructible0_void_check<is_void<_Tp>::value 2597227825Stheraven || is_abstract<_Tp>::value 2598227825Stheraven || is_function<_Tp>::value, 2599227825Stheraven _Tp> 2600227825Stheraven {}; 2601227825Stheraven 2602227825Stheraventemplate <class _Tp, class _A0> 2603262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_constructible<_Tp, _A0, __is_construct::__nat> 2604227825Stheraven : public __is_constructible1_void_check<is_void<_Tp>::value 2605227825Stheraven || is_abstract<_Tp>::value 2606227825Stheraven || is_function<_Tp>::value 2607227825Stheraven || is_void<_A0>::value, 2608227825Stheraven _Tp, _A0> 2609227825Stheraven {}; 2610227825Stheraven 2611227825Stheraven// Array types are default constructible if their element type 2612227825Stheraven// is default constructible 2613227825Stheraven 2614232950Stheraventemplate <class _Ap, size_t _Np> 2615232950Stheravenstruct __is_constructible0_imp<false, _Ap[_Np]> 2616232950Stheraven : public is_constructible<typename remove_all_extents<_Ap>::type> 2617227825Stheraven {}; 2618227825Stheraven 2619232950Stheraventemplate <class _Ap, size_t _Np, class _A0> 2620232950Stheravenstruct __is_constructible1_imp<false, _Ap[_Np], _A0> 2621227825Stheraven : public false_type 2622227825Stheraven {}; 2623227825Stheraven 2624232950Stheraventemplate <class _Ap, size_t _Np, class _A0, class _A1> 2625232950Stheravenstruct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1> 2626227825Stheraven : public false_type 2627227825Stheraven {}; 2628227825Stheraven 2629227825Stheraven// Incomplete array types are not constructible 2630227825Stheraven 2631232950Stheraventemplate <class _Ap> 2632232950Stheravenstruct __is_constructible0_imp<false, _Ap[]> 2633227825Stheraven : public false_type 2634227825Stheraven {}; 2635227825Stheraven 2636232950Stheraventemplate <class _Ap, class _A0> 2637232950Stheravenstruct __is_constructible1_imp<false, _Ap[], _A0> 2638227825Stheraven : public false_type 2639227825Stheraven {}; 2640227825Stheraven 2641232950Stheraventemplate <class _Ap, class _A0, class _A1> 2642232950Stheravenstruct __is_constructible2_imp<false, _Ap[], _A0, _A1> 2643227825Stheraven : public false_type 2644227825Stheraven {}; 2645227825Stheraven 2646227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2647277299Sdim#endif // __has_feature(is_constructible) 2648227825Stheraven 2649227825Stheraven// is_default_constructible 2650227825Stheraven 2651227825Stheraventemplate <class _Tp> 2652262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_default_constructible 2653227825Stheraven : public is_constructible<_Tp> 2654227825Stheraven {}; 2655227825Stheraven 2656227825Stheraven// is_copy_constructible 2657227825Stheraven 2658227825Stheraventemplate <class _Tp> 2659262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_copy_constructible 2660278724Sdim : public is_constructible<_Tp, 2661278724Sdim typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 2662227825Stheraven 2663227825Stheraven// is_move_constructible 2664227825Stheraven 2665227825Stheraventemplate <class _Tp> 2666262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_move_constructible 2667227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2668227825Stheraven : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2669227825Stheraven#else 2670227825Stheraven : public is_copy_constructible<_Tp> 2671227825Stheraven#endif 2672227825Stheraven {}; 2673227825Stheraven 2674227825Stheraven// is_trivially_constructible 2675227825Stheraven 2676227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2677227825Stheraven 2678232950Stheraven#if __has_feature(is_trivially_constructible) 2679232950Stheraven 2680227825Stheraventemplate <class _Tp, class... _Args> 2681262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2682232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> 2683232950Stheraven{ 2684232950Stheraven}; 2685232950Stheraven 2686232950Stheraven#else // !__has_feature(is_trivially_constructible) 2687232950Stheraven 2688232950Stheraventemplate <class _Tp, class... _Args> 2689262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2690227825Stheraven : false_type 2691227825Stheraven{ 2692227825Stheraven}; 2693227825Stheraven 2694227825Stheraventemplate <class _Tp> 2695262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp> 2696278724Sdim#if __has_feature(has_trivial_constructor) || (_GNUC_VER >= 403) 2697227825Stheraven : integral_constant<bool, __has_trivial_constructor(_Tp)> 2698227825Stheraven#else 2699227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2700227825Stheraven#endif 2701227825Stheraven{ 2702227825Stheraven}; 2703227825Stheraven 2704227825Stheraventemplate <class _Tp> 2705227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2706262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&&> 2707227825Stheraven#else 2708262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp> 2709227825Stheraven#endif 2710227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2711227825Stheraven{ 2712227825Stheraven}; 2713227825Stheraven 2714227825Stheraventemplate <class _Tp> 2715262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&> 2716227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2717227825Stheraven{ 2718227825Stheraven}; 2719227825Stheraven 2720227825Stheraventemplate <class _Tp> 2721262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&> 2722227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2723227825Stheraven{ 2724227825Stheraven}; 2725227825Stheraven 2726232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2727232950Stheraven 2728227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 2729227825Stheraven 2730227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 2731227825Stheraven class _A1 = __is_construct::__nat> 2732262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible 2733227825Stheraven : false_type 2734227825Stheraven{ 2735227825Stheraven}; 2736227825Stheraven 2737232950Stheraven#if __has_feature(is_trivially_constructible) 2738232950Stheraven 2739227825Stheraventemplate <class _Tp> 2740262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, 2741227825Stheraven __is_construct::__nat> 2742232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp)> 2743232950Stheraven{ 2744232950Stheraven}; 2745232950Stheraven 2746232950Stheraventemplate <class _Tp> 2747262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp, 2748232950Stheraven __is_construct::__nat> 2749232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)> 2750232950Stheraven{ 2751232950Stheraven}; 2752232950Stheraven 2753232950Stheraventemplate <class _Tp> 2754262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&, 2755232950Stheraven __is_construct::__nat> 2756232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)> 2757232950Stheraven{ 2758232950Stheraven}; 2759232950Stheraven 2760232950Stheraventemplate <class _Tp> 2761262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&, 2762232950Stheraven __is_construct::__nat> 2763232950Stheraven : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)> 2764232950Stheraven{ 2765232950Stheraven}; 2766232950Stheraven 2767232950Stheraven#else // !__has_feature(is_trivially_constructible) 2768232950Stheraven 2769232950Stheraventemplate <class _Tp> 2770262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, 2771232950Stheraven __is_construct::__nat> 2772227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2773227825Stheraven{ 2774227825Stheraven}; 2775227825Stheraven 2776227825Stheraventemplate <class _Tp> 2777262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp, 2778227825Stheraven __is_construct::__nat> 2779227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2780227825Stheraven{ 2781227825Stheraven}; 2782227825Stheraven 2783227825Stheraventemplate <class _Tp> 2784262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, const _Tp&, 2785227825Stheraven __is_construct::__nat> 2786227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2787227825Stheraven{ 2788227825Stheraven}; 2789227825Stheraven 2790227825Stheraventemplate <class _Tp> 2791262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&, 2792227825Stheraven __is_construct::__nat> 2793227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2794227825Stheraven{ 2795227825Stheraven}; 2796227825Stheraven 2797232950Stheraven#endif // !__has_feature(is_trivially_constructible) 2798232950Stheraven 2799227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 2800227825Stheraven 2801227825Stheraven// is_trivially_default_constructible 2802227825Stheraven 2803262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_default_constructible 2804227825Stheraven : public is_trivially_constructible<_Tp> 2805227825Stheraven {}; 2806227825Stheraven 2807227825Stheraven// is_trivially_copy_constructible 2808227825Stheraven 2809262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_constructible 2810262801Sdim : public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type> 2811227825Stheraven {}; 2812227825Stheraven 2813227825Stheraven// is_trivially_move_constructible 2814227825Stheraven 2815262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructible 2816227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2817227825Stheraven : public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 2818227825Stheraven#else 2819227825Stheraven : public is_trivially_copy_constructible<_Tp> 2820227825Stheraven#endif 2821227825Stheraven {}; 2822227825Stheraven 2823227825Stheraven// is_trivially_assignable 2824227825Stheraven 2825278724Sdim#if __has_feature(is_trivially_assignable) 2826232950Stheraven 2827227825Stheraventemplate <class _Tp, class _Arg> 2828227825Stheravenstruct is_trivially_assignable 2829232950Stheraven : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> 2830232950Stheraven{ 2831232950Stheraven}; 2832232950Stheraven 2833278724Sdim#else // !__has_feature(is_trivially_assignable) 2834232950Stheraven 2835232950Stheraventemplate <class _Tp, class _Arg> 2836232950Stheravenstruct is_trivially_assignable 2837227825Stheraven : public false_type {}; 2838227825Stheraven 2839227825Stheraventemplate <class _Tp> 2840227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp> 2841227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2842227825Stheraven 2843227825Stheraventemplate <class _Tp> 2844227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp&> 2845227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2846227825Stheraven 2847227825Stheraventemplate <class _Tp> 2848227825Stheravenstruct is_trivially_assignable<_Tp&, const _Tp&> 2849227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2850227825Stheraven 2851227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2852227825Stheraven 2853227825Stheraventemplate <class _Tp> 2854227825Stheravenstruct is_trivially_assignable<_Tp&, _Tp&&> 2855227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 2856227825Stheraven 2857227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 2858227825Stheraven 2859278724Sdim#endif // !__has_feature(is_trivially_assignable) 2860232950Stheraven 2861227825Stheraven// is_trivially_copy_assignable 2862227825Stheraven 2863262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_assignable 2864227825Stheraven : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2865278724Sdim typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 2866227825Stheraven 2867227825Stheraven// is_trivially_move_assignable 2868227825Stheraven 2869262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable 2870227825Stheraven : public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, 2871227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2872227825Stheraven typename add_rvalue_reference<_Tp>::type> 2873227825Stheraven#else 2874227825Stheraven typename add_lvalue_reference<_Tp>::type> 2875227825Stheraven#endif 2876227825Stheraven {}; 2877227825Stheraven 2878227825Stheraven// is_trivially_destructible 2879227825Stheraven 2880278724Sdim#if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403) 2881227825Stheraven 2882262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible 2883278724Sdim : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {}; 2884227825Stheraven 2885278724Sdim#else 2886227825Stheraven 2887227825Stheraventemplate <class _Tp> struct __libcpp_trivial_destructor 2888227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 2889227825Stheraven is_reference<_Tp>::value> {}; 2890227825Stheraven 2891262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible 2892227825Stheraven : public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {}; 2893227825Stheraven 2894278724Sdim#endif 2895227825Stheraven 2896227825Stheraven// is_nothrow_constructible 2897227825Stheraven 2898275472Sdim#if 0 2899275472Sdimtemplate <class _Tp, class... _Args> 2900275472Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2901275472Sdim : public integral_constant<bool, __is_nothrow_constructible(_Tp(_Args...))> 2902275472Sdim{ 2903275472Sdim}; 2904275472Sdim 2905275472Sdim#else 2906275472Sdim 2907227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 2908227825Stheraven 2909278724Sdim#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 2910227825Stheraven 2911278724Sdimtemplate <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible; 2912227825Stheraven 2913227825Stheraventemplate <class _Tp, class... _Args> 2914278724Sdimstruct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/false, _Tp, _Args...> 2915227825Stheraven : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))> 2916227825Stheraven{ 2917227825Stheraven}; 2918227825Stheraven 2919278724Sdimtemplate <class _Tp> 2920278724Sdimvoid __implicit_conversion_to(_Tp) noexcept { } 2921278724Sdim 2922278724Sdimtemplate <class _Tp, class _Arg> 2923278724Sdimstruct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/true, _Tp, _Arg> 2924278724Sdim : public integral_constant<bool, noexcept(__implicit_conversion_to<_Tp>(declval<_Arg>()))> 2925278724Sdim{ 2926278724Sdim}; 2927278724Sdim 2928278724Sdimtemplate <class _Tp, bool _IsReference, class... _Args> 2929278724Sdimstruct __libcpp_is_nothrow_constructible</*is constructible*/false, _IsReference, _Tp, _Args...> 2930227825Stheraven : public false_type 2931227825Stheraven{ 2932227825Stheraven}; 2933227825Stheraven 2934227825Stheraventemplate <class _Tp, class... _Args> 2935262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2936278724Sdim : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, is_reference<_Tp>::value, _Tp, _Args...> 2937227825Stheraven{ 2938227825Stheraven}; 2939227825Stheraven 2940227825Stheraventemplate <class _Tp, size_t _Ns> 2941262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp[_Ns]> 2942278724Sdim : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp> 2943227825Stheraven{ 2944227825Stheraven}; 2945227825Stheraven 2946227825Stheraven#else // __has_feature(cxx_noexcept) 2947227825Stheraven 2948227825Stheraventemplate <class _Tp, class... _Args> 2949262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 2950227825Stheraven : false_type 2951227825Stheraven{ 2952227825Stheraven}; 2953227825Stheraven 2954227825Stheraventemplate <class _Tp> 2955262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp> 2956278724Sdim#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403) 2957227825Stheraven : integral_constant<bool, __has_nothrow_constructor(_Tp)> 2958227825Stheraven#else 2959227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2960227825Stheraven#endif 2961227825Stheraven{ 2962227825Stheraven}; 2963227825Stheraven 2964227825Stheraventemplate <class _Tp> 2965227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2966262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&&> 2967227825Stheraven#else 2968262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp> 2969227825Stheraven#endif 2970278724Sdim#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 2971227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2972227825Stheraven#else 2973227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2974227825Stheraven#endif 2975227825Stheraven{ 2976227825Stheraven}; 2977227825Stheraven 2978227825Stheraventemplate <class _Tp> 2979262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&> 2980278724Sdim#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 2981227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2982227825Stheraven#else 2983227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2984227825Stheraven#endif 2985227825Stheraven{ 2986227825Stheraven}; 2987227825Stheraven 2988227825Stheraventemplate <class _Tp> 2989262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&> 2990278724Sdim#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 2991227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 2992227825Stheraven#else 2993227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 2994227825Stheraven#endif 2995227825Stheraven{ 2996227825Stheraven}; 2997227825Stheraven 2998227825Stheraven#endif // __has_feature(cxx_noexcept) 2999227825Stheraven 3000227825Stheraven#else // _LIBCPP_HAS_NO_VARIADICS 3001227825Stheraven 3002227825Stheraventemplate <class _Tp, class _A0 = __is_construct::__nat, 3003227825Stheraven class _A1 = __is_construct::__nat> 3004262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible 3005227825Stheraven : false_type 3006227825Stheraven{ 3007227825Stheraven}; 3008227825Stheraven 3009227825Stheraventemplate <class _Tp> 3010262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, __is_construct::__nat, 3011227825Stheraven __is_construct::__nat> 3012278724Sdim#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403) 3013227825Stheraven : integral_constant<bool, __has_nothrow_constructor(_Tp)> 3014227825Stheraven#else 3015227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 3016227825Stheraven#endif 3017227825Stheraven{ 3018227825Stheraven}; 3019227825Stheraven 3020227825Stheraventemplate <class _Tp> 3021262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp, 3022227825Stheraven __is_construct::__nat> 3023278724Sdim#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3024227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 3025227825Stheraven#else 3026227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 3027227825Stheraven#endif 3028227825Stheraven{ 3029227825Stheraven}; 3030227825Stheraven 3031227825Stheraventemplate <class _Tp> 3032262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, const _Tp&, 3033227825Stheraven __is_construct::__nat> 3034278724Sdim#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3035227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 3036227825Stheraven#else 3037227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 3038227825Stheraven#endif 3039227825Stheraven{ 3040227825Stheraven}; 3041227825Stheraven 3042227825Stheraventemplate <class _Tp> 3043262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&, 3044227825Stheraven __is_construct::__nat> 3045278724Sdim#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) 3046227825Stheraven : integral_constant<bool, __has_nothrow_copy(_Tp)> 3047227825Stheraven#else 3048227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> 3049227825Stheraven#endif 3050227825Stheraven{ 3051227825Stheraven}; 3052227825Stheraven 3053227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 3054275472Sdim#endif // __has_feature(is_nothrow_constructible) 3055227825Stheraven 3056227825Stheraven// is_nothrow_default_constructible 3057227825Stheraven 3058262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_default_constructible 3059227825Stheraven : public is_nothrow_constructible<_Tp> 3060227825Stheraven {}; 3061227825Stheraven 3062227825Stheraven// is_nothrow_copy_constructible 3063227825Stheraven 3064262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_constructible 3065278724Sdim : public is_nothrow_constructible<_Tp, 3066278724Sdim typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 3067227825Stheraven 3068227825Stheraven// is_nothrow_move_constructible 3069227825Stheraven 3070262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible 3071227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3072227825Stheraven : public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type> 3073227825Stheraven#else 3074227825Stheraven : public is_nothrow_copy_constructible<_Tp> 3075227825Stheraven#endif 3076227825Stheraven {}; 3077227825Stheraven 3078227825Stheraven// is_nothrow_assignable 3079227825Stheraven 3080278724Sdim#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 3081227825Stheraven 3082277299Sdimtemplate <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable; 3083227825Stheraven 3084227825Stheraventemplate <class _Tp, class _Arg> 3085277299Sdimstruct __libcpp_is_nothrow_assignable<false, _Tp, _Arg> 3086227825Stheraven : public false_type 3087227825Stheraven{ 3088227825Stheraven}; 3089227825Stheraven 3090227825Stheraventemplate <class _Tp, class _Arg> 3091277299Sdimstruct __libcpp_is_nothrow_assignable<true, _Tp, _Arg> 3092227825Stheraven : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>()) > 3093227825Stheraven{ 3094227825Stheraven}; 3095227825Stheraven 3096227825Stheraventemplate <class _Tp, class _Arg> 3097262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable 3098277299Sdim : public __libcpp_is_nothrow_assignable<is_assignable<_Tp, _Arg>::value, _Tp, _Arg> 3099227825Stheraven{ 3100227825Stheraven}; 3101227825Stheraven 3102227825Stheraven#else // __has_feature(cxx_noexcept) 3103227825Stheraven 3104227825Stheraventemplate <class _Tp, class _Arg> 3105262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable 3106227825Stheraven : public false_type {}; 3107227825Stheraven 3108227825Stheraventemplate <class _Tp> 3109262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp> 3110278724Sdim#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3111227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3112227825Stheraven#else 3113227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 3114227825Stheraven#endif 3115227825Stheraven 3116227825Stheraventemplate <class _Tp> 3117262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, _Tp&> 3118278724Sdim#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3119227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3120227825Stheraven#else 3121227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 3122227825Stheraven#endif 3123227825Stheraven 3124227825Stheraventemplate <class _Tp> 3125262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_assignable<_Tp&, const _Tp&> 3126278724Sdim#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3127227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3128227825Stheraven#else 3129227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 3130227825Stheraven#endif 3131227825Stheraven 3132227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3133227825Stheraven 3134227825Stheraventemplate <class _Tp> 3135227825Stheravenstruct is_nothrow_assignable<_Tp&, _Tp&&> 3136278724Sdim#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) 3137227825Stheraven : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; 3138227825Stheraven#else 3139227825Stheraven : integral_constant<bool, is_scalar<_Tp>::value> {}; 3140227825Stheraven#endif 3141227825Stheraven 3142227825Stheraven#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 3143227825Stheraven 3144227825Stheraven#endif // __has_feature(cxx_noexcept) 3145227825Stheraven 3146227825Stheraven// is_nothrow_copy_assignable 3147227825Stheraven 3148262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable 3149227825Stheraven : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 3150278724Sdim typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {}; 3151227825Stheraven 3152227825Stheraven// is_nothrow_move_assignable 3153227825Stheraven 3154262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable 3155227825Stheraven : public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, 3156227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3157227825Stheraven typename add_rvalue_reference<_Tp>::type> 3158227825Stheraven#else 3159227825Stheraven typename add_lvalue_reference<_Tp>::type> 3160227825Stheraven#endif 3161227825Stheraven {}; 3162227825Stheraven 3163227825Stheraven// is_nothrow_destructible 3164227825Stheraven 3165278724Sdim#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 3166227825Stheraven 3167277299Sdimtemplate <bool, class _Tp> struct __libcpp_is_nothrow_destructible; 3168227825Stheraven 3169227825Stheraventemplate <class _Tp> 3170277299Sdimstruct __libcpp_is_nothrow_destructible<false, _Tp> 3171227825Stheraven : public false_type 3172227825Stheraven{ 3173227825Stheraven}; 3174227825Stheraven 3175227825Stheraventemplate <class _Tp> 3176277299Sdimstruct __libcpp_is_nothrow_destructible<true, _Tp> 3177227825Stheraven : public integral_constant<bool, noexcept(_VSTD::declval<_Tp>().~_Tp()) > 3178227825Stheraven{ 3179227825Stheraven}; 3180227825Stheraven 3181227825Stheraventemplate <class _Tp> 3182262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible 3183277299Sdim : public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> 3184227825Stheraven{ 3185227825Stheraven}; 3186227825Stheraven 3187227825Stheraventemplate <class _Tp, size_t _Ns> 3188262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[_Ns]> 3189227825Stheraven : public is_nothrow_destructible<_Tp> 3190227825Stheraven{ 3191227825Stheraven}; 3192227825Stheraven 3193227825Stheraventemplate <class _Tp> 3194262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&> 3195227825Stheraven : public true_type 3196227825Stheraven{ 3197227825Stheraven}; 3198227825Stheraven 3199227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 3200227825Stheraven 3201227825Stheraventemplate <class _Tp> 3202262801Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp&&> 3203227825Stheraven : public true_type 3204227825Stheraven{ 3205227825Stheraven}; 3206227825Stheraven 3207227825Stheraven#endif 3208227825Stheraven 3209227825Stheraven#else 3210227825Stheraven 3211227825Stheraventemplate <class _Tp> struct __libcpp_nothrow_destructor 3212227825Stheraven : public integral_constant<bool, is_scalar<_Tp>::value || 3213227825Stheraven is_reference<_Tp>::value> {}; 3214227825Stheraven 3215262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible 3216227825Stheraven : public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {}; 3217227825Stheraven 3218227825Stheraven#endif 3219227825Stheraven 3220227825Stheraven// is_pod 3221227825Stheraven 3222278724Sdim#if __has_feature(is_pod) || (_GNUC_VER >= 403) 3223227825Stheraven 3224262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod 3225227825Stheraven : public integral_constant<bool, __is_pod(_Tp)> {}; 3226227825Stheraven 3227278724Sdim#else 3228227825Stheraven 3229262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod 3230227825Stheraven : public integral_constant<bool, is_trivially_default_constructible<_Tp>::value && 3231227825Stheraven is_trivially_copy_constructible<_Tp>::value && 3232227825Stheraven is_trivially_copy_assignable<_Tp>::value && 3233227825Stheraven is_trivially_destructible<_Tp>::value> {}; 3234227825Stheraven 3235278724Sdim#endif 3236227825Stheraven 3237227825Stheraven// is_literal_type; 3238227825Stheraven 3239262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type 3240278724Sdim#ifdef _LIBCPP_IS_LITERAL 3241278724Sdim : public integral_constant<bool, _LIBCPP_IS_LITERAL(_Tp)> 3242227825Stheraven#else 3243227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value || 3244227825Stheraven is_reference<typename remove_all_extents<_Tp>::type>::value> 3245227825Stheraven#endif 3246227825Stheraven {}; 3247227825Stheraven 3248227825Stheraven// is_standard_layout; 3249227825Stheraven 3250262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout 3251278724Sdim#if __has_feature(is_standard_layout) || (_GNUC_VER >= 407) 3252227825Stheraven : public integral_constant<bool, __is_standard_layout(_Tp)> 3253227825Stheraven#else 3254227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 3255227825Stheraven#endif 3256227825Stheraven {}; 3257227825Stheraven 3258227825Stheraven// is_trivially_copyable; 3259227825Stheraven 3260262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable 3261227825Stheraven#if __has_feature(is_trivially_copyable) 3262227825Stheraven : public integral_constant<bool, __is_trivially_copyable(_Tp)> 3263227825Stheraven#else 3264227825Stheraven : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> 3265227825Stheraven#endif 3266227825Stheraven {}; 3267227825Stheraven 3268227825Stheraven// is_trivial; 3269227825Stheraven 3270262801Sdimtemplate <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial 3271278724Sdim#if __has_feature(is_trivial) || (_GNUC_VER >= 407) 3272227825Stheraven : public integral_constant<bool, __is_trivial(_Tp)> 3273227825Stheraven#else 3274227825Stheraven : integral_constant<bool, is_trivially_copyable<_Tp>::value && 3275227825Stheraven is_trivially_default_constructible<_Tp>::value> 3276227825Stheraven#endif 3277227825Stheraven {}; 3278227825Stheraven 3279227825Stheraven#ifndef _LIBCPP_HAS_NO_VARIADICS 3280227825Stheraven 3281227825Stheraven// Check for complete types 3282227825Stheraven 3283232950Stheraventemplate <class ..._Tp> struct __check_complete; 3284227825Stheraven 3285227825Stheraventemplate <> 3286227825Stheravenstruct __check_complete<> 3287227825Stheraven{ 3288227825Stheraven}; 3289227825Stheraven 3290232950Stheraventemplate <class _Hp, class _T0, class ..._Tp> 3291232950Stheravenstruct __check_complete<_Hp, _T0, _Tp...> 3292232950Stheraven : private __check_complete<_Hp>, 3293232950Stheraven private __check_complete<_T0, _Tp...> 3294227825Stheraven{ 3295227825Stheraven}; 3296227825Stheraven 3297232950Stheraventemplate <class _Hp> 3298232950Stheravenstruct __check_complete<_Hp, _Hp> 3299232950Stheraven : private __check_complete<_Hp> 3300227825Stheraven{ 3301227825Stheraven}; 3302227825Stheraven 3303232950Stheraventemplate <class _Tp> 3304232950Stheravenstruct __check_complete<_Tp> 3305227825Stheraven{ 3306232950Stheraven static_assert(sizeof(_Tp) > 0, "Type must be complete."); 3307227825Stheraven}; 3308227825Stheraven 3309232950Stheraventemplate <class _Tp> 3310232950Stheravenstruct __check_complete<_Tp&> 3311232950Stheraven : private __check_complete<_Tp> 3312227825Stheraven{ 3313227825Stheraven}; 3314227825Stheraven 3315232950Stheraventemplate <class _Tp> 3316232950Stheravenstruct __check_complete<_Tp&&> 3317232950Stheraven : private __check_complete<_Tp> 3318227825Stheraven{ 3319227825Stheraven}; 3320227825Stheraven 3321232950Stheraventemplate <class _Rp, class ..._Param> 3322232950Stheravenstruct __check_complete<_Rp (*)(_Param...)> 3323241903Sdim : private __check_complete<_Rp> 3324227825Stheraven{ 3325227825Stheraven}; 3326227825Stheraven 3327262801Sdimtemplate <class ..._Param> 3328262801Sdimstruct __check_complete<void (*)(_Param...)> 3329262801Sdim{ 3330262801Sdim}; 3331262801Sdim 3332232950Stheraventemplate <class _Rp, class ..._Param> 3333232950Stheravenstruct __check_complete<_Rp (_Param...)> 3334241903Sdim : private __check_complete<_Rp> 3335227825Stheraven{ 3336227825Stheraven}; 3337227825Stheraven 3338262801Sdimtemplate <class ..._Param> 3339262801Sdimstruct __check_complete<void (_Param...)> 3340262801Sdim{ 3341262801Sdim}; 3342262801Sdim 3343232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3344232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...)> 3345241903Sdim : private __check_complete<_Class> 3346227825Stheraven{ 3347227825Stheraven}; 3348227825Stheraven 3349232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3350232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const> 3351241903Sdim : private __check_complete<_Class> 3352227825Stheraven{ 3353227825Stheraven}; 3354227825Stheraven 3355232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3356232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile> 3357241903Sdim : private __check_complete<_Class> 3358227825Stheraven{ 3359227825Stheraven}; 3360227825Stheraven 3361232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3362232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile> 3363241903Sdim : private __check_complete<_Class> 3364227825Stheraven{ 3365227825Stheraven}; 3366227825Stheraven 3367227825Stheraven#if __has_feature(cxx_reference_qualified_functions) 3368227825Stheraven 3369232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3370232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) &> 3371241903Sdim : private __check_complete<_Class> 3372227825Stheraven{ 3373227825Stheraven}; 3374227825Stheraven 3375232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3376232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const&> 3377241903Sdim : private __check_complete<_Class> 3378227825Stheraven{ 3379227825Stheraven}; 3380227825Stheraven 3381232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3382232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile&> 3383241903Sdim : private __check_complete<_Class> 3384227825Stheraven{ 3385227825Stheraven}; 3386227825Stheraven 3387232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3388232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> 3389241903Sdim : private __check_complete<_Class> 3390227825Stheraven{ 3391227825Stheraven}; 3392227825Stheraven 3393232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3394232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) &&> 3395241903Sdim : private __check_complete<_Class> 3396227825Stheraven{ 3397227825Stheraven}; 3398227825Stheraven 3399232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3400232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const&&> 3401241903Sdim : private __check_complete<_Class> 3402227825Stheraven{ 3403227825Stheraven}; 3404227825Stheraven 3405232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3406232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> 3407241903Sdim : private __check_complete<_Class> 3408227825Stheraven{ 3409227825Stheraven}; 3410227825Stheraven 3411232950Stheraventemplate <class _Rp, class _Class, class ..._Param> 3412232950Stheravenstruct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> 3413241903Sdim : private __check_complete<_Class> 3414227825Stheraven{ 3415227825Stheraven}; 3416227825Stheraven 3417227825Stheraven#endif 3418227825Stheraven 3419232950Stheraventemplate <class _Rp, class _Class> 3420232950Stheravenstruct __check_complete<_Rp _Class::*> 3421227825Stheraven : private __check_complete<_Class> 3422227825Stheraven{ 3423227825Stheraven}; 3424227825Stheraven 3425227825Stheraven// __invoke forward declarations 3426227825Stheraven 3427227825Stheraven// fall back - none of the bullets 3428227825Stheraven 3429227825Stheraventemplate <class ..._Args> 3430227825Stheravenauto 3431227825Stheraven__invoke(__any, _Args&& ...__args) 3432227825Stheraven -> __nat; 3433227825Stheraven 3434227825Stheraven// bullets 1 and 2 3435227825Stheraven 3436253159Stheraventemplate <class _Fp, class _A0, class ..._Args, 3437253159Stheraven class = typename enable_if 3438253159Stheraven < 3439253159Stheraven is_member_function_pointer<typename remove_reference<_Fp>::type>::value && 3440278724Sdim is_base_of<typename remove_reference<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType>::type, 3441253159Stheraven typename remove_reference<_A0>::type>::value 3442253159Stheraven >::type 3443253159Stheraven > 3444241903Sdim_LIBCPP_INLINE_VISIBILITY 3445227825Stheravenauto 3446232950Stheraven__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 3447227825Stheraven -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)); 3448227825Stheraven 3449253159Stheraventemplate <class _Fp, class _A0, class ..._Args, 3450253159Stheraven class = typename enable_if 3451253159Stheraven < 3452253159Stheraven is_member_function_pointer<typename remove_reference<_Fp>::type>::value && 3453278724Sdim !is_base_of<typename remove_reference<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType>::type, 3454253159Stheraven typename remove_reference<_A0>::type>::value 3455253159Stheraven >::type 3456253159Stheraven > 3457241903Sdim_LIBCPP_INLINE_VISIBILITY 3458227825Stheravenauto 3459232950Stheraven__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) 3460227825Stheraven -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)); 3461227825Stheraven 3462227825Stheraven// bullets 3 and 4 3463227825Stheraven 3464253159Stheraventemplate <class _Fp, class _A0, 3465253159Stheraven class = typename enable_if 3466253159Stheraven < 3467253159Stheraven is_member_object_pointer<typename remove_reference<_Fp>::type>::value && 3468253159Stheraven is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3469253159Stheraven typename remove_reference<_A0>::type>::value 3470253159Stheraven >::type 3471253159Stheraven > 3472241903Sdim_LIBCPP_INLINE_VISIBILITY 3473227825Stheravenauto 3474232950Stheraven__invoke(_Fp&& __f, _A0&& __a0) 3475227825Stheraven -> decltype(_VSTD::forward<_A0>(__a0).*__f); 3476227825Stheraven 3477253159Stheraventemplate <class _Fp, class _A0, 3478253159Stheraven class = typename enable_if 3479253159Stheraven < 3480253159Stheraven is_member_object_pointer<typename remove_reference<_Fp>::type>::value && 3481253159Stheraven !is_base_of<typename __member_pointer_traits<typename remove_reference<_Fp>::type>::_ClassType, 3482253159Stheraven typename remove_reference<_A0>::type>::value 3483253159Stheraven >::type 3484253159Stheraven > 3485241903Sdim_LIBCPP_INLINE_VISIBILITY 3486227825Stheravenauto 3487232950Stheraven__invoke(_Fp&& __f, _A0&& __a0) 3488227825Stheraven -> decltype((*_VSTD::forward<_A0>(__a0)).*__f); 3489227825Stheraven 3490227825Stheraven// bullet 5 3491227825Stheraven 3492232950Stheraventemplate <class _Fp, class ..._Args> 3493241903Sdim_LIBCPP_INLINE_VISIBILITY 3494227825Stheravenauto 3495232950Stheraven__invoke(_Fp&& __f, _Args&& ...__args) 3496232950Stheraven -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)); 3497227825Stheraven 3498227825Stheraven// __invokable 3499227825Stheraven 3500232950Stheraventemplate <class _Fp, class ..._Args> 3501227825Stheravenstruct __invokable_imp 3502241903Sdim : private __check_complete<_Fp> 3503227825Stheraven{ 3504227825Stheraven typedef decltype( 3505232950Stheraven __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...) 3506227825Stheraven ) type; 3507227825Stheraven static const bool value = !is_same<type, __nat>::value; 3508227825Stheraven}; 3509227825Stheraven 3510232950Stheraventemplate <class _Fp, class ..._Args> 3511227825Stheravenstruct __invokable 3512227825Stheraven : public integral_constant<bool, 3513232950Stheraven __invokable_imp<_Fp, _Args...>::value> 3514227825Stheraven{ 3515227825Stheraven}; 3516227825Stheraven 3517227825Stheraven// __invoke_of 3518227825Stheraven 3519232950Stheraventemplate <bool _Invokable, class _Fp, class ..._Args> 3520227825Stheravenstruct __invoke_of_imp // false 3521227825Stheraven{ 3522227825Stheraven}; 3523227825Stheraven 3524232950Stheraventemplate <class _Fp, class ..._Args> 3525232950Stheravenstruct __invoke_of_imp<true, _Fp, _Args...> 3526227825Stheraven{ 3527232950Stheraven typedef typename __invokable_imp<_Fp, _Args...>::type type; 3528227825Stheraven}; 3529227825Stheraven 3530232950Stheraventemplate <class _Fp, class ..._Args> 3531227825Stheravenstruct __invoke_of 3532232950Stheraven : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...> 3533227825Stheraven{ 3534227825Stheraven}; 3535227825Stheraven 3536241903Sdimtemplate <class _Fp, class ..._Args> 3537262801Sdimclass _LIBCPP_TYPE_VIS_ONLY result_of<_Fp(_Args...)> 3538241903Sdim : public __invoke_of<_Fp, _Args...> 3539241903Sdim{ 3540241903Sdim}; 3541241903Sdim 3542253159Stheraven#if _LIBCPP_STD_VER > 11 3543253159Stheraventemplate <class _Tp> using result_of_t = typename result_of<_Tp>::type; 3544253159Stheraven#endif 3545253159Stheraven 3546227825Stheraven#endif // _LIBCPP_HAS_NO_VARIADICS 3547227825Stheraven 3548227825Stheraventemplate <class _Tp> 3549227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3550227825Stheraven#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE 3551227825Stheraventypename enable_if 3552227825Stheraven< 3553227825Stheraven is_move_constructible<_Tp>::value && 3554227825Stheraven is_move_assignable<_Tp>::value 3555227825Stheraven>::type 3556227825Stheraven#else 3557227825Stheravenvoid 3558227825Stheraven#endif 3559227825Stheravenswap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value && 3560227825Stheraven is_nothrow_move_assignable<_Tp>::value) 3561227825Stheraven{ 3562227825Stheraven _Tp __t(_VSTD::move(__x)); 3563227825Stheraven __x = _VSTD::move(__y); 3564227825Stheraven __y = _VSTD::move(__t); 3565227825Stheraven} 3566227825Stheraven 3567227825Stheraventemplate <class _ForwardIterator1, class _ForwardIterator2> 3568227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 3569227825Stheravenvoid 3570227825Stheraveniter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) 3571227825Stheraven // _NOEXCEPT_(_NOEXCEPT_(swap(*__a, *__b))) 3572227825Stheraven _NOEXCEPT_(_NOEXCEPT_(swap(*_VSTD::declval<_ForwardIterator1>(), 3573227825Stheraven *_VSTD::declval<_ForwardIterator2>()))) 3574227825Stheraven{ 3575227825Stheraven swap(*__a, *__b); 3576227825Stheraven} 3577227825Stheraven 3578227825Stheraven// __swappable 3579227825Stheraven 3580227825Stheravennamespace __detail 3581227825Stheraven{ 3582227825Stheraven 3583227825Stheravenusing _VSTD::swap; 3584227825Stheraven__nat swap(__any, __any); 3585227825Stheraven 3586227825Stheraventemplate <class _Tp> 3587227825Stheravenstruct __swappable 3588227825Stheraven{ 3589227825Stheraven typedef decltype(swap(_VSTD::declval<_Tp&>(), _VSTD::declval<_Tp&>())) type; 3590227825Stheraven static const bool value = !is_same<type, __nat>::value; 3591227825Stheraven}; 3592227825Stheraven 3593227825Stheraven} // __detail 3594227825Stheraven 3595227825Stheraventemplate <class _Tp> 3596227825Stheravenstruct __is_swappable 3597227825Stheraven : public integral_constant<bool, __detail::__swappable<_Tp>::value> 3598227825Stheraven{ 3599227825Stheraven}; 3600227825Stheraven 3601278724Sdim#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) 3602227825Stheraven 3603227825Stheraventemplate <bool, class _Tp> 3604227825Stheravenstruct __is_nothrow_swappable_imp 3605227825Stheraven : public integral_constant<bool, noexcept(swap(_VSTD::declval<_Tp&>(), 3606227825Stheraven _VSTD::declval<_Tp&>()))> 3607227825Stheraven{ 3608227825Stheraven}; 3609227825Stheraven 3610227825Stheraventemplate <class _Tp> 3611227825Stheravenstruct __is_nothrow_swappable_imp<false, _Tp> 3612227825Stheraven : public false_type 3613227825Stheraven{ 3614227825Stheraven}; 3615227825Stheraven 3616227825Stheraventemplate <class _Tp> 3617227825Stheravenstruct __is_nothrow_swappable 3618227825Stheraven : public __is_nothrow_swappable_imp<__is_swappable<_Tp>::value, _Tp> 3619227825Stheraven{ 3620227825Stheraven}; 3621227825Stheraven 3622227825Stheraven#else // __has_feature(cxx_noexcept) 3623227825Stheraven 3624227825Stheraventemplate <class _Tp> 3625227825Stheravenstruct __is_nothrow_swappable 3626227825Stheraven : public false_type 3627227825Stheraven{ 3628227825Stheraven}; 3629227825Stheraven 3630227825Stheraven#endif // __has_feature(cxx_noexcept) 3631227825Stheraven 3632278724Sdim#ifdef _LIBCPP_UNDERLYING_TYPE 3633227825Stheraven 3634227825Stheraventemplate <class _Tp> 3635227825Stheravenstruct underlying_type 3636227825Stheraven{ 3637278724Sdim typedef _LIBCPP_UNDERLYING_TYPE(_Tp) type; 3638227825Stheraven}; 3639227825Stheraven 3640253159Stheraven#if _LIBCPP_STD_VER > 11 3641253159Stheraventemplate <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type; 3642253159Stheraven#endif 3643253159Stheraven 3644278724Sdim#else // _LIBCPP_UNDERLYING_TYPE 3645227825Stheraven 3646227825Stheraventemplate <class _Tp, bool _Support = false> 3647227825Stheravenstruct underlying_type 3648227825Stheraven{ 3649227825Stheraven static_assert(_Support, "The underyling_type trait requires compiler " 3650227825Stheraven "support. Either no such support exists or " 3651227825Stheraven "libc++ does not know how to use it."); 3652227825Stheraven}; 3653227825Stheraven 3654278724Sdim#endif // _LIBCPP_UNDERLYING_TYPE 3655227825Stheraven 3656262801Sdim#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE 3657262801Sdim 3658262801Sdimtemplate <class _Tp> 3659278724Sdimstruct __has_operator_addressof_member_imp 3660262801Sdim{ 3661278724Sdim template <class _Up> 3662278724Sdim static auto __test(int) 3663278724Sdim -> typename __select_2nd<decltype(_VSTD::declval<_Up>().operator&()), true_type>::type; 3664262801Sdim template <class> 3665278724Sdim static auto __test(long) -> false_type; 3666278724Sdim 3667278724Sdim static const bool value = decltype(__test<_Tp>(0))::value; 3668278724Sdim}; 3669278724Sdim 3670278724Sdimtemplate <class _Tp> 3671278724Sdimstruct __has_operator_addressof_free_imp 3672278724Sdim{ 3673262801Sdim template <class _Up> 3674278724Sdim static auto __test(int) 3675278724Sdim -> typename __select_2nd<decltype(operator&(_VSTD::declval<_Up>())), true_type>::type; 3676278724Sdim template <class> 3677278724Sdim static auto __test(long) -> false_type; 3678262801Sdim 3679278724Sdim static const bool value = decltype(__test<_Tp>(0))::value; 3680262801Sdim}; 3681262801Sdim 3682262801Sdimtemplate <class _Tp> 3683262801Sdimstruct __has_operator_addressof 3684278724Sdim : public integral_constant<bool, __has_operator_addressof_member_imp<_Tp>::value 3685278724Sdim || __has_operator_addressof_free_imp<_Tp>::value> 3686262801Sdim{}; 3687262801Sdim 3688262801Sdim#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE 3689262801Sdim 3690278724Sdim#if _LIBCPP_STD_VER > 14 3691278724Sdimtemplate <class...> using void_t = void; 3692278724Sdim#endif 3693278724Sdim 3694227825Stheraven_LIBCPP_END_NAMESPACE_STD 3695227825Stheraven 3696227825Stheraven#endif // _LIBCPP_TYPE_TRAITS 3697