1 // C++0x type_traits -*- C++ -*-
3 // Copyright (C) 2007-2016 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
25 // ????????????????????????????????????????????????????????????????????
27 // This is a copy of the libstdc++ header, with the trivial modification
28 // of ignoring the c++config.h include. If and when the top-level build is
29 // fixed so that target libraries can be built using the newly built, we can
32 // ????????????????????????????????????????????????????????????????????
34 /** @file include/type_traits
35 * This is a Standard C++ Library header.
38 #ifndef _GLIBCXX_TYPE_TRAITS
39 #define _GLIBCXX_TYPE_TRAITS 1
41 // #pragma GCC system_header
43 // #ifndef __GXX_EXPERIMENTAL_CXX0X__
44 // # include <bits/c++0x_warning.h>
46 // #include <bits/c++config.h>
48 namespace std // _GLIBCXX_VISIBILITY(default)
50 // _GLIBCXX_BEGIN_NAMESPACE_VERSION
53 * @addtogroup metaprogramming
58 template<typename _Tp, _Tp __v>
59 struct integral_constant
61 static constexpr _Tp value = __v;
62 typedef _Tp value_type;
63 typedef integral_constant<_Tp, __v> type;
64 constexpr operator value_type() { return value; }
67 /// typedef for true_type
68 typedef integral_constant<bool, true> true_type;
70 /// typedef for false_type
71 typedef integral_constant<bool, false> false_type;
73 template<typename _Tp, _Tp __v>
74 constexpr _Tp integral_constant<_Tp, __v>::value;
76 // Meta programming helper types.
78 template<bool, typename, typename>
89 template<typename _B1>
94 template<typename _B1, typename _B2>
95 struct __or_<_B1, _B2>
96 : public conditional<_B1::value, _B1, _B2>::type
99 template<typename _B1, typename _B2, typename _B3, typename... _Bn>
100 struct __or_<_B1, _B2, _B3, _Bn...>
101 : public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type
104 template<typename...>
112 template<typename _B1>
117 template<typename _B1, typename _B2>
118 struct __and_<_B1, _B2>
119 : public conditional<_B1::value, _B2, _B1>::type
122 template<typename _B1, typename _B2, typename _B3, typename... _Bn>
123 struct __and_<_B1, _B2, _B3, _Bn...>
124 : public conditional<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>::type
127 template<typename _Pp>
129 : public integral_constant<bool, !_Pp::value>
132 struct __sfinae_types
135 typedef struct { char __arr[2]; } __two;
138 // primary type categories.
144 struct __is_void_helper
145 : public false_type { };
148 struct __is_void_helper<void>
149 : public true_type { };
152 template<typename _Tp>
154 : public integral_constant<bool, (__is_void_helper<typename
155 remove_cv<_Tp>::type>::value)>
159 struct __is_integral_helper
160 : public false_type { };
163 struct __is_integral_helper<bool>
164 : public true_type { };
167 struct __is_integral_helper<char>
168 : public true_type { };
171 struct __is_integral_helper<signed char>
172 : public true_type { };
175 struct __is_integral_helper<unsigned char>
176 : public true_type { };
178 #ifdef _GLIBCXX_USE_WCHAR_T
180 struct __is_integral_helper<wchar_t>
181 : public true_type { };
185 struct __is_integral_helper<char16_t>
186 : public true_type { };
189 struct __is_integral_helper<char32_t>
190 : public true_type { };
193 struct __is_integral_helper<short>
194 : public true_type { };
197 struct __is_integral_helper<unsigned short>
198 : public true_type { };
201 struct __is_integral_helper<int>
202 : public true_type { };
205 struct __is_integral_helper<unsigned int>
206 : public true_type { };
209 struct __is_integral_helper<long>
210 : public true_type { };
213 struct __is_integral_helper<unsigned long>
214 : public true_type { };
217 struct __is_integral_helper<long long>
218 : public true_type { };
221 struct __is_integral_helper<unsigned long long>
222 : public true_type { };
224 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
226 struct __is_integral_helper<__int128>
227 : public true_type { };
230 struct __is_integral_helper<unsigned __int128>
231 : public true_type { };
235 template<typename _Tp>
237 : public integral_constant<bool, (__is_integral_helper<typename
238 remove_cv<_Tp>::type>::value)>
242 struct __is_floating_point_helper
243 : public false_type { };
246 struct __is_floating_point_helper<float>
247 : public true_type { };
250 struct __is_floating_point_helper<double>
251 : public true_type { };
254 struct __is_floating_point_helper<long double>
255 : public true_type { };
257 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
259 struct __is_floating_point_helper<__float128>
260 : public true_type { };
263 /// is_floating_point
264 template<typename _Tp>
265 struct is_floating_point
266 : public integral_constant<bool, (__is_floating_point_helper<typename
267 remove_cv<_Tp>::type>::value)>
273 : public false_type { };
275 template<typename _Tp, size_t _Size>
276 struct is_array<_Tp[_Size]>
277 : public true_type { };
279 template<typename _Tp>
280 struct is_array<_Tp[]>
281 : public true_type { };
284 struct __is_pointer_helper
285 : public false_type { };
287 template<typename _Tp>
288 struct __is_pointer_helper<_Tp*>
289 : public true_type { };
292 template<typename _Tp>
294 : public integral_constant<bool, (__is_pointer_helper<typename
295 remove_cv<_Tp>::type>::value)>
298 /// is_lvalue_reference
300 struct is_lvalue_reference
301 : public false_type { };
303 template<typename _Tp>
304 struct is_lvalue_reference<_Tp&>
305 : public true_type { };
307 /// is_rvalue_reference
309 struct is_rvalue_reference
310 : public false_type { };
312 template<typename _Tp>
313 struct is_rvalue_reference<_Tp&&>
314 : public true_type { };
320 struct __is_member_object_pointer_helper
321 : public false_type { };
323 template<typename _Tp, typename _Cp>
324 struct __is_member_object_pointer_helper<_Tp _Cp::*>
325 : public integral_constant<bool, !is_function<_Tp>::value> { };
327 /// is_member_object_pointer
328 template<typename _Tp>
329 struct is_member_object_pointer
330 : public integral_constant<bool, (__is_member_object_pointer_helper<
331 typename remove_cv<_Tp>::type>::value)>
335 struct __is_member_function_pointer_helper
336 : public false_type { };
338 template<typename _Tp, typename _Cp>
339 struct __is_member_function_pointer_helper<_Tp _Cp::*>
340 : public integral_constant<bool, is_function<_Tp>::value> { };
342 /// is_member_function_pointer
343 template<typename _Tp>
344 struct is_member_function_pointer
345 : public integral_constant<bool, (__is_member_function_pointer_helper<
346 typename remove_cv<_Tp>::type>::value)>
350 template<typename _Tp>
352 : public integral_constant<bool, __is_enum(_Tp)>
356 template<typename _Tp>
358 : public integral_constant<bool, __is_union(_Tp)>
362 template<typename _Tp>
364 : public integral_constant<bool, __is_class(_Tp)>
370 : public false_type { };
372 template<typename _Res, typename... _ArgTypes>
373 struct is_function<_Res(_ArgTypes...)>
374 : public true_type { };
376 template<typename _Res, typename... _ArgTypes>
377 struct is_function<_Res(_ArgTypes......)>
378 : public true_type { };
380 template<typename _Res, typename... _ArgTypes>
381 struct is_function<_Res(_ArgTypes...) const>
382 : public true_type { };
384 template<typename _Res, typename... _ArgTypes>
385 struct is_function<_Res(_ArgTypes......) const>
386 : public true_type { };
388 template<typename _Res, typename... _ArgTypes>
389 struct is_function<_Res(_ArgTypes...) volatile>
390 : public true_type { };
392 template<typename _Res, typename... _ArgTypes>
393 struct is_function<_Res(_ArgTypes......) volatile>
394 : public true_type { };
396 template<typename _Res, typename... _ArgTypes>
397 struct is_function<_Res(_ArgTypes...) const volatile>
398 : public true_type { };
400 template<typename _Res, typename... _ArgTypes>
401 struct is_function<_Res(_ArgTypes......) const volatile>
402 : public true_type { };
405 struct __is_nullptr_t_helper
406 : public false_type { };
410 struct __is_nullptr_t_helper<nullptr_t>
411 : public true_type { };
414 // __is_nullptr_t (extension).
415 template<typename _Tp>
416 struct __is_nullptr_t
417 : public integral_constant<bool, (__is_nullptr_t_helper<typename
418 remove_cv<_Tp>::type>::value)>
421 // composite type categories.
424 template<typename _Tp>
426 : public __or_<is_lvalue_reference<_Tp>,
427 is_rvalue_reference<_Tp>>::type
431 template<typename _Tp>
433 : public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
437 template<typename _Tp>
438 struct is_fundamental
439 : public __or_<is_arithmetic<_Tp>, is_void<_Tp>>::type
443 template<typename _Tp>
445 : public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
450 struct is_member_pointer;
453 template<typename _Tp>
455 : public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
456 is_member_pointer<_Tp>, __is_nullptr_t<_Tp>>::type
460 template<typename _Tp>
462 : public integral_constant<bool, !is_fundamental<_Tp>::value> { };
464 /// is_member_pointer
465 template<typename _Tp>
466 struct __is_member_pointer_helper
467 : public false_type { };
469 template<typename _Tp, typename _Cp>
470 struct __is_member_pointer_helper<_Tp _Cp::*>
471 : public true_type { };
473 template<typename _Tp>
474 struct is_member_pointer
475 : public integral_constant<bool, (__is_member_pointer_helper<
476 typename remove_cv<_Tp>::type>::value)>
484 : public false_type { };
486 template<typename _Tp>
487 struct is_const<_Tp const>
488 : public true_type { };
493 : public false_type { };
495 template<typename _Tp>
496 struct is_volatile<_Tp volatile>
497 : public true_type { };
500 template<typename _Tp>
502 : public integral_constant<bool, __is_trivial(_Tp)>
505 /// is_trivially_copyable (still unimplemented)
507 /// is_standard_layout
508 template<typename _Tp>
509 struct is_standard_layout
510 : public integral_constant<bool, __is_standard_layout(_Tp)>
514 // Could use is_standard_layout && is_trivial instead of the builtin.
515 template<typename _Tp>
517 : public integral_constant<bool, __is_pod(_Tp)>
521 template<typename _Tp>
522 struct is_literal_type
523 : public integral_constant<bool, __is_literal_type(_Tp)>
527 template<typename _Tp>
529 : public integral_constant<bool, __is_empty(_Tp)>
533 template<typename _Tp>
534 struct is_polymorphic
535 : public integral_constant<bool, __is_polymorphic(_Tp)>
539 template<typename _Tp>
541 : public integral_constant<bool, __is_abstract(_Tp)>
544 template<typename _Tp,
545 bool = is_integral<_Tp>::value,
546 bool = is_floating_point<_Tp>::value>
547 struct __is_signed_helper
548 : public false_type { };
550 template<typename _Tp>
551 struct __is_signed_helper<_Tp, false, true>
552 : public true_type { };
554 template<typename _Tp>
555 struct __is_signed_helper<_Tp, true, false>
556 : public integral_constant<bool, static_cast<bool>(_Tp(-1) < _Tp(0))>
560 template<typename _Tp>
562 : public integral_constant<bool, __is_signed_helper<_Tp>::value>
566 template<typename _Tp>
568 : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
572 // destructible and constructible type properties
575 struct add_rvalue_reference;
577 template<typename _Tp>
578 typename add_rvalue_reference<_Tp>::type declval() noexcept;
580 template<typename, unsigned = 0>
584 struct remove_all_extents;
586 template<typename _Tp>
587 struct __is_array_known_bounds
588 : public integral_constant<bool, (extent<_Tp>::value > 0)>
591 template<typename _Tp>
592 struct __is_array_unknown_bounds
593 : public __and_<is_array<_Tp>, __not_<extent<_Tp>>>::type
596 // In N3290 is_destructible does not say anything about function
597 // types and abstract types, see LWG 2049. This implementation
598 // describes function types as trivially nothrow destructible and
599 // abstract types as destructible, iff the explicit destructor
600 // call expression is wellformed.
601 struct __do_is_destructible_impl_1
603 template<typename _Up>
604 struct __w { _Up __u; };
606 template<typename _Tp, typename
607 = decltype(declval<__w<_Tp>&>().~__w<_Tp>())>
608 static true_type __test(int);
611 static false_type __test(...);
614 template<typename _Tp>
615 struct __is_destructible_impl_1
616 : public __do_is_destructible_impl_1
618 typedef decltype(__test<_Tp>(0)) type;
621 // Special implementation for abstract types
622 struct __do_is_destructible_impl_2
624 template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())>
625 static true_type __test(int);
628 static false_type __test(...);
631 template<typename _Tp>
632 struct __is_destructible_impl_2
633 : public __do_is_destructible_impl_2
635 typedef decltype(__test<_Tp>(0)) type;
638 template<typename _Tp,
639 bool = __or_<is_void<_Tp>,
640 __is_array_unknown_bounds<_Tp>>::value,
641 bool = __or_<is_reference<_Tp>, is_function<_Tp>>::value>
642 struct __is_destructible_safe;
644 template<typename _Tp>
645 struct __is_destructible_safe<_Tp, false, false>
646 : public conditional<is_abstract<_Tp>::value,
647 __is_destructible_impl_2<_Tp>,
648 __is_destructible_impl_1<_Tp>>::type::type
651 template<typename _Tp>
652 struct __is_destructible_safe<_Tp, true, false>
653 : public false_type { };
655 template<typename _Tp>
656 struct __is_destructible_safe<_Tp, false, true>
657 : public true_type { };
660 template<typename _Tp>
661 struct is_destructible
662 : public integral_constant<bool, (__is_destructible_safe<_Tp>::value)>
665 struct __do_is_default_constructible_impl
667 template<typename _Tp, typename = decltype(_Tp())>
668 static true_type __test(int);
671 static false_type __test(...);
674 template<typename _Tp>
675 struct __is_default_constructible_impl
676 : public __do_is_default_constructible_impl
678 typedef decltype(__test<_Tp>(0)) type;
681 template<typename _Tp>
682 struct __is_default_constructible_atom
683 : public __and_<__not_<is_void<_Tp>>,
684 __is_default_constructible_impl<_Tp>>::type
687 template<typename _Tp, bool = is_array<_Tp>::value>
688 struct __is_default_constructible_safe;
690 // The following technique is a workaround for a current core language
691 // restriction, which does not allow for array types to occur in
692 // functional casts of the form T(). Complete arrays can be default-
693 // constructed, if the element type is default-constructible, but
694 // arrays with unknown bounds are not.
695 template<typename _Tp>
696 struct __is_default_constructible_safe<_Tp, true>
697 : public __and_<__is_array_known_bounds<_Tp>,
698 __is_default_constructible_atom<typename
699 remove_all_extents<_Tp>::type>>::type
702 template<typename _Tp>
703 struct __is_default_constructible_safe<_Tp, false>
704 : public __is_default_constructible_atom<_Tp>::type
707 /// is_default_constructible
708 template<typename _Tp>
709 struct is_default_constructible
710 : public integral_constant<bool, (__is_default_constructible_safe<
715 // Implementation of is_constructible.
717 // The hardest part of this trait is the binary direct-initialization
718 // case, because we hit into a functional cast of the form T(arg).
719 // This implementation uses different strategies depending on the
720 // target type to reduce the test overhead as much as possible:
722 // a) For a reference target type, we use a static_cast expression
723 // modulo its extra cases.
725 // b) For a non-reference target type we use a ::new expression.
726 struct __do_is_static_castable_impl
728 template<typename _From, typename _To, typename
729 = decltype(static_cast<_To>(declval<_From>()))>
730 static true_type __test(int);
732 template<typename, typename>
733 static false_type __test(...);
736 template<typename _From, typename _To>
737 struct __is_static_castable_impl
738 : public __do_is_static_castable_impl
740 typedef decltype(__test<_From, _To>(0)) type;
743 template<typename _From, typename _To>
744 struct __is_static_castable_safe
745 : public __is_static_castable_impl<_From, _To>::type
748 // __is_static_castable
749 template<typename _From, typename _To>
750 struct __is_static_castable
751 : public integral_constant<bool, (__is_static_castable_safe<
755 // Implementation for non-reference types. To meet the proper
756 // variable definition semantics, we also need to test for
757 // is_destructible in this case.
758 struct __do_is_direct_constructible_impl
760 template<typename _Tp, typename _Arg, typename
761 = decltype(::new _Tp(declval<_Arg>()))>
762 static true_type __test(int);
764 template<typename, typename>
765 static false_type __test(...);
768 template<typename _Tp, typename _Arg>
769 struct __is_direct_constructible_impl
770 : public __do_is_direct_constructible_impl
772 typedef decltype(__test<_Tp, _Arg>(0)) type;
775 template<typename _Tp, typename _Arg>
776 struct __is_direct_constructible_new_safe
777 : public __and_<is_destructible<_Tp>,
778 __is_direct_constructible_impl<_Tp, _Arg>>::type
781 template<typename, typename>
784 template<typename, typename>
788 struct remove_reference;
790 template<typename _From, typename _To, bool
791 = is_reference<_From>::value>
792 struct __is_base_to_derived_ref;
794 template<typename _From, typename _To>
795 struct __is_base_to_derived_ref<_From, _To, true>
797 typedef typename remove_cv<typename remove_reference<_From
798 >::type>::type __src_t;
799 typedef typename remove_cv<typename remove_reference<_To
800 >::type>::type __dst_t;
801 typedef __and_<__not_<is_same<__src_t, __dst_t>>,
802 is_base_of<__src_t, __dst_t>> type;
803 static constexpr bool value = type::value;
806 template<typename _From, typename _To>
807 struct __is_base_to_derived_ref<_From, _To, false>
811 template<typename _From, typename _To, bool
812 = __and_<is_lvalue_reference<_From>,
813 is_rvalue_reference<_To>>::value>
814 struct __is_lvalue_to_rvalue_ref;
816 template<typename _From, typename _To>
817 struct __is_lvalue_to_rvalue_ref<_From, _To, true>
819 typedef typename remove_cv<typename remove_reference<
820 _From>::type>::type __src_t;
821 typedef typename remove_cv<typename remove_reference<
822 _To>::type>::type __dst_t;
823 typedef __or_<is_same<__src_t, __dst_t>,
824 is_base_of<__dst_t, __src_t>> type;
825 static constexpr bool value = type::value;
828 template<typename _From, typename _To>
829 struct __is_lvalue_to_rvalue_ref<_From, _To, false>
833 // Here we handle direct-initialization to a reference type as
834 // equivalent to a static_cast modulo overshooting conversions.
835 // These are restricted to the following conversions:
836 // a) A glvalue of a base class to a derived class reference
837 // b) An lvalue to an rvalue-reference of reference-compatible
839 template<typename _Tp, typename _Arg>
840 struct __is_direct_constructible_ref_cast
841 : public __and_<__is_static_castable<_Arg, _Tp>,
842 __not_<__or_<__is_base_to_derived_ref<_Arg, _Tp>,
843 __is_lvalue_to_rvalue_ref<_Arg, _Tp>
847 template<typename _Tp, typename _Arg>
848 struct __is_direct_constructible_new
849 : public conditional<is_reference<_Tp>::value,
850 __is_direct_constructible_ref_cast<_Tp, _Arg>,
851 __is_direct_constructible_new_safe<_Tp, _Arg>
855 template<typename _Tp, typename _Arg>
856 struct __is_direct_constructible
857 : public integral_constant<bool, (__is_direct_constructible_new<
861 // Since default-construction and binary direct-initialization have
862 // been handled separately, the implementation of the remaining
863 // n-ary construction cases is rather straightforward.
864 struct __do_is_nary_constructible_impl
866 template<typename _Tp, typename... _Args, typename
867 = decltype(_Tp(declval<_Args>()...))>
868 static true_type __test(int);
870 template<typename, typename...>
871 static false_type __test(...);
874 template<typename _Tp, typename... _Args>
875 struct __is_nary_constructible_impl
876 : public __do_is_nary_constructible_impl
878 typedef decltype(__test<_Tp, _Args...>(0)) type;
881 template<typename _Tp, typename... _Args>
882 struct __is_nary_constructible
883 : public __is_nary_constructible_impl<_Tp, _Args...>::type
885 static_assert(sizeof...(_Args) > 1,
886 "Only useful for > 1 arguments");
889 template<typename _Tp, typename... _Args>
890 struct __is_constructible_impl
891 : public __is_nary_constructible<_Tp, _Args...>
894 template<typename _Tp, typename _Arg>
895 struct __is_constructible_impl<_Tp, _Arg>
896 : public __is_direct_constructible<_Tp, _Arg>
899 template<typename _Tp>
900 struct __is_constructible_impl<_Tp>
901 : public is_default_constructible<_Tp>
905 template<typename _Tp, typename... _Args>
906 struct is_constructible
907 : public integral_constant<bool, (__is_constructible_impl<_Tp,
911 template<typename _Tp, bool = is_void<_Tp>::value>
912 struct __is_copy_constructible_impl;
914 template<typename _Tp>
915 struct __is_copy_constructible_impl<_Tp, true>
916 : public false_type { };
918 template<typename _Tp>
919 struct __is_copy_constructible_impl<_Tp, false>
920 : public is_constructible<_Tp, const _Tp&>
923 /// is_copy_constructible
924 template<typename _Tp>
925 struct is_copy_constructible
926 : public __is_copy_constructible_impl<_Tp>
929 template<typename _Tp, bool = is_void<_Tp>::value>
930 struct __is_move_constructible_impl;
932 template<typename _Tp>
933 struct __is_move_constructible_impl<_Tp, true>
934 : public false_type { };
936 template<typename _Tp>
937 struct __is_move_constructible_impl<_Tp, false>
938 : public is_constructible<_Tp, _Tp&&>
941 /// is_move_constructible
942 template<typename _Tp>
943 struct is_move_constructible
944 : public __is_move_constructible_impl<_Tp>
947 template<typename _Tp>
948 struct __is_nt_default_constructible_atom
949 : public integral_constant<bool, noexcept(_Tp())>
952 template<typename _Tp, bool = is_array<_Tp>::value>
953 struct __is_nt_default_constructible_impl;
955 template<typename _Tp>
956 struct __is_nt_default_constructible_impl<_Tp, true>
957 : public __and_<__is_array_known_bounds<_Tp>,
958 __is_nt_default_constructible_atom<typename
959 remove_all_extents<_Tp>::type>>::type
962 template<typename _Tp>
963 struct __is_nt_default_constructible_impl<_Tp, false>
964 : public __is_nt_default_constructible_atom<_Tp>
967 /// is_nothrow_default_constructible
968 template<typename _Tp>
969 struct is_nothrow_default_constructible
970 : public __and_<is_default_constructible<_Tp>,
971 __is_nt_default_constructible_impl<_Tp>>::type
974 template<typename _Tp, typename... _Args>
975 struct __is_nt_constructible_impl
976 : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
979 template<typename _Tp, typename _Arg>
980 struct __is_nt_constructible_impl<_Tp, _Arg>
981 : public integral_constant<bool,
982 noexcept(static_cast<_Tp>(declval<_Arg>()))>
985 template<typename _Tp>
986 struct __is_nt_constructible_impl<_Tp>
987 : public is_nothrow_default_constructible<_Tp>
990 /// is_nothrow_constructible
991 template<typename _Tp, typename... _Args>
992 struct is_nothrow_constructible
993 : public __and_<is_constructible<_Tp, _Args...>,
994 __is_nt_constructible_impl<_Tp, _Args...>>::type
997 template<typename _Tp, bool = is_void<_Tp>::value>
998 struct __is_nothrow_copy_constructible_impl;
1000 template<typename _Tp>
1001 struct __is_nothrow_copy_constructible_impl<_Tp, true>
1002 : public false_type { };
1004 template<typename _Tp>
1005 struct __is_nothrow_copy_constructible_impl<_Tp, false>
1006 : public is_nothrow_constructible<_Tp, const _Tp&>
1009 /// is_nothrow_copy_constructible
1010 template<typename _Tp>
1011 struct is_nothrow_copy_constructible
1012 : public __is_nothrow_copy_constructible_impl<_Tp>
1015 template<typename _Tp, bool = is_void<_Tp>::value>
1016 struct __is_nothrow_move_constructible_impl;
1018 template<typename _Tp>
1019 struct __is_nothrow_move_constructible_impl<_Tp, true>
1020 : public false_type { };
1022 template<typename _Tp>
1023 struct __is_nothrow_move_constructible_impl<_Tp, false>
1024 : public is_nothrow_constructible<_Tp, _Tp&&>
1027 /// is_nothrow_move_constructible
1028 template<typename _Tp>
1029 struct is_nothrow_move_constructible
1030 : public __is_nothrow_move_constructible_impl<_Tp>
1033 template<typename _Tp, typename _Up>
1034 class __is_assignable_helper
1035 : public __sfinae_types
1037 template<typename _Tp1, typename _Up1>
1038 static decltype(declval<_Tp1>() = declval<_Up1>(), __one())
1041 template<typename, typename>
1042 static __two __test(...);
1045 static constexpr bool value = sizeof(__test<_Tp, _Up>(0)) == 1;
1049 template<typename _Tp, typename _Up>
1050 struct is_assignable
1051 : public integral_constant<bool,
1052 __is_assignable_helper<_Tp, _Up>::value>
1055 template<typename _Tp, bool = is_void<_Tp>::value>
1056 struct __is_copy_assignable_impl;
1058 template<typename _Tp>
1059 struct __is_copy_assignable_impl<_Tp, true>
1060 : public false_type { };
1062 template<typename _Tp>
1063 struct __is_copy_assignable_impl<_Tp, false>
1064 : public is_assignable<_Tp&, const _Tp&>
1067 /// is_copy_assignable
1068 template<typename _Tp>
1069 struct is_copy_assignable
1070 : public __is_copy_assignable_impl<_Tp>
1073 template<typename _Tp, bool = is_void<_Tp>::value>
1074 struct __is_move_assignable_impl;
1076 template<typename _Tp>
1077 struct __is_move_assignable_impl<_Tp, true>
1078 : public false_type { };
1080 template<typename _Tp>
1081 struct __is_move_assignable_impl<_Tp, false>
1082 : public is_assignable<_Tp&, _Tp&&>
1085 /// is_move_assignable
1086 template<typename _Tp>
1087 struct is_move_assignable
1088 : public __is_move_assignable_impl<_Tp>
1091 template<typename _Tp, typename _Up>
1092 struct __is_nt_assignable_impl
1093 : public integral_constant<bool, noexcept(declval<_Tp>() = declval<_Up>())>
1096 /// is_nothrow_assignable
1097 template<typename _Tp, typename _Up>
1098 struct is_nothrow_assignable
1099 : public __and_<is_assignable<_Tp, _Up>,
1100 __is_nt_assignable_impl<_Tp, _Up>>::type
1103 template<typename _Tp, bool = is_void<_Tp>::value>
1104 struct __is_nt_copy_assignable_impl;
1106 template<typename _Tp>
1107 struct __is_nt_copy_assignable_impl<_Tp, true>
1108 : public false_type { };
1110 template<typename _Tp>
1111 struct __is_nt_copy_assignable_impl<_Tp, false>
1112 : public is_nothrow_assignable<_Tp&, const _Tp&>
1115 /// is_nothrow_copy_assignable
1116 template<typename _Tp>
1117 struct is_nothrow_copy_assignable
1118 : public __is_nt_copy_assignable_impl<_Tp>
1121 template<typename _Tp, bool = is_void<_Tp>::value>
1122 struct __is_nt_move_assignable_impl;
1124 template<typename _Tp>
1125 struct __is_nt_move_assignable_impl<_Tp, true>
1126 : public false_type { };
1128 template<typename _Tp>
1129 struct __is_nt_move_assignable_impl<_Tp, false>
1130 : public is_nothrow_assignable<_Tp&, _Tp&&>
1133 /// is_nothrow_move_assignable
1134 template<typename _Tp>
1135 struct is_nothrow_move_assignable
1136 : public __is_nt_move_assignable_impl<_Tp>
1139 /// has_trivial_default_constructor
1140 template<typename _Tp>
1141 struct has_trivial_default_constructor
1142 : public integral_constant<bool, __has_trivial_constructor(_Tp)>
1145 /// has_trivial_copy_constructor
1146 template<typename _Tp>
1147 struct has_trivial_copy_constructor
1148 : public integral_constant<bool, __has_trivial_copy(_Tp)>
1151 /// has_trivial_copy_assign
1152 template<typename _Tp>
1153 struct has_trivial_copy_assign
1154 : public integral_constant<bool, __has_trivial_assign(_Tp)>
1157 /// has_trivial_destructor
1158 template<typename _Tp>
1159 struct has_trivial_destructor
1160 : public integral_constant<bool, __has_trivial_destructor(_Tp)>
1163 /// has_virtual_destructor
1164 template<typename _Tp>
1165 struct has_virtual_destructor
1166 : public integral_constant<bool, __has_virtual_destructor(_Tp)>
1170 // type property queries.
1173 template<typename _Tp>
1175 : public integral_constant<size_t, __alignof__(_Tp)> { };
1180 : public integral_constant<size_t, 0> { };
1182 template<typename _Tp, size_t _Size>
1183 struct rank<_Tp[_Size]>
1184 : public integral_constant<size_t, 1 + rank<_Tp>::value> { };
1186 template<typename _Tp>
1188 : public integral_constant<size_t, 1 + rank<_Tp>::value> { };
1191 template<typename, unsigned _Uint>
1193 : public integral_constant<size_t, 0> { };
1195 template<typename _Tp, unsigned _Uint, size_t _Size>
1196 struct extent<_Tp[_Size], _Uint>
1197 : public integral_constant<size_t,
1198 _Uint == 0 ? _Size : extent<_Tp,
1202 template<typename _Tp, unsigned _Uint>
1203 struct extent<_Tp[], _Uint>
1204 : public integral_constant<size_t,
1205 _Uint == 0 ? 0 : extent<_Tp,
1213 template<typename, typename>
1215 : public false_type { };
1217 template<typename _Tp>
1218 struct is_same<_Tp, _Tp>
1219 : public true_type { };
1222 template<typename _Base, typename _Derived>
1224 : public integral_constant<bool, __is_base_of(_Base, _Derived)>
1227 template<typename _From, typename _To,
1228 bool = __or_<is_void<_From>, is_function<_To>,
1229 is_array<_To>>::value>
1230 struct __is_convertible_helper
1231 { static constexpr bool value = is_void<_To>::value; };
1233 template<typename _From, typename _To>
1234 class __is_convertible_helper<_From, _To, false>
1235 : public __sfinae_types
1237 template<typename _To1>
1238 static void __test_aux(_To1);
1240 template<typename _From1, typename _To1>
1241 static decltype(__test_aux<_To1>(declval<_From1>()), __one())
1244 template<typename, typename>
1245 static __two __test(...);
1248 static constexpr bool value = sizeof(__test<_From, _To>(0)) == 1;
1252 template<typename _From, typename _To>
1253 struct is_convertible
1254 : public integral_constant<bool,
1255 __is_convertible_helper<_From, _To>::value>
1258 /// is_explicitly_convertible
1259 template<typename _From, typename _To>
1260 struct is_explicitly_convertible
1261 : public is_constructible<_To, _From>
1265 // const-volatile modifications.
1268 template<typename _Tp>
1270 { typedef _Tp type; };
1272 template<typename _Tp>
1273 struct remove_const<_Tp const>
1274 { typedef _Tp type; };
1277 template<typename _Tp>
1278 struct remove_volatile
1279 { typedef _Tp type; };
1281 template<typename _Tp>
1282 struct remove_volatile<_Tp volatile>
1283 { typedef _Tp type; };
1286 template<typename _Tp>
1290 remove_const<typename remove_volatile<_Tp>::type>::type type;
1294 template<typename _Tp>
1296 { typedef _Tp const type; };
1299 template<typename _Tp>
1301 { typedef _Tp volatile type; };
1304 template<typename _Tp>
1308 add_const<typename add_volatile<_Tp>::type>::type type;
1312 // Reference transformations.
1314 /// remove_reference
1315 template<typename _Tp>
1316 struct remove_reference
1317 { typedef _Tp type; };
1319 template<typename _Tp>
1320 struct remove_reference<_Tp&>
1321 { typedef _Tp type; };
1323 template<typename _Tp>
1324 struct remove_reference<_Tp&&>
1325 { typedef _Tp type; };
1327 template<typename _Tp,
1328 bool = __and_<__not_<is_reference<_Tp>>,
1329 __not_<is_void<_Tp>>>::value,
1330 bool = is_rvalue_reference<_Tp>::value>
1331 struct __add_lvalue_reference_helper
1332 { typedef _Tp type; };
1334 template<typename _Tp>
1335 struct __add_lvalue_reference_helper<_Tp, true, false>
1336 { typedef _Tp& type; };
1338 template<typename _Tp>
1339 struct __add_lvalue_reference_helper<_Tp, false, true>
1340 { typedef typename remove_reference<_Tp>::type& type; };
1342 /// add_lvalue_reference
1343 template<typename _Tp>
1344 struct add_lvalue_reference
1345 : public __add_lvalue_reference_helper<_Tp>
1348 template<typename _Tp,
1349 bool = __and_<__not_<is_reference<_Tp>>,
1350 __not_<is_void<_Tp>>>::value>
1351 struct __add_rvalue_reference_helper
1352 { typedef _Tp type; };
1354 template<typename _Tp>
1355 struct __add_rvalue_reference_helper<_Tp, true>
1356 { typedef _Tp&& type; };
1358 /// add_rvalue_reference
1359 template<typename _Tp>
1360 struct add_rvalue_reference
1361 : public __add_rvalue_reference_helper<_Tp>
1365 // sign modifications.
1367 // Utility for constructing identically cv-qualified types.
1368 template<typename _Unqualified, bool _IsConst, bool _IsVol>
1369 struct __cv_selector;
1371 template<typename _Unqualified>
1372 struct __cv_selector<_Unqualified, false, false>
1373 { typedef _Unqualified __type; };
1375 template<typename _Unqualified>
1376 struct __cv_selector<_Unqualified, false, true>
1377 { typedef volatile _Unqualified __type; };
1379 template<typename _Unqualified>
1380 struct __cv_selector<_Unqualified, true, false>
1381 { typedef const _Unqualified __type; };
1383 template<typename _Unqualified>
1384 struct __cv_selector<_Unqualified, true, true>
1385 { typedef const volatile _Unqualified __type; };
1387 template<typename _Qualified, typename _Unqualified,
1388 bool _IsConst = is_const<_Qualified>::value,
1389 bool _IsVol = is_volatile<_Qualified>::value>
1390 class __match_cv_qualifiers
1392 typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match;
1395 typedef typename __match::__type __type;
1398 // Utility for finding the unsigned versions of signed integral types.
1399 template<typename _Tp>
1400 struct __make_unsigned
1401 { typedef _Tp __type; };
1404 struct __make_unsigned<char>
1405 { typedef unsigned char __type; };
1408 struct __make_unsigned<signed char>
1409 { typedef unsigned char __type; };
1412 struct __make_unsigned<short>
1413 { typedef unsigned short __type; };
1416 struct __make_unsigned<int>
1417 { typedef unsigned int __type; };
1420 struct __make_unsigned<long>
1421 { typedef unsigned long __type; };
1424 struct __make_unsigned<long long>
1425 { typedef unsigned long long __type; };
1427 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
1429 struct __make_unsigned<__int128>
1430 { typedef unsigned __int128 __type; };
1433 // Select between integral and enum: not possible to be both.
1434 template<typename _Tp,
1435 bool _IsInt = is_integral<_Tp>::value,
1436 bool _IsEnum = is_enum<_Tp>::value>
1437 class __make_unsigned_selector;
1439 template<typename _Tp>
1440 class __make_unsigned_selector<_Tp, true, false>
1442 typedef __make_unsigned<typename remove_cv<_Tp>::type> __unsignedt;
1443 typedef typename __unsignedt::__type __unsigned_type;
1444 typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
1447 typedef typename __cv_unsigned::__type __type;
1450 template<typename _Tp>
1451 class __make_unsigned_selector<_Tp, false, true>
1453 // With -fshort-enums, an enum may be as small as a char.
1454 typedef unsigned char __smallest;
1455 static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest);
1456 static const bool __b1 = sizeof(_Tp) <= sizeof(unsigned short);
1457 static const bool __b2 = sizeof(_Tp) <= sizeof(unsigned int);
1458 typedef conditional<__b2, unsigned int, unsigned long> __cond2;
1459 typedef typename __cond2::type __cond2_type;
1460 typedef conditional<__b1, unsigned short, __cond2_type> __cond1;
1461 typedef typename __cond1::type __cond1_type;
1464 typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
1467 // Given an integral/enum type, return the corresponding unsigned
1469 // Primary template.
1471 template<typename _Tp>
1472 struct make_unsigned
1473 { typedef typename __make_unsigned_selector<_Tp>::__type type; };
1475 // Integral, but don't define.
1477 struct make_unsigned<bool>;
1480 // Utility for finding the signed versions of unsigned integral types.
1481 template<typename _Tp>
1482 struct __make_signed
1483 { typedef _Tp __type; };
1486 struct __make_signed<char>
1487 { typedef signed char __type; };
1490 struct __make_signed<unsigned char>
1491 { typedef signed char __type; };
1494 struct __make_signed<unsigned short>
1495 { typedef signed short __type; };
1498 struct __make_signed<unsigned int>
1499 { typedef signed int __type; };
1502 struct __make_signed<unsigned long>
1503 { typedef signed long __type; };
1506 struct __make_signed<unsigned long long>
1507 { typedef signed long long __type; };
1509 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
1511 struct __make_signed<unsigned __int128>
1512 { typedef __int128 __type; };
1515 // Select between integral and enum: not possible to be both.
1516 template<typename _Tp,
1517 bool _IsInt = is_integral<_Tp>::value,
1518 bool _IsEnum = is_enum<_Tp>::value>
1519 class __make_signed_selector;
1521 template<typename _Tp>
1522 class __make_signed_selector<_Tp, true, false>
1524 typedef __make_signed<typename remove_cv<_Tp>::type> __signedt;
1525 typedef typename __signedt::__type __signed_type;
1526 typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed;
1529 typedef typename __cv_signed::__type __type;
1532 template<typename _Tp>
1533 class __make_signed_selector<_Tp, false, true>
1535 // With -fshort-enums, an enum may be as small as a char.
1536 typedef signed char __smallest;
1537 static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest);
1538 static const bool __b1 = sizeof(_Tp) <= sizeof(signed short);
1539 static const bool __b2 = sizeof(_Tp) <= sizeof(signed int);
1540 typedef conditional<__b2, signed int, signed long> __cond2;
1541 typedef typename __cond2::type __cond2_type;
1542 typedef conditional<__b1, signed short, __cond2_type> __cond1;
1543 typedef typename __cond1::type __cond1_type;
1546 typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
1549 // Given an integral/enum type, return the corresponding signed
1551 // Primary template.
1553 template<typename _Tp>
1555 { typedef typename __make_signed_selector<_Tp>::__type type; };
1557 // Integral, but don't define.
1559 struct make_signed<bool>;
1562 // array modifications.
1565 template<typename _Tp>
1566 struct remove_extent
1567 { typedef _Tp type; };
1569 template<typename _Tp, size_t _Size>
1570 struct remove_extent<_Tp[_Size]>
1571 { typedef _Tp type; };
1573 template<typename _Tp>
1574 struct remove_extent<_Tp[]>
1575 { typedef _Tp type; };
1577 /// remove_all_extents
1578 template<typename _Tp>
1579 struct remove_all_extents
1580 { typedef _Tp type; };
1582 template<typename _Tp, size_t _Size>
1583 struct remove_all_extents<_Tp[_Size]>
1584 { typedef typename remove_all_extents<_Tp>::type type; };
1586 template<typename _Tp>
1587 struct remove_all_extents<_Tp[]>
1588 { typedef typename remove_all_extents<_Tp>::type type; };
1591 // pointer modifications.
1593 template<typename _Tp, typename>
1594 struct __remove_pointer_helper
1595 { typedef _Tp type; };
1597 template<typename _Tp, typename _Up>
1598 struct __remove_pointer_helper<_Tp, _Up*>
1599 { typedef _Up type; };
1602 template<typename _Tp>
1603 struct remove_pointer
1604 : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
1608 template<typename _Tp>
1610 { typedef typename remove_reference<_Tp>::type* type; };
1613 template<size_t _Len>
1614 struct __aligned_storage_msa
1618 unsigned char __data[_Len];
1619 struct __attribute__((__aligned__)) { } __align;
1624 * @brief Alignment type.
1626 * The value of _Align is a default-alignment which shall be the
1627 * most stringent alignment requirement for any C++ object type
1628 * whose size is no greater than _Len (3.9). The member typedef
1629 * type shall be a POD type suitable for use as uninitialized
1630 * storage for any object whose size is at most _Len and whose
1631 * alignment is a divisor of _Align.
1633 template<size_t _Len, size_t _Align =
1634 __alignof__(typename __aligned_storage_msa<_Len>::__type)>
1635 struct aligned_storage
1639 unsigned char __data[_Len];
1640 struct __attribute__((__aligned__((_Align)))) { } __align;
1645 // Decay trait for arrays and functions, used for perfect forwarding
1646 // in make_pair, make_tuple, etc.
1647 template<typename _Up,
1648 bool _IsArray = is_array<_Up>::value,
1649 bool _IsFunction = is_function<_Up>::value>
1650 struct __decay_selector;
1653 template<typename _Up>
1654 struct __decay_selector<_Up, false, false>
1655 { typedef typename remove_cv<_Up>::type __type; };
1657 template<typename _Up>
1658 struct __decay_selector<_Up, true, false>
1659 { typedef typename remove_extent<_Up>::type* __type; };
1661 template<typename _Up>
1662 struct __decay_selector<_Up, false, true>
1663 { typedef typename add_pointer<_Up>::type __type; };
1666 template<typename _Tp>
1669 typedef typename remove_reference<_Tp>::type __remove_type;
1672 typedef typename __decay_selector<__remove_type>::__type type;
1675 template<typename _Tp>
1676 class reference_wrapper;
1678 // Helper which adds a reference to a type when given a reference_wrapper
1679 template<typename _Tp>
1680 struct __strip_reference_wrapper
1685 template<typename _Tp>
1686 struct __strip_reference_wrapper<reference_wrapper<_Tp> >
1688 typedef _Tp& __type;
1691 template<typename _Tp>
1692 struct __strip_reference_wrapper<const reference_wrapper<_Tp> >
1694 typedef _Tp& __type;
1697 template<typename _Tp>
1698 struct __decay_and_strip
1700 typedef typename __strip_reference_wrapper<
1701 typename decay<_Tp>::type>::__type __type;
1705 // Define a nested type if some predicate holds.
1706 // Primary template.
1708 template<bool, typename _Tp = void>
1712 // Partial specialization for true.
1713 template<typename _Tp>
1714 struct enable_if<true, _Tp>
1715 { typedef _Tp type; };
1718 // A conditional expression, but for types. If true, first, if false, second.
1719 // Primary template.
1721 template<bool _Cond, typename _Iftrue, typename _Iffalse>
1723 { typedef _Iftrue type; };
1725 // Partial specialization for false.
1726 template<typename _Iftrue, typename _Iffalse>
1727 struct conditional<false, _Iftrue, _Iffalse>
1728 { typedef _Iffalse type; };
1732 template<typename... _Tp>
1735 template<typename _Tp>
1736 struct common_type<_Tp>
1737 { typedef _Tp type; };
1739 template<typename _Tp, typename _Up>
1740 struct common_type<_Tp, _Up>
1741 { typedef decltype(true ? declval<_Tp>() : declval<_Up>()) type; };
1743 template<typename _Tp, typename _Up, typename... _Vp>
1744 struct common_type<_Tp, _Up, _Vp...>
1747 common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type;
1751 template<typename _Tp>
1752 struct underlying_type
1754 typedef __underlying_type(_Tp) type;
1758 template<typename _Tp>
1759 struct __declval_protector
1761 static const bool __stop = false;
1762 static typename add_rvalue_reference<_Tp>::type __delegate();
1765 template<typename _Tp>
1766 inline typename add_rvalue_reference<_Tp>::type
1769 static_assert(__declval_protector<_Tp>::__stop,
1770 "declval() must not be used!");
1771 return __declval_protector<_Tp>::__delegate();
1775 template<typename _Signature>
1778 template<typename _MemPtr, typename _Arg>
1779 struct _Result_of_memobj;
1781 template<typename _Res, typename _Class, typename _Arg>
1782 struct _Result_of_memobj<_Res _Class::*, _Arg>
1785 typedef _Res _Class::* _Func;
1787 template<typename _Tp>
1788 static _Tp _S_get(const _Class&);
1789 template<typename _Tp>
1790 static decltype(*declval<_Tp>()) _S_get(...);
1794 decltype(_S_get<_Arg>(declval<_Arg>()).*declval<_Func>())
1798 template<typename _MemPtr, typename _Arg, typename... _ArgTypes>
1799 struct _Result_of_memfun;
1801 template<typename _Res, typename _Class, typename _Arg, typename... _Args>
1802 struct _Result_of_memfun<_Res _Class::*, _Arg, _Args...>
1805 typedef _Res _Class::* _Func;
1807 template<typename _Tp>
1808 static _Tp _S_get(const _Class&);
1809 template<typename _Tp>
1810 static decltype(*declval<_Tp>()) _S_get(...);
1814 decltype((_S_get<_Arg>(declval<_Arg>()).*declval<_Func>())
1815 (declval<_Args>()...) )
1819 template<bool, bool, typename _Functor, typename... _ArgTypes>
1820 struct _Result_of_impl;
1822 template<typename _Functor, typename... _ArgTypes>
1823 struct _Result_of_impl<false, false, _Functor, _ArgTypes...>
1826 decltype( declval<_Functor>()(declval<_ArgTypes>()...) )
1830 template<typename _MemPtr, typename _Arg>
1831 struct _Result_of_impl<true, false, _MemPtr, _Arg>
1832 : _Result_of_memobj<typename remove_reference<_MemPtr>::type, _Arg>
1834 typedef typename _Result_of_memobj<
1835 typename remove_reference<_MemPtr>::type, _Arg>::__type
1839 template<typename _MemPtr, typename _Arg, typename... _ArgTypes>
1840 struct _Result_of_impl<false, true, _MemPtr, _Arg, _ArgTypes...>
1841 : _Result_of_memfun<typename remove_reference<_MemPtr>::type, _Arg,
1844 typedef typename _Result_of_memfun<
1845 typename remove_reference<_MemPtr>::type, _Arg, _ArgTypes...>::__type
1849 template<typename _Functor, typename... _ArgTypes>
1850 struct result_of<_Functor(_ArgTypes...)>
1851 : _Result_of_impl<is_member_object_pointer<
1852 typename remove_reference<_Functor>::type >::value,
1853 is_member_function_pointer<
1854 typename remove_reference<_Functor>::type >::value,
1855 _Functor, _ArgTypes...>
1857 typedef typename _Result_of_impl<
1858 is_member_object_pointer<
1859 typename remove_reference<_Functor>::type >::value,
1860 is_member_function_pointer<
1861 typename remove_reference<_Functor>::type >::value,
1862 _Functor, _ArgTypes...>::__type
1867 * Use SFINAE to determine if the type _Tp has a publicly-accessible
1868 * member type _NTYPE.
1870 #define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
1871 template<typename _Tp> \
1872 class __has_##_NTYPE##_helper \
1875 template<typename _Up> \
1879 template<typename _Up> \
1880 static __one __test(_Wrap_type<typename _Up::_NTYPE>*); \
1882 template<typename _Up> \
1883 static __two __test(...); \
1886 static constexpr bool value = sizeof(__test<_Tp>(0)) == 1; \
1889 template<typename _Tp> \
1890 struct __has_##_NTYPE \
1891 : integral_constant<bool, __has_##_NTYPE##_helper \
1892 <typename remove_cv<_Tp>::type>::value> \
1895 // @} group metaprogramming
1896 // _GLIBCXX_END_NAMESPACE_VERSION
1899 // #endif // __GXX_EXPERIMENTAL_CXX0X__
1901 #endif // _GLIBCXX_TYPE_TRAITS