1 // C++11 type_traits -*- C++ -*-
3 // Copyright (C) 2007, 2008, 2009, 2010, 2011 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 /** @file include/type_traits
26 * This is a Standard C++ Library header.
29 #ifndef _GLIBCXX_TYPE_TRAITS
30 #define _GLIBCXX_TYPE_TRAITS 1
32 #pragma GCC system_header
34 #ifndef __GXX_EXPERIMENTAL_CXX0X__
35 # include <bits/c++0x_warning.h>
38 #include <bits/c++config.h>
40 namespace std _GLIBCXX_VISIBILITY(default)
42 _GLIBCXX_BEGIN_NAMESPACE_VERSION
45 * @defgroup metaprogramming Metaprogramming and type traits
48 * Template utilities for compile-time introspection and modification,
49 * including type classification traits, type property inspection traits
50 * and type transformation traits.
56 template<typename _Tp, _Tp __v>
57 struct integral_constant
59 static constexpr _Tp value = __v;
60 typedef _Tp value_type;
61 typedef integral_constant<_Tp, __v> type;
62 constexpr operator value_type() { return value; }
65 /// The type used as a compile-time boolean with true value.
66 typedef integral_constant<bool, true> true_type;
68 /// The type used as a compile-time boolean with false value.
69 typedef integral_constant<bool, false> false_type;
71 template<typename _Tp, _Tp __v>
72 constexpr _Tp integral_constant<_Tp, __v>::value;
74 // Meta programming helper types.
76 template<bool, typename, typename>
87 template<typename _B1>
92 template<typename _B1, typename _B2>
93 struct __or_<_B1, _B2>
94 : public conditional<_B1::value, _B1, _B2>::type
97 template<typename _B1, typename _B2, typename _B3, typename... _Bn>
98 struct __or_<_B1, _B2, _B3, _Bn...>
99 : public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type
102 template<typename...>
110 template<typename _B1>
115 template<typename _B1, typename _B2>
116 struct __and_<_B1, _B2>
117 : public conditional<_B1::value, _B2, _B1>::type
120 template<typename _B1, typename _B2, typename _B3, typename... _Bn>
121 struct __and_<_B1, _B2, _B3, _Bn...>
122 : public conditional<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>::type
125 template<typename _Pp>
127 : public integral_constant<bool, !_Pp::value>
130 struct __sfinae_types
133 typedef struct { char __arr[2]; } __two;
136 // primary type categories.
142 struct __is_void_helper
143 : public false_type { };
146 struct __is_void_helper<void>
147 : public true_type { };
150 template<typename _Tp>
152 : public integral_constant<bool, (__is_void_helper<typename
153 remove_cv<_Tp>::type>::value)>
157 struct __is_integral_helper
158 : public false_type { };
161 struct __is_integral_helper<bool>
162 : public true_type { };
165 struct __is_integral_helper<char>
166 : public true_type { };
169 struct __is_integral_helper<signed char>
170 : public true_type { };
173 struct __is_integral_helper<unsigned char>
174 : public true_type { };
176 #ifdef _GLIBCXX_USE_WCHAR_T
178 struct __is_integral_helper<wchar_t>
179 : public true_type { };
183 struct __is_integral_helper<char16_t>
184 : public true_type { };
187 struct __is_integral_helper<char32_t>
188 : public true_type { };
191 struct __is_integral_helper<short>
192 : public true_type { };
195 struct __is_integral_helper<unsigned short>
196 : public true_type { };
199 struct __is_integral_helper<int>
200 : public true_type { };
203 struct __is_integral_helper<unsigned int>
204 : public true_type { };
207 struct __is_integral_helper<long>
208 : public true_type { };
211 struct __is_integral_helper<unsigned long>
212 : public true_type { };
215 struct __is_integral_helper<long long>
216 : public true_type { };
219 struct __is_integral_helper<unsigned long long>
220 : public true_type { };
222 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
224 struct __is_integral_helper<__int128>
225 : public true_type { };
228 struct __is_integral_helper<unsigned __int128>
229 : public true_type { };
233 template<typename _Tp>
235 : public integral_constant<bool, (__is_integral_helper<typename
236 remove_cv<_Tp>::type>::value)>
240 struct __is_floating_point_helper
241 : public false_type { };
244 struct __is_floating_point_helper<float>
245 : public true_type { };
248 struct __is_floating_point_helper<double>
249 : public true_type { };
252 struct __is_floating_point_helper<long double>
253 : public true_type { };
255 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
257 struct __is_floating_point_helper<__float128>
258 : public true_type { };
261 /// is_floating_point
262 template<typename _Tp>
263 struct is_floating_point
264 : public integral_constant<bool, (__is_floating_point_helper<typename
265 remove_cv<_Tp>::type>::value)>
271 : public false_type { };
273 template<typename _Tp, std::size_t _Size>
274 struct is_array<_Tp[_Size]>
275 : public true_type { };
277 template<typename _Tp>
278 struct is_array<_Tp[]>
279 : public true_type { };
282 struct __is_pointer_helper
283 : public false_type { };
285 template<typename _Tp>
286 struct __is_pointer_helper<_Tp*>
287 : public true_type { };
290 template<typename _Tp>
292 : public integral_constant<bool, (__is_pointer_helper<typename
293 remove_cv<_Tp>::type>::value)>
296 /// is_lvalue_reference
298 struct is_lvalue_reference
299 : public false_type { };
301 template<typename _Tp>
302 struct is_lvalue_reference<_Tp&>
303 : public true_type { };
305 /// is_rvalue_reference
307 struct is_rvalue_reference
308 : public false_type { };
310 template<typename _Tp>
311 struct is_rvalue_reference<_Tp&&>
312 : public true_type { };
318 struct __is_member_object_pointer_helper
319 : public false_type { };
321 template<typename _Tp, typename _Cp>
322 struct __is_member_object_pointer_helper<_Tp _Cp::*>
323 : public integral_constant<bool, !is_function<_Tp>::value> { };
325 /// is_member_object_pointer
326 template<typename _Tp>
327 struct is_member_object_pointer
328 : public integral_constant<bool, (__is_member_object_pointer_helper<
329 typename remove_cv<_Tp>::type>::value)>
333 struct __is_member_function_pointer_helper
334 : public false_type { };
336 template<typename _Tp, typename _Cp>
337 struct __is_member_function_pointer_helper<_Tp _Cp::*>
338 : public integral_constant<bool, is_function<_Tp>::value> { };
340 /// is_member_function_pointer
341 template<typename _Tp>
342 struct is_member_function_pointer
343 : public integral_constant<bool, (__is_member_function_pointer_helper<
344 typename remove_cv<_Tp>::type>::value)>
348 template<typename _Tp>
350 : public integral_constant<bool, __is_enum(_Tp)>
354 template<typename _Tp>
356 : public integral_constant<bool, __is_union(_Tp)>
360 template<typename _Tp>
362 : public integral_constant<bool, __is_class(_Tp)>
368 : public false_type { };
370 template<typename _Res, typename... _ArgTypes>
371 struct is_function<_Res(_ArgTypes...)>
372 : public true_type { };
374 template<typename _Res, typename... _ArgTypes>
375 struct is_function<_Res(_ArgTypes......)>
376 : public true_type { };
378 template<typename _Res, typename... _ArgTypes>
379 struct is_function<_Res(_ArgTypes...) const>
380 : public true_type { };
382 template<typename _Res, typename... _ArgTypes>
383 struct is_function<_Res(_ArgTypes......) const>
384 : public true_type { };
386 template<typename _Res, typename... _ArgTypes>
387 struct is_function<_Res(_ArgTypes...) volatile>
388 : public true_type { };
390 template<typename _Res, typename... _ArgTypes>
391 struct is_function<_Res(_ArgTypes......) volatile>
392 : public true_type { };
394 template<typename _Res, typename... _ArgTypes>
395 struct is_function<_Res(_ArgTypes...) const volatile>
396 : public true_type { };
398 template<typename _Res, typename... _ArgTypes>
399 struct is_function<_Res(_ArgTypes......) const volatile>
400 : public true_type { };
403 struct __is_nullptr_t_helper
404 : public false_type { };
407 struct __is_nullptr_t_helper<std::nullptr_t>
408 : public true_type { };
410 // __is_nullptr_t (extension).
411 template<typename _Tp>
412 struct __is_nullptr_t
413 : public integral_constant<bool, (__is_nullptr_t_helper<typename
414 remove_cv<_Tp>::type>::value)>
417 // composite type categories.
420 template<typename _Tp>
422 : public __or_<is_lvalue_reference<_Tp>,
423 is_rvalue_reference<_Tp>>::type
427 template<typename _Tp>
429 : public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
433 template<typename _Tp>
434 struct is_fundamental
435 : public __or_<is_arithmetic<_Tp>, is_void<_Tp>>::type
439 template<typename _Tp>
441 : public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
446 struct is_member_pointer;
449 template<typename _Tp>
451 : public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
452 is_member_pointer<_Tp>, __is_nullptr_t<_Tp>>::type
456 template<typename _Tp>
458 : public integral_constant<bool, !is_fundamental<_Tp>::value> { };
460 template<typename _Tp>
461 struct __is_member_pointer_helper
462 : public false_type { };
464 template<typename _Tp, typename _Cp>
465 struct __is_member_pointer_helper<_Tp _Cp::*>
466 : public true_type { };
468 /// is_member_pointer
469 template<typename _Tp>
470 struct is_member_pointer
471 : public integral_constant<bool, (__is_member_pointer_helper<
472 typename remove_cv<_Tp>::type>::value)>
480 : public false_type { };
482 template<typename _Tp>
483 struct is_const<_Tp const>
484 : public true_type { };
489 : public false_type { };
491 template<typename _Tp>
492 struct is_volatile<_Tp volatile>
493 : public true_type { };
496 template<typename _Tp>
498 : public integral_constant<bool, __is_trivial(_Tp)>
501 // is_trivially_copyable (still unimplemented)
503 /// is_standard_layout
504 template<typename _Tp>
505 struct is_standard_layout
506 : public integral_constant<bool, __is_standard_layout(_Tp)>
510 // Could use is_standard_layout && is_trivial instead of the builtin.
511 template<typename _Tp>
513 : public integral_constant<bool, __is_pod(_Tp)>
517 template<typename _Tp>
518 struct is_literal_type
519 : public integral_constant<bool, __is_literal_type(_Tp)>
523 template<typename _Tp>
525 : public integral_constant<bool, __is_empty(_Tp)>
529 template<typename _Tp>
530 struct is_polymorphic
531 : public integral_constant<bool, __is_polymorphic(_Tp)>
535 template<typename _Tp>
537 : public integral_constant<bool, __is_abstract(_Tp)>
540 template<typename _Tp,
541 bool = is_integral<_Tp>::value,
542 bool = is_floating_point<_Tp>::value>
543 struct __is_signed_helper
544 : public false_type { };
546 template<typename _Tp>
547 struct __is_signed_helper<_Tp, false, true>
548 : public true_type { };
550 template<typename _Tp>
551 struct __is_signed_helper<_Tp, true, false>
552 : public integral_constant<bool, static_cast<bool>(_Tp(-1) < _Tp(0))>
556 template<typename _Tp>
558 : public integral_constant<bool, __is_signed_helper<_Tp>::value>
562 template<typename _Tp>
564 : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
568 // destructible and constructible type properties
571 struct add_rvalue_reference;
574 * @brief Utility to simplify expressions used in unevaluated operands
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 // This form should be simplified by a single expression:
759 // ::delete ::new _Tp(declval<_Arg>()), see c++/51222.
760 struct __do_is_direct_constructible_impl
762 template<typename _Tp, typename _Arg, typename
763 = decltype(::new _Tp(declval<_Arg>()))>
764 static true_type __test(int);
766 template<typename, typename>
767 static false_type __test(...);
770 template<typename _Tp, typename _Arg>
771 struct __is_direct_constructible_impl
772 : public __do_is_direct_constructible_impl
774 typedef decltype(__test<_Tp, _Arg>(0)) type;
777 template<typename _Tp, typename _Arg>
778 struct __is_direct_constructible_new_safe
779 : public __and_<is_destructible<_Tp>,
780 __is_direct_constructible_impl<_Tp, _Arg>>::type
783 template<typename, typename>
786 template<typename, typename>
790 struct remove_reference;
792 template<typename _From, typename _To, bool
793 = __not_<__or_<is_void<_From>,
794 is_function<_From>>>::value>
795 struct __is_base_to_derived_ref;
797 // Detect whether we have a downcast situation during
798 // reference binding.
799 template<typename _From, typename _To>
800 struct __is_base_to_derived_ref<_From, _To, true>
802 typedef typename remove_cv<typename remove_reference<_From
803 >::type>::type __src_t;
804 typedef typename remove_cv<typename remove_reference<_To
805 >::type>::type __dst_t;
806 typedef __and_<__not_<is_same<__src_t, __dst_t>>,
807 is_base_of<__src_t, __dst_t>> type;
808 static constexpr bool value = type::value;
811 template<typename _From, typename _To>
812 struct __is_base_to_derived_ref<_From, _To, false>
816 template<typename _From, typename _To, bool
817 = __and_<is_lvalue_reference<_From>,
818 is_rvalue_reference<_To>>::value>
819 struct __is_lvalue_to_rvalue_ref;
821 // Detect whether we have an lvalue of non-function type
822 // bound to a reference-compatible rvalue-reference.
823 template<typename _From, typename _To>
824 struct __is_lvalue_to_rvalue_ref<_From, _To, true>
826 typedef typename remove_cv<typename remove_reference<
827 _From>::type>::type __src_t;
828 typedef typename remove_cv<typename remove_reference<
829 _To>::type>::type __dst_t;
830 typedef __and_<__not_<is_function<__src_t>>,
831 __or_<is_same<__src_t, __dst_t>,
832 is_base_of<__dst_t, __src_t>>> type;
833 static constexpr bool value = type::value;
836 template<typename _From, typename _To>
837 struct __is_lvalue_to_rvalue_ref<_From, _To, false>
841 // Here we handle direct-initialization to a reference type as
842 // equivalent to a static_cast modulo overshooting conversions.
843 // These are restricted to the following conversions:
844 // a) A base class value to a derived class reference
845 // b) An lvalue to an rvalue-reference of reference-compatible
846 // types that are not functions
847 template<typename _Tp, typename _Arg>
848 struct __is_direct_constructible_ref_cast
849 : public __and_<__is_static_castable<_Arg, _Tp>,
850 __not_<__or_<__is_base_to_derived_ref<_Arg, _Tp>,
851 __is_lvalue_to_rvalue_ref<_Arg, _Tp>
855 template<typename _Tp, typename _Arg>
856 struct __is_direct_constructible_new
857 : public conditional<is_reference<_Tp>::value,
858 __is_direct_constructible_ref_cast<_Tp, _Arg>,
859 __is_direct_constructible_new_safe<_Tp, _Arg>
863 template<typename _Tp, typename _Arg>
864 struct __is_direct_constructible
865 : public integral_constant<bool, (__is_direct_constructible_new<
869 // Since default-construction and binary direct-initialization have
870 // been handled separately, the implementation of the remaining
871 // n-ary construction cases is rather straightforward. We can use
872 // here a functional cast, because array types are excluded anyway
873 // and this form is never interpreted as a C cast.
874 struct __do_is_nary_constructible_impl
876 template<typename _Tp, typename... _Args, typename
877 = decltype(_Tp(declval<_Args>()...))>
878 static true_type __test(int);
880 template<typename, typename...>
881 static false_type __test(...);
884 template<typename _Tp, typename... _Args>
885 struct __is_nary_constructible_impl
886 : public __do_is_nary_constructible_impl
888 typedef decltype(__test<_Tp, _Args...>(0)) type;
891 template<typename _Tp, typename... _Args>
892 struct __is_nary_constructible
893 : public __is_nary_constructible_impl<_Tp, _Args...>::type
895 static_assert(sizeof...(_Args) > 1,
896 "Only useful for > 1 arguments");
899 template<typename _Tp, typename... _Args>
900 struct __is_constructible_impl
901 : public __is_nary_constructible<_Tp, _Args...>
904 template<typename _Tp, typename _Arg>
905 struct __is_constructible_impl<_Tp, _Arg>
906 : public __is_direct_constructible<_Tp, _Arg>
909 template<typename _Tp>
910 struct __is_constructible_impl<_Tp>
911 : public is_default_constructible<_Tp>
915 template<typename _Tp, typename... _Args>
916 struct is_constructible
917 : public integral_constant<bool, (__is_constructible_impl<_Tp,
921 template<typename _Tp, bool = is_void<_Tp>::value>
922 struct __is_copy_constructible_impl;
924 template<typename _Tp>
925 struct __is_copy_constructible_impl<_Tp, true>
926 : public false_type { };
928 template<typename _Tp>
929 struct __is_copy_constructible_impl<_Tp, false>
930 : public is_constructible<_Tp, const _Tp&>
933 /// is_copy_constructible
934 template<typename _Tp>
935 struct is_copy_constructible
936 : public __is_copy_constructible_impl<_Tp>
939 template<typename _Tp, bool = is_void<_Tp>::value>
940 struct __is_move_constructible_impl;
942 template<typename _Tp>
943 struct __is_move_constructible_impl<_Tp, true>
944 : public false_type { };
946 template<typename _Tp>
947 struct __is_move_constructible_impl<_Tp, false>
948 : public is_constructible<_Tp, _Tp&&>
951 /// is_move_constructible
952 template<typename _Tp>
953 struct is_move_constructible
954 : public __is_move_constructible_impl<_Tp>
957 template<typename _Tp>
958 struct __is_nt_default_constructible_atom
959 : public integral_constant<bool, noexcept(_Tp())>
962 template<typename _Tp, bool = is_array<_Tp>::value>
963 struct __is_nt_default_constructible_impl;
965 template<typename _Tp>
966 struct __is_nt_default_constructible_impl<_Tp, true>
967 : public __and_<__is_array_known_bounds<_Tp>,
968 __is_nt_default_constructible_atom<typename
969 remove_all_extents<_Tp>::type>>::type
972 template<typename _Tp>
973 struct __is_nt_default_constructible_impl<_Tp, false>
974 : public __is_nt_default_constructible_atom<_Tp>
977 /// is_nothrow_default_constructible
978 template<typename _Tp>
979 struct is_nothrow_default_constructible
980 : public __and_<is_default_constructible<_Tp>,
981 __is_nt_default_constructible_impl<_Tp>>::type
984 template<typename _Tp, typename... _Args>
985 struct __is_nt_constructible_impl
986 : public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
989 template<typename _Tp, typename _Arg>
990 struct __is_nt_constructible_impl<_Tp, _Arg>
991 : public integral_constant<bool,
992 noexcept(static_cast<_Tp>(declval<_Arg>()))>
995 template<typename _Tp>
996 struct __is_nt_constructible_impl<_Tp>
997 : public is_nothrow_default_constructible<_Tp>
1000 /// is_nothrow_constructible
1001 template<typename _Tp, typename... _Args>
1002 struct is_nothrow_constructible
1003 : public __and_<is_constructible<_Tp, _Args...>,
1004 __is_nt_constructible_impl<_Tp, _Args...>>::type
1007 template<typename _Tp, bool = is_void<_Tp>::value>
1008 struct __is_nothrow_copy_constructible_impl;
1010 template<typename _Tp>
1011 struct __is_nothrow_copy_constructible_impl<_Tp, true>
1012 : public false_type { };
1014 template<typename _Tp>
1015 struct __is_nothrow_copy_constructible_impl<_Tp, false>
1016 : public is_nothrow_constructible<_Tp, const _Tp&>
1019 /// is_nothrow_copy_constructible
1020 template<typename _Tp>
1021 struct is_nothrow_copy_constructible
1022 : public __is_nothrow_copy_constructible_impl<_Tp>
1025 template<typename _Tp, bool = is_void<_Tp>::value>
1026 struct __is_nothrow_move_constructible_impl;
1028 template<typename _Tp>
1029 struct __is_nothrow_move_constructible_impl<_Tp, true>
1030 : public false_type { };
1032 template<typename _Tp>
1033 struct __is_nothrow_move_constructible_impl<_Tp, false>
1034 : public is_nothrow_constructible<_Tp, _Tp&&>
1037 /// is_nothrow_move_constructible
1038 template<typename _Tp>
1039 struct is_nothrow_move_constructible
1040 : public __is_nothrow_move_constructible_impl<_Tp>
1043 template<typename _Tp, typename _Up>
1044 class __is_assignable_helper
1045 : public __sfinae_types
1047 template<typename _Tp1, typename _Up1>
1048 static decltype(declval<_Tp1>() = declval<_Up1>(), __one())
1051 template<typename, typename>
1052 static __two __test(...);
1055 static constexpr bool value = sizeof(__test<_Tp, _Up>(0)) == 1;
1059 template<typename _Tp, typename _Up>
1060 struct is_assignable
1061 : public integral_constant<bool,
1062 __is_assignable_helper<_Tp, _Up>::value>
1065 template<typename _Tp, bool = is_void<_Tp>::value>
1066 struct __is_copy_assignable_impl;
1068 template<typename _Tp>
1069 struct __is_copy_assignable_impl<_Tp, true>
1070 : public false_type { };
1072 template<typename _Tp>
1073 struct __is_copy_assignable_impl<_Tp, false>
1074 : public is_assignable<_Tp&, const _Tp&>
1077 /// is_copy_assignable
1078 template<typename _Tp>
1079 struct is_copy_assignable
1080 : public __is_copy_assignable_impl<_Tp>
1083 template<typename _Tp, bool = is_void<_Tp>::value>
1084 struct __is_move_assignable_impl;
1086 template<typename _Tp>
1087 struct __is_move_assignable_impl<_Tp, true>
1088 : public false_type { };
1090 template<typename _Tp>
1091 struct __is_move_assignable_impl<_Tp, false>
1092 : public is_assignable<_Tp&, _Tp&&>
1095 /// is_move_assignable
1096 template<typename _Tp>
1097 struct is_move_assignable
1098 : public __is_move_assignable_impl<_Tp>
1101 template<typename _Tp, typename _Up>
1102 struct __is_nt_assignable_impl
1103 : public integral_constant<bool, noexcept(declval<_Tp>() = declval<_Up>())>
1106 /// is_nothrow_assignable
1107 template<typename _Tp, typename _Up>
1108 struct is_nothrow_assignable
1109 : public __and_<is_assignable<_Tp, _Up>,
1110 __is_nt_assignable_impl<_Tp, _Up>>::type
1113 template<typename _Tp, bool = is_void<_Tp>::value>
1114 struct __is_nt_copy_assignable_impl;
1116 template<typename _Tp>
1117 struct __is_nt_copy_assignable_impl<_Tp, true>
1118 : public false_type { };
1120 template<typename _Tp>
1121 struct __is_nt_copy_assignable_impl<_Tp, false>
1122 : public is_nothrow_assignable<_Tp&, const _Tp&>
1125 /// is_nothrow_copy_assignable
1126 template<typename _Tp>
1127 struct is_nothrow_copy_assignable
1128 : public __is_nt_copy_assignable_impl<_Tp>
1131 template<typename _Tp, bool = is_void<_Tp>::value>
1132 struct __is_nt_move_assignable_impl;
1134 template<typename _Tp>
1135 struct __is_nt_move_assignable_impl<_Tp, true>
1136 : public false_type { };
1138 template<typename _Tp>
1139 struct __is_nt_move_assignable_impl<_Tp, false>
1140 : public is_nothrow_assignable<_Tp&, _Tp&&>
1143 /// is_nothrow_move_assignable
1144 template<typename _Tp>
1145 struct is_nothrow_move_assignable
1146 : public __is_nt_move_assignable_impl<_Tp>
1149 /// has_trivial_default_constructor
1150 template<typename _Tp>
1151 struct has_trivial_default_constructor
1152 : public integral_constant<bool, __has_trivial_constructor(_Tp)>
1155 /// has_trivial_copy_constructor
1156 template<typename _Tp>
1157 struct has_trivial_copy_constructor
1158 : public integral_constant<bool, __has_trivial_copy(_Tp)>
1161 /// has_trivial_copy_assign
1162 template<typename _Tp>
1163 struct has_trivial_copy_assign
1164 : public integral_constant<bool, __has_trivial_assign(_Tp)>
1167 /// has_trivial_destructor
1168 template<typename _Tp>
1169 struct has_trivial_destructor
1170 : public integral_constant<bool, __has_trivial_destructor(_Tp)>
1173 /// has_virtual_destructor
1174 template<typename _Tp>
1175 struct has_virtual_destructor
1176 : public integral_constant<bool, __has_virtual_destructor(_Tp)>
1180 // type property queries.
1183 template<typename _Tp>
1185 : public integral_constant<std::size_t, __alignof__(_Tp)> { };
1190 : public integral_constant<std::size_t, 0> { };
1192 template<typename _Tp, std::size_t _Size>
1193 struct rank<_Tp[_Size]>
1194 : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1196 template<typename _Tp>
1198 : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1201 template<typename, unsigned _Uint>
1203 : public integral_constant<std::size_t, 0> { };
1205 template<typename _Tp, unsigned _Uint, std::size_t _Size>
1206 struct extent<_Tp[_Size], _Uint>
1207 : public integral_constant<std::size_t,
1208 _Uint == 0 ? _Size : extent<_Tp,
1212 template<typename _Tp, unsigned _Uint>
1213 struct extent<_Tp[], _Uint>
1214 : public integral_constant<std::size_t,
1215 _Uint == 0 ? 0 : extent<_Tp,
1223 template<typename, typename>
1225 : public false_type { };
1227 template<typename _Tp>
1228 struct is_same<_Tp, _Tp>
1229 : public true_type { };
1232 template<typename _Base, typename _Derived>
1234 : public integral_constant<bool, __is_base_of(_Base, _Derived)>
1237 template<typename _From, typename _To,
1238 bool = __or_<is_void<_From>, is_function<_To>,
1239 is_array<_To>>::value>
1240 struct __is_convertible_helper
1241 { static constexpr bool value = is_void<_To>::value; };
1243 template<typename _From, typename _To>
1244 class __is_convertible_helper<_From, _To, false>
1245 : public __sfinae_types
1247 template<typename _To1>
1248 static void __test_aux(_To1);
1250 template<typename _From1, typename _To1>
1251 static decltype(__test_aux<_To1>(std::declval<_From1>()), __one())
1254 template<typename, typename>
1255 static __two __test(...);
1258 static constexpr bool value = sizeof(__test<_From, _To>(0)) == 1;
1262 template<typename _From, typename _To>
1263 struct is_convertible
1264 : public integral_constant<bool,
1265 __is_convertible_helper<_From, _To>::value>
1268 /// is_explicitly_convertible
1269 template<typename _From, typename _To>
1270 struct is_explicitly_convertible
1271 : public is_constructible<_To, _From>
1275 // const-volatile modifications.
1278 template<typename _Tp>
1280 { typedef _Tp type; };
1282 template<typename _Tp>
1283 struct remove_const<_Tp const>
1284 { typedef _Tp type; };
1287 template<typename _Tp>
1288 struct remove_volatile
1289 { typedef _Tp type; };
1291 template<typename _Tp>
1292 struct remove_volatile<_Tp volatile>
1293 { typedef _Tp type; };
1296 template<typename _Tp>
1300 remove_const<typename remove_volatile<_Tp>::type>::type type;
1304 template<typename _Tp>
1306 { typedef _Tp const type; };
1309 template<typename _Tp>
1311 { typedef _Tp volatile type; };
1314 template<typename _Tp>
1318 add_const<typename add_volatile<_Tp>::type>::type type;
1322 // Reference transformations.
1324 /// remove_reference
1325 template<typename _Tp>
1326 struct remove_reference
1327 { typedef _Tp type; };
1329 template<typename _Tp>
1330 struct remove_reference<_Tp&>
1331 { typedef _Tp type; };
1333 template<typename _Tp>
1334 struct remove_reference<_Tp&&>
1335 { typedef _Tp type; };
1337 template<typename _Tp,
1338 bool = __and_<__not_<is_reference<_Tp>>,
1339 __not_<is_void<_Tp>>>::value,
1340 bool = is_rvalue_reference<_Tp>::value>
1341 struct __add_lvalue_reference_helper
1342 { typedef _Tp type; };
1344 template<typename _Tp>
1345 struct __add_lvalue_reference_helper<_Tp, true, false>
1346 { typedef _Tp& type; };
1348 template<typename _Tp>
1349 struct __add_lvalue_reference_helper<_Tp, false, true>
1350 { typedef typename remove_reference<_Tp>::type& type; };
1352 /// add_lvalue_reference
1353 template<typename _Tp>
1354 struct add_lvalue_reference
1355 : public __add_lvalue_reference_helper<_Tp>
1358 template<typename _Tp,
1359 bool = __and_<__not_<is_reference<_Tp>>,
1360 __not_<is_void<_Tp>>>::value>
1361 struct __add_rvalue_reference_helper
1362 { typedef _Tp type; };
1364 template<typename _Tp>
1365 struct __add_rvalue_reference_helper<_Tp, true>
1366 { typedef _Tp&& type; };
1368 /// add_rvalue_reference
1369 template<typename _Tp>
1370 struct add_rvalue_reference
1371 : public __add_rvalue_reference_helper<_Tp>
1375 // sign modifications.
1377 // Utility for constructing identically cv-qualified types.
1378 template<typename _Unqualified, bool _IsConst, bool _IsVol>
1379 struct __cv_selector;
1381 template<typename _Unqualified>
1382 struct __cv_selector<_Unqualified, false, false>
1383 { typedef _Unqualified __type; };
1385 template<typename _Unqualified>
1386 struct __cv_selector<_Unqualified, false, true>
1387 { typedef volatile _Unqualified __type; };
1389 template<typename _Unqualified>
1390 struct __cv_selector<_Unqualified, true, false>
1391 { typedef const _Unqualified __type; };
1393 template<typename _Unqualified>
1394 struct __cv_selector<_Unqualified, true, true>
1395 { typedef const volatile _Unqualified __type; };
1397 template<typename _Qualified, typename _Unqualified,
1398 bool _IsConst = is_const<_Qualified>::value,
1399 bool _IsVol = is_volatile<_Qualified>::value>
1400 class __match_cv_qualifiers
1402 typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match;
1405 typedef typename __match::__type __type;
1408 // Utility for finding the unsigned versions of signed integral types.
1409 template<typename _Tp>
1410 struct __make_unsigned
1411 { typedef _Tp __type; };
1414 struct __make_unsigned<char>
1415 { typedef unsigned char __type; };
1418 struct __make_unsigned<signed char>
1419 { typedef unsigned char __type; };
1422 struct __make_unsigned<short>
1423 { typedef unsigned short __type; };
1426 struct __make_unsigned<int>
1427 { typedef unsigned int __type; };
1430 struct __make_unsigned<long>
1431 { typedef unsigned long __type; };
1434 struct __make_unsigned<long long>
1435 { typedef unsigned long long __type; };
1437 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
1439 struct __make_unsigned<__int128>
1440 { typedef unsigned __int128 __type; };
1443 // Select between integral and enum: not possible to be both.
1444 template<typename _Tp,
1445 bool _IsInt = is_integral<_Tp>::value,
1446 bool _IsEnum = is_enum<_Tp>::value>
1447 class __make_unsigned_selector;
1449 template<typename _Tp>
1450 class __make_unsigned_selector<_Tp, true, false>
1452 typedef __make_unsigned<typename remove_cv<_Tp>::type> __unsignedt;
1453 typedef typename __unsignedt::__type __unsigned_type;
1454 typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
1457 typedef typename __cv_unsigned::__type __type;
1460 template<typename _Tp>
1461 class __make_unsigned_selector<_Tp, false, true>
1463 // With -fshort-enums, an enum may be as small as a char.
1464 typedef unsigned char __smallest;
1465 static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest);
1466 static const bool __b1 = sizeof(_Tp) <= sizeof(unsigned short);
1467 static const bool __b2 = sizeof(_Tp) <= sizeof(unsigned int);
1468 typedef conditional<__b2, unsigned int, unsigned long> __cond2;
1469 typedef typename __cond2::type __cond2_type;
1470 typedef conditional<__b1, unsigned short, __cond2_type> __cond1;
1471 typedef typename __cond1::type __cond1_type;
1474 typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
1477 // Given an integral/enum type, return the corresponding unsigned
1479 // Primary template.
1481 template<typename _Tp>
1482 struct make_unsigned
1483 { typedef typename __make_unsigned_selector<_Tp>::__type type; };
1485 // Integral, but don't define.
1487 struct make_unsigned<bool>;
1490 // Utility for finding the signed versions of unsigned integral types.
1491 template<typename _Tp>
1492 struct __make_signed
1493 { typedef _Tp __type; };
1496 struct __make_signed<char>
1497 { typedef signed char __type; };
1500 struct __make_signed<unsigned char>
1501 { typedef signed char __type; };
1504 struct __make_signed<unsigned short>
1505 { typedef signed short __type; };
1508 struct __make_signed<unsigned int>
1509 { typedef signed int __type; };
1512 struct __make_signed<unsigned long>
1513 { typedef signed long __type; };
1516 struct __make_signed<unsigned long long>
1517 { typedef signed long long __type; };
1519 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
1521 struct __make_signed<unsigned __int128>
1522 { typedef __int128 __type; };
1525 // Select between integral and enum: not possible to be both.
1526 template<typename _Tp,
1527 bool _IsInt = is_integral<_Tp>::value,
1528 bool _IsEnum = is_enum<_Tp>::value>
1529 class __make_signed_selector;
1531 template<typename _Tp>
1532 class __make_signed_selector<_Tp, true, false>
1534 typedef __make_signed<typename remove_cv<_Tp>::type> __signedt;
1535 typedef typename __signedt::__type __signed_type;
1536 typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed;
1539 typedef typename __cv_signed::__type __type;
1542 template<typename _Tp>
1543 class __make_signed_selector<_Tp, false, true>
1545 // With -fshort-enums, an enum may be as small as a char.
1546 typedef signed char __smallest;
1547 static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest);
1548 static const bool __b1 = sizeof(_Tp) <= sizeof(signed short);
1549 static const bool __b2 = sizeof(_Tp) <= sizeof(signed int);
1550 typedef conditional<__b2, signed int, signed long> __cond2;
1551 typedef typename __cond2::type __cond2_type;
1552 typedef conditional<__b1, signed short, __cond2_type> __cond1;
1553 typedef typename __cond1::type __cond1_type;
1556 typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
1559 // Given an integral/enum type, return the corresponding signed
1561 // Primary template.
1563 template<typename _Tp>
1565 { typedef typename __make_signed_selector<_Tp>::__type type; };
1567 // Integral, but don't define.
1569 struct make_signed<bool>;
1572 // array modifications.
1575 template<typename _Tp>
1576 struct remove_extent
1577 { typedef _Tp type; };
1579 template<typename _Tp, std::size_t _Size>
1580 struct remove_extent<_Tp[_Size]>
1581 { typedef _Tp type; };
1583 template<typename _Tp>
1584 struct remove_extent<_Tp[]>
1585 { typedef _Tp type; };
1587 /// remove_all_extents
1588 template<typename _Tp>
1589 struct remove_all_extents
1590 { typedef _Tp type; };
1592 template<typename _Tp, std::size_t _Size>
1593 struct remove_all_extents<_Tp[_Size]>
1594 { typedef typename remove_all_extents<_Tp>::type type; };
1596 template<typename _Tp>
1597 struct remove_all_extents<_Tp[]>
1598 { typedef typename remove_all_extents<_Tp>::type type; };
1601 // pointer modifications.
1603 template<typename _Tp, typename>
1604 struct __remove_pointer_helper
1605 { typedef _Tp type; };
1607 template<typename _Tp, typename _Up>
1608 struct __remove_pointer_helper<_Tp, _Up*>
1609 { typedef _Up type; };
1612 template<typename _Tp>
1613 struct remove_pointer
1614 : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
1618 template<typename _Tp>
1620 { typedef typename remove_reference<_Tp>::type* type; };
1623 template<std::size_t _Len>
1624 struct __aligned_storage_msa
1628 unsigned char __data[_Len];
1629 struct __attribute__((__aligned__)) { } __align;
1634 * @brief Alignment type.
1636 * The value of _Align is a default-alignment which shall be the
1637 * most stringent alignment requirement for any C++ object type
1638 * whose size is no greater than _Len (3.9). The member typedef
1639 * type shall be a POD type suitable for use as uninitialized
1640 * storage for any object whose size is at most _Len and whose
1641 * alignment is a divisor of _Align.
1643 template<std::size_t _Len, std::size_t _Align =
1644 __alignof__(typename __aligned_storage_msa<_Len>::__type)>
1645 struct aligned_storage
1649 unsigned char __data[_Len];
1650 struct __attribute__((__aligned__((_Align)))) { } __align;
1655 // Decay trait for arrays and functions, used for perfect forwarding
1656 // in make_pair, make_tuple, etc.
1657 template<typename _Up,
1658 bool _IsArray = is_array<_Up>::value,
1659 bool _IsFunction = is_function<_Up>::value>
1660 struct __decay_selector;
1663 template<typename _Up>
1664 struct __decay_selector<_Up, false, false>
1665 { typedef typename remove_cv<_Up>::type __type; };
1667 template<typename _Up>
1668 struct __decay_selector<_Up, true, false>
1669 { typedef typename remove_extent<_Up>::type* __type; };
1671 template<typename _Up>
1672 struct __decay_selector<_Up, false, true>
1673 { typedef typename add_pointer<_Up>::type __type; };
1676 template<typename _Tp>
1679 typedef typename remove_reference<_Tp>::type __remove_type;
1682 typedef typename __decay_selector<__remove_type>::__type type;
1685 template<typename _Tp>
1686 class reference_wrapper;
1688 // Helper which adds a reference to a type when given a reference_wrapper
1689 template<typename _Tp>
1690 struct __strip_reference_wrapper
1695 template<typename _Tp>
1696 struct __strip_reference_wrapper<reference_wrapper<_Tp> >
1698 typedef _Tp& __type;
1701 template<typename _Tp>
1702 struct __strip_reference_wrapper<const reference_wrapper<_Tp> >
1704 typedef _Tp& __type;
1707 template<typename _Tp>
1708 struct __decay_and_strip
1710 typedef typename __strip_reference_wrapper<
1711 typename decay<_Tp>::type>::__type __type;
1715 // Primary template.
1716 /// Define a member typedef @c type only if a boolean constant is true.
1717 template<bool, typename _Tp = void>
1721 // Partial specialization for true.
1722 template<typename _Tp>
1723 struct enable_if<true, _Tp>
1724 { typedef _Tp type; };
1727 // Primary template.
1728 /// Define a member typedef @c type to one of two argument types.
1729 template<bool _Cond, typename _Iftrue, typename _Iffalse>
1731 { typedef _Iftrue type; };
1733 // Partial specialization for false.
1734 template<typename _Iftrue, typename _Iffalse>
1735 struct conditional<false, _Iftrue, _Iffalse>
1736 { typedef _Iffalse type; };
1740 template<typename... _Tp>
1743 template<typename _Tp>
1744 struct common_type<_Tp>
1745 { typedef _Tp type; };
1747 template<typename _Tp, typename _Up>
1748 struct common_type<_Tp, _Up>
1749 { typedef decltype(true ? declval<_Tp>() : declval<_Up>()) type; };
1751 template<typename _Tp, typename _Up, typename... _Vp>
1752 struct common_type<_Tp, _Up, _Vp...>
1755 common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type;
1758 /// The underlying type of an enum.
1759 template<typename _Tp>
1760 struct underlying_type
1762 typedef __underlying_type(_Tp) type;
1765 template<typename _Tp>
1766 struct __declval_protector
1768 static const bool __stop = false;
1769 static typename add_rvalue_reference<_Tp>::type __delegate();
1772 template<typename _Tp>
1773 inline typename add_rvalue_reference<_Tp>::type
1776 static_assert(__declval_protector<_Tp>::__stop,
1777 "declval() must not be used!");
1778 return __declval_protector<_Tp>::__delegate();
1782 template<typename _Signature>
1785 template<typename _MemPtr, typename _Arg>
1786 struct _Result_of_memobj;
1788 template<typename _Res, typename _Class, typename _Arg>
1789 struct _Result_of_memobj<_Res _Class::*, _Arg>
1792 typedef _Res _Class::* _Func;
1794 template<typename _Tp>
1795 static _Tp _S_get(const _Class&);
1796 template<typename _Tp>
1797 static decltype(*std::declval<_Tp>()) _S_get(...);
1801 decltype(_S_get<_Arg>(std::declval<_Arg>()).*std::declval<_Func>())
1805 template<typename _MemPtr, typename _Arg, typename... _ArgTypes>
1806 struct _Result_of_memfun;
1808 template<typename _Res, typename _Class, typename _Arg, typename... _Args>
1809 struct _Result_of_memfun<_Res _Class::*, _Arg, _Args...>
1812 typedef _Res _Class::* _Func;
1814 template<typename _Tp>
1815 static _Tp _S_get(const _Class&);
1816 template<typename _Tp>
1817 static decltype(*std::declval<_Tp>()) _S_get(...);
1821 decltype((_S_get<_Arg>(std::declval<_Arg>()).*std::declval<_Func>())
1822 (std::declval<_Args>()...) )
1826 template<bool, bool, typename _Functor, typename... _ArgTypes>
1827 struct _Result_of_impl;
1829 template<typename _Functor, typename... _ArgTypes>
1830 struct _Result_of_impl<false, false, _Functor, _ArgTypes...>
1833 decltype( std::declval<_Functor>()(std::declval<_ArgTypes>()...) )
1837 template<typename _MemPtr, typename _Arg>
1838 struct _Result_of_impl<true, false, _MemPtr, _Arg>
1839 : _Result_of_memobj<typename remove_reference<_MemPtr>::type, _Arg>
1841 typedef typename _Result_of_memobj<
1842 typename remove_reference<_MemPtr>::type, _Arg>::__type
1846 template<typename _MemPtr, typename _Arg, typename... _ArgTypes>
1847 struct _Result_of_impl<false, true, _MemPtr, _Arg, _ArgTypes...>
1848 : _Result_of_memfun<typename remove_reference<_MemPtr>::type, _Arg,
1851 typedef typename _Result_of_memfun<
1852 typename remove_reference<_MemPtr>::type, _Arg, _ArgTypes...>::__type
1856 template<typename _Functor, typename... _ArgTypes>
1857 struct result_of<_Functor(_ArgTypes...)>
1858 : _Result_of_impl<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...>
1864 typedef typename _Result_of_impl<
1865 is_member_object_pointer<
1866 typename remove_reference<_Functor>::type >::value,
1867 is_member_function_pointer<
1868 typename remove_reference<_Functor>::type >::value,
1869 _Functor, _ArgTypes...>::__type
1874 * Use SFINAE to determine if the type _Tp has a publicly-accessible
1875 * member type _NTYPE.
1877 #define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
1878 template<typename _Tp> \
1879 class __has_##_NTYPE##_helper \
1882 template<typename _Up> \
1886 template<typename _Up> \
1887 static __one __test(_Wrap_type<typename _Up::_NTYPE>*); \
1889 template<typename _Up> \
1890 static __two __test(...); \
1893 static constexpr bool value = sizeof(__test<_Tp>(0)) == 1; \
1896 template<typename _Tp> \
1897 struct __has_##_NTYPE \
1898 : integral_constant<bool, __has_##_NTYPE##_helper \
1899 <typename remove_cv<_Tp>::type>::value> \
1902 /// @} group metaprogramming
1903 _GLIBCXX_END_NAMESPACE_VERSION
1906 #endif // __GXX_EXPERIMENTAL_CXX0X__
1908 #endif // _GLIBCXX_TYPE_TRAITS