libstdc++
type_traits
Go to the documentation of this file.
1 // C++11 <type_traits> -*- C++ -*-
2 
3 // Copyright (C) 2007-2018 Free Software Foundation, Inc.
4 //
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)
9 // any later version.
10 
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.
15 
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.
19 
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/>.
24 
25 /** @file include/type_traits
26  * This is a Standard C++ Library header.
27  */
28 
29 #ifndef _GLIBCXX_TYPE_TRAITS
30 #define _GLIBCXX_TYPE_TRAITS 1
31 
32 #pragma GCC system_header
33 
34 #if __cplusplus < 201103L
35 # include <bits/c++0x_warning.h>
36 #else
37 
38 #include <bits/c++config.h>
39 
40 namespace std _GLIBCXX_VISIBILITY(default)
41 {
42 _GLIBCXX_BEGIN_NAMESPACE_VERSION
43 
44  /**
45  * @defgroup metaprogramming Metaprogramming
46  * @ingroup utilities
47  *
48  * Template utilities for compile-time introspection and modification,
49  * including type classification traits, type property inspection traits
50  * and type transformation traits.
51  *
52  * @{
53  */
54 
55  /// integral_constant
56  template<typename _Tp, _Tp __v>
57  struct integral_constant
58  {
59  static constexpr _Tp value = __v;
60  typedef _Tp value_type;
61  typedef integral_constant<_Tp, __v> type;
62  constexpr operator value_type() const noexcept { return value; }
63 #if __cplusplus > 201103L
64 
65 #define __cpp_lib_integral_constant_callable 201304
66 
67  constexpr value_type operator()() const noexcept { return value; }
68 #endif
69  };
70 
71  template<typename _Tp, _Tp __v>
72  constexpr _Tp integral_constant<_Tp, __v>::value;
73 
74  /// The type used as a compile-time boolean with true value.
75  typedef integral_constant<bool, true> true_type;
76 
77  /// The type used as a compile-time boolean with false value.
78  typedef integral_constant<bool, false> false_type;
79 
80  template<bool __v>
81  using __bool_constant = integral_constant<bool, __v>;
82 
83 #if __cplusplus > 201402L
84 # define __cpp_lib_bool_constant 201505
85  template<bool __v>
86  using bool_constant = integral_constant<bool, __v>;
87 #endif
88 
89  // Meta programming helper types.
90 
91  template<bool, typename, typename>
92  struct conditional;
93 
94  template<typename...>
95  struct __or_;
96 
97  template<>
98  struct __or_<>
99  : public false_type
100  { };
101 
102  template<typename _B1>
103  struct __or_<_B1>
104  : public _B1
105  { };
106 
107  template<typename _B1, typename _B2>
108  struct __or_<_B1, _B2>
109  : public conditional<_B1::value, _B1, _B2>::type
110  { };
111 
112  template<typename _B1, typename _B2, typename _B3, typename... _Bn>
113  struct __or_<_B1, _B2, _B3, _Bn...>
114  : public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type
115  { };
116 
117  template<typename...>
118  struct __and_;
119 
120  template<>
121  struct __and_<>
122  : public true_type
123  { };
124 
125  template<typename _B1>
126  struct __and_<_B1>
127  : public _B1
128  { };
129 
130  template<typename _B1, typename _B2>
131  struct __and_<_B1, _B2>
132  : public conditional<_B1::value, _B2, _B1>::type
133  { };
134 
135  template<typename _B1, typename _B2, typename _B3, typename... _Bn>
136  struct __and_<_B1, _B2, _B3, _Bn...>
137  : public conditional<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>::type
138  { };
139 
140  template<typename _Pp>
141  struct __not_
142  : public __bool_constant<!bool(_Pp::value)>
143  { };
144 
145 #if __cplusplus >= 201703L
146 
147 #define __cpp_lib_logical_traits 201510
148 
149  template<typename... _Bn>
150  struct conjunction
151  : __and_<_Bn...>
152  { };
153 
154  template<typename... _Bn>
155  struct disjunction
156  : __or_<_Bn...>
157  { };
158 
159  template<typename _Pp>
160  struct negation
161  : __not_<_Pp>
162  { };
163 
164  template<typename... _Bn>
165  inline constexpr bool conjunction_v = conjunction<_Bn...>::value;
166 
167  template<typename... _Bn>
168  inline constexpr bool disjunction_v = disjunction<_Bn...>::value;
169 
170  template<typename _Pp>
171  inline constexpr bool negation_v = negation<_Pp>::value;
172 
173 #endif // C++17
174 
175  // For several sfinae-friendly trait implementations we transport both the
176  // result information (as the member type) and the failure information (no
177  // member type). This is very similar to std::enable_if, but we cannot use
178  // them, because we need to derive from them as an implementation detail.
179 
180  template<typename _Tp>
181  struct __success_type
182  { typedef _Tp type; };
183 
184  struct __failure_type
185  { };
186 
187  // Primary type categories.
188 
189  template<typename>
190  struct remove_cv;
191 
192  template<typename>
193  struct __is_void_helper
194  : public false_type { };
195 
196  template<>
197  struct __is_void_helper<void>
198  : public true_type { };
199 
200  /// is_void
201  template<typename _Tp>
202  struct is_void
203  : public __is_void_helper<typename remove_cv<_Tp>::type>::type
204  { };
205 
206  template<typename>
207  struct __is_integral_helper
208  : public false_type { };
209 
210  template<>
211  struct __is_integral_helper<bool>
212  : public true_type { };
213 
214  template<>
215  struct __is_integral_helper<char>
216  : public true_type { };
217 
218  template<>
219  struct __is_integral_helper<signed char>
220  : public true_type { };
221 
222  template<>
223  struct __is_integral_helper<unsigned char>
224  : public true_type { };
225 
226 #ifdef _GLIBCXX_USE_WCHAR_T
227  template<>
228  struct __is_integral_helper<wchar_t>
229  : public true_type { };
230 #endif
231 
232  template<>
233  struct __is_integral_helper<char16_t>
234  : public true_type { };
235 
236  template<>
237  struct __is_integral_helper<char32_t>
238  : public true_type { };
239 
240  template<>
241  struct __is_integral_helper<short>
242  : public true_type { };
243 
244  template<>
245  struct __is_integral_helper<unsigned short>
246  : public true_type { };
247 
248  template<>
249  struct __is_integral_helper<int>
250  : public true_type { };
251 
252  template<>
253  struct __is_integral_helper<unsigned int>
254  : public true_type { };
255 
256  template<>
257  struct __is_integral_helper<long>
258  : public true_type { };
259 
260  template<>
261  struct __is_integral_helper<unsigned long>
262  : public true_type { };
263 
264  template<>
265  struct __is_integral_helper<long long>
266  : public true_type { };
267 
268  template<>
269  struct __is_integral_helper<unsigned long long>
270  : public true_type { };
271 
272  // Conditionalizing on __STRICT_ANSI__ here will break any port that
273  // uses one of these types for size_t.
274 #if defined(__GLIBCXX_TYPE_INT_N_0)
275  template<>
276  struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0>
277  : public true_type { };
278 
279  template<>
280  struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_0>
281  : public true_type { };
282 #endif
283 #if defined(__GLIBCXX_TYPE_INT_N_1)
284  template<>
285  struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1>
286  : public true_type { };
287 
288  template<>
289  struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_1>
290  : public true_type { };
291 #endif
292 #if defined(__GLIBCXX_TYPE_INT_N_2)
293  template<>
294  struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2>
295  : public true_type { };
296 
297  template<>
298  struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_2>
299  : public true_type { };
300 #endif
301 #if defined(__GLIBCXX_TYPE_INT_N_3)
302  template<>
303  struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3>
304  : public true_type { };
305 
306  template<>
307  struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_3>
308  : public true_type { };
309 #endif
310 
311  /// is_integral
312  template<typename _Tp>
313  struct is_integral
314  : public __is_integral_helper<typename remove_cv<_Tp>::type>::type
315  { };
316 
317  template<typename>
318  struct __is_floating_point_helper
319  : public false_type { };
320 
321  template<>
322  struct __is_floating_point_helper<float>
323  : public true_type { };
324 
325  template<>
326  struct __is_floating_point_helper<double>
327  : public true_type { };
328 
329  template<>
330  struct __is_floating_point_helper<long double>
331  : public true_type { };
332 
333 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
334  template<>
335  struct __is_floating_point_helper<__float128>
336  : public true_type { };
337 #endif
338 
339  /// is_floating_point
340  template<typename _Tp>
341  struct is_floating_point
342  : public __is_floating_point_helper<typename remove_cv<_Tp>::type>::type
343  { };
344 
345  /// is_array
346  template<typename>
347  struct is_array
348  : public false_type { };
349 
350  template<typename _Tp, std::size_t _Size>
351  struct is_array<_Tp[_Size]>
352  : public true_type { };
353 
354  template<typename _Tp>
355  struct is_array<_Tp[]>
356  : public true_type { };
357 
358  template<typename>
359  struct __is_pointer_helper
360  : public false_type { };
361 
362  template<typename _Tp>
363  struct __is_pointer_helper<_Tp*>
364  : public true_type { };
365 
366  /// is_pointer
367  template<typename _Tp>
368  struct is_pointer
369  : public __is_pointer_helper<typename remove_cv<_Tp>::type>::type
370  { };
371 
372  /// is_lvalue_reference
373  template<typename>
374  struct is_lvalue_reference
375  : public false_type { };
376 
377  template<typename _Tp>
378  struct is_lvalue_reference<_Tp&>
379  : public true_type { };
380 
381  /// is_rvalue_reference
382  template<typename>
383  struct is_rvalue_reference
384  : public false_type { };
385 
386  template<typename _Tp>
387  struct is_rvalue_reference<_Tp&&>
388  : public true_type { };
389 
390  template<typename>
391  struct is_function;
392 
393  template<typename>
394  struct __is_member_object_pointer_helper
395  : public false_type { };
396 
397  template<typename _Tp, typename _Cp>
398  struct __is_member_object_pointer_helper<_Tp _Cp::*>
399  : public integral_constant<bool, !is_function<_Tp>::value> { };
400 
401  /// is_member_object_pointer
402  template<typename _Tp>
403  struct is_member_object_pointer
404  : public __is_member_object_pointer_helper<
405  typename remove_cv<_Tp>::type>::type
406  { };
407 
408  template<typename>
409  struct __is_member_function_pointer_helper
410  : public false_type { };
411 
412  template<typename _Tp, typename _Cp>
413  struct __is_member_function_pointer_helper<_Tp _Cp::*>
414  : public integral_constant<bool, is_function<_Tp>::value> { };
415 
416  /// is_member_function_pointer
417  template<typename _Tp>
418  struct is_member_function_pointer
419  : public __is_member_function_pointer_helper<
420  typename remove_cv<_Tp>::type>::type
421  { };
422 
423  /// is_enum
424  template<typename _Tp>
425  struct is_enum
426  : public integral_constant<bool, __is_enum(_Tp)>
427  { };
428 
429  /// is_union
430  template<typename _Tp>
431  struct is_union
432  : public integral_constant<bool, __is_union(_Tp)>
433  { };
434 
435  /// is_class
436  template<typename _Tp>
437  struct is_class
438  : public integral_constant<bool, __is_class(_Tp)>
439  { };
440 
441  /// is_function
442  template<typename>
443  struct is_function
444  : public false_type { };
445 
446  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
447  struct is_function<_Res(_ArgTypes...) _GLIBCXX_NOEXCEPT_QUAL>
448  : public true_type { };
449 
450  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
451  struct is_function<_Res(_ArgTypes...) & _GLIBCXX_NOEXCEPT_QUAL>
452  : public true_type { };
453 
454  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
455  struct is_function<_Res(_ArgTypes...) && _GLIBCXX_NOEXCEPT_QUAL>
456  : public true_type { };
457 
458  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
459  struct is_function<_Res(_ArgTypes......) _GLIBCXX_NOEXCEPT_QUAL>
460  : public true_type { };
461 
462  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
463  struct is_function<_Res(_ArgTypes......) & _GLIBCXX_NOEXCEPT_QUAL>
464  : public true_type { };
465 
466  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
467  struct is_function<_Res(_ArgTypes......) && _GLIBCXX_NOEXCEPT_QUAL>
468  : public true_type { };
469 
470  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
471  struct is_function<_Res(_ArgTypes...) const _GLIBCXX_NOEXCEPT_QUAL>
472  : public true_type { };
473 
474  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
475  struct is_function<_Res(_ArgTypes...) const & _GLIBCXX_NOEXCEPT_QUAL>
476  : public true_type { };
477 
478  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
479  struct is_function<_Res(_ArgTypes...) const && _GLIBCXX_NOEXCEPT_QUAL>
480  : public true_type { };
481 
482  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
483  struct is_function<_Res(_ArgTypes......) const _GLIBCXX_NOEXCEPT_QUAL>
484  : public true_type { };
485 
486  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
487  struct is_function<_Res(_ArgTypes......) const & _GLIBCXX_NOEXCEPT_QUAL>
488  : public true_type { };
489 
490  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
491  struct is_function<_Res(_ArgTypes......) const && _GLIBCXX_NOEXCEPT_QUAL>
492  : public true_type { };
493 
494  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
495  struct is_function<_Res(_ArgTypes...) volatile _GLIBCXX_NOEXCEPT_QUAL>
496  : public true_type { };
497 
498  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
499  struct is_function<_Res(_ArgTypes...) volatile & _GLIBCXX_NOEXCEPT_QUAL>
500  : public true_type { };
501 
502  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
503  struct is_function<_Res(_ArgTypes...) volatile && _GLIBCXX_NOEXCEPT_QUAL>
504  : public true_type { };
505 
506  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
507  struct is_function<_Res(_ArgTypes......) volatile _GLIBCXX_NOEXCEPT_QUAL>
508  : public true_type { };
509 
510  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
511  struct is_function<_Res(_ArgTypes......) volatile & _GLIBCXX_NOEXCEPT_QUAL>
512  : public true_type { };
513 
514  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
515  struct is_function<_Res(_ArgTypes......) volatile && _GLIBCXX_NOEXCEPT_QUAL>
516  : public true_type { };
517 
518  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
519  struct is_function<_Res(_ArgTypes...) const volatile _GLIBCXX_NOEXCEPT_QUAL>
520  : public true_type { };
521 
522  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
523  struct is_function<_Res(_ArgTypes...) const volatile & _GLIBCXX_NOEXCEPT_QUAL>
524  : public true_type { };
525 
526  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
527  struct is_function<_Res(_ArgTypes...) const volatile && _GLIBCXX_NOEXCEPT_QUAL>
528  : public true_type { };
529 
530  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
531  struct is_function<_Res(_ArgTypes......) const volatile _GLIBCXX_NOEXCEPT_QUAL>
532  : public true_type { };
533 
534  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
535  struct is_function<_Res(_ArgTypes......) const volatile & _GLIBCXX_NOEXCEPT_QUAL>
536  : public true_type { };
537 
538  template<typename _Res, typename... _ArgTypes _GLIBCXX_NOEXCEPT_PARM>
539  struct is_function<_Res(_ArgTypes......) const volatile && _GLIBCXX_NOEXCEPT_QUAL>
540  : public true_type { };
541 
542 #define __cpp_lib_is_null_pointer 201309
543 
544  template<typename>
545  struct __is_null_pointer_helper
546  : public false_type { };
547 
548  template<>
549  struct __is_null_pointer_helper<std::nullptr_t>
550  : public true_type { };
551 
552  /// is_null_pointer (LWG 2247).
553  template<typename _Tp>
554  struct is_null_pointer
555  : public __is_null_pointer_helper<typename remove_cv<_Tp>::type>::type
556  { };
557 
558  /// __is_nullptr_t (extension).
559  template<typename _Tp>
560  struct __is_nullptr_t
561  : public is_null_pointer<_Tp>
562  { };
563 
564  // Composite type categories.
565 
566  /// is_reference
567  template<typename _Tp>
568  struct is_reference
569  : public __or_<is_lvalue_reference<_Tp>,
570  is_rvalue_reference<_Tp>>::type
571  { };
572 
573  /// is_arithmetic
574  template<typename _Tp>
575  struct is_arithmetic
576  : public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
577  { };
578 
579  /// is_fundamental
580  template<typename _Tp>
581  struct is_fundamental
582  : public __or_<is_arithmetic<_Tp>, is_void<_Tp>,
583  is_null_pointer<_Tp>>::type
584  { };
585 
586  /// is_object
587  template<typename _Tp>
588  struct is_object
589  : public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
590  is_void<_Tp>>>::type
591  { };
592 
593  template<typename>
594  struct is_member_pointer;
595 
596  /// is_scalar
597  template<typename _Tp>
598  struct is_scalar
599  : public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
600  is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type
601  { };
602 
603  /// is_compound
604  template<typename _Tp>
605  struct is_compound
606  : public integral_constant<bool, !is_fundamental<_Tp>::value> { };
607 
608  template<typename _Tp>
609  struct __is_member_pointer_helper
610  : public false_type { };
611 
612  template<typename _Tp, typename _Cp>
613  struct __is_member_pointer_helper<_Tp _Cp::*>
614  : public true_type { };
615 
616  /// is_member_pointer
617  template<typename _Tp>
618  struct is_member_pointer
619  : public __is_member_pointer_helper<typename remove_cv<_Tp>::type>::type
620  { };
621 
622  // Utility to detect referenceable types ([defns.referenceable]).
623 
624  template<typename _Tp>
625  struct __is_referenceable
626  : public __or_<is_object<_Tp>, is_reference<_Tp>>::type
627  { };
628 
629  template<typename _Res, typename... _Args _GLIBCXX_NOEXCEPT_PARM>
630  struct __is_referenceable<_Res(_Args...) _GLIBCXX_NOEXCEPT_QUAL>
631  : public true_type
632  { };
633 
634  template<typename _Res, typename... _Args _GLIBCXX_NOEXCEPT_PARM>
635  struct __is_referenceable<_Res(_Args......) _GLIBCXX_NOEXCEPT_QUAL>
636  : public true_type
637  { };
638 
639  // Type properties.
640 
641  /// is_const
642  template<typename>
643  struct is_const
644  : public false_type { };
645 
646  template<typename _Tp>
647  struct is_const<_Tp const>
648  : public true_type { };
649 
650  /// is_volatile
651  template<typename>
652  struct is_volatile
653  : public false_type { };
654 
655  template<typename _Tp>
656  struct is_volatile<_Tp volatile>
657  : public true_type { };
658 
659  /// is_trivial
660  template<typename _Tp>
661  struct is_trivial
662  : public integral_constant<bool, __is_trivial(_Tp)>
663  { };
664 
665  // is_trivially_copyable
666  template<typename _Tp>
667  struct is_trivially_copyable
668  : public integral_constant<bool, __is_trivially_copyable(_Tp)>
669  { };
670 
671  /// is_standard_layout
672  template<typename _Tp>
673  struct is_standard_layout
674  : public integral_constant<bool, __is_standard_layout(_Tp)>
675  { };
676 
677  /// is_pod
678  // Could use is_standard_layout && is_trivial instead of the builtin.
679  template<typename _Tp>
680  struct is_pod
681  : public integral_constant<bool, __is_pod(_Tp)>
682  { };
683 
684  /// is_literal_type
685  template<typename _Tp>
686  struct is_literal_type
687  : public integral_constant<bool, __is_literal_type(_Tp)>
688  { };
689 
690  /// is_empty
691  template<typename _Tp>
692  struct is_empty
693  : public integral_constant<bool, __is_empty(_Tp)>
694  { };
695 
696  /// is_polymorphic
697  template<typename _Tp>
698  struct is_polymorphic
699  : public integral_constant<bool, __is_polymorphic(_Tp)>
700  { };
701 
702 #if __cplusplus >= 201402L
703 #define __cpp_lib_is_final 201402L
704  /// is_final
705  template<typename _Tp>
706  struct is_final
707  : public integral_constant<bool, __is_final(_Tp)>
708  { };
709 #endif
710 
711  /// is_abstract
712  template<typename _Tp>
713  struct is_abstract
714  : public integral_constant<bool, __is_abstract(_Tp)>
715  { };
716 
717  template<typename _Tp,
718  bool = is_arithmetic<_Tp>::value>
719  struct __is_signed_helper
720  : public false_type { };
721 
722  template<typename _Tp>
723  struct __is_signed_helper<_Tp, true>
724  : public integral_constant<bool, _Tp(-1) < _Tp(0)>
725  { };
726 
727  /// is_signed
728  template<typename _Tp>
729  struct is_signed
730  : public __is_signed_helper<_Tp>::type
731  { };
732 
733  /// is_unsigned
734  template<typename _Tp>
735  struct is_unsigned
736  : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>
737  { };
738 
739 
740  // Destructible and constructible type properties.
741 
742  /**
743  * @brief Utility to simplify expressions used in unevaluated operands
744  * @ingroup utilities
745  */
746 
747  template<typename _Tp, typename _Up = _Tp&&>
748  _Up
749  __declval(int);
750 
751  template<typename _Tp>
752  _Tp
753  __declval(long);
754 
755  template<typename _Tp>
756  auto declval() noexcept -> decltype(__declval<_Tp>(0));
757 
758  template<typename, unsigned = 0>
759  struct extent;
760 
761  template<typename>
762  struct remove_all_extents;
763 
764  template<typename _Tp>
765  struct __is_array_known_bounds
766  : public integral_constant<bool, (extent<_Tp>::value > 0)>
767  { };
768 
769  template<typename _Tp>
770  struct __is_array_unknown_bounds
771  : public __and_<is_array<_Tp>, __not_<extent<_Tp>>>
772  { };
773 
774  // In N3290 is_destructible does not say anything about function
775  // types and abstract types, see LWG 2049. This implementation
776  // describes function types as non-destructible and all complete
777  // object types as destructible, iff the explicit destructor
778  // call expression is wellformed.
779  struct __do_is_destructible_impl
780  {
781  template<typename _Tp, typename = decltype(declval<_Tp&>().~_Tp())>
782  static true_type __test(int);
783 
784  template<typename>
785  static false_type __test(...);
786  };
787 
788  template<typename _Tp>
789  struct __is_destructible_impl
790  : public __do_is_destructible_impl
791  {
792  typedef decltype(__test<_Tp>(0)) type;
793  };
794 
795  template<typename _Tp,
796  bool = __or_<is_void<_Tp>,
797  __is_array_unknown_bounds<_Tp>,
798  is_function<_Tp>>::value,
799  bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
800  struct __is_destructible_safe;
801 
802  template<typename _Tp>
803  struct __is_destructible_safe<_Tp, false, false>
804  : public __is_destructible_impl<typename
805  remove_all_extents<_Tp>::type>::type
806  { };
807 
808  template<typename _Tp>
809  struct __is_destructible_safe<_Tp, true, false>
810  : public false_type { };
811 
812  template<typename _Tp>
813  struct __is_destructible_safe<_Tp, false, true>
814  : public true_type { };
815 
816  /// is_destructible
817  template<typename _Tp>
818  struct is_destructible
819  : public __is_destructible_safe<_Tp>::type
820  { };
821 
822  // is_nothrow_destructible requires that is_destructible is
823  // satisfied as well. We realize that by mimicing the
824  // implementation of is_destructible but refer to noexcept(expr)
825  // instead of decltype(expr).
826  struct __do_is_nt_destructible_impl
827  {
828  template<typename _Tp>
829  static integral_constant<bool, noexcept(declval<_Tp&>().~_Tp())>
830  __test(int);
831 
832  template<typename>
833  static false_type __test(...);
834  };
835 
836  template<typename _Tp>
837  struct __is_nt_destructible_impl
838  : public __do_is_nt_destructible_impl
839  {
840  typedef decltype(__test<_Tp>(0)) type;
841  };
842 
843  template<typename _Tp,
844  bool = __or_<is_void<_Tp>,
845  __is_array_unknown_bounds<_Tp>,
846  is_function<_Tp>>::value,
847  bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
848  struct __is_nt_destructible_safe;
849 
850  template<typename _Tp>
851  struct __is_nt_destructible_safe<_Tp, false, false>
852  : public __is_nt_destructible_impl<typename
853  remove_all_extents<_Tp>::type>::type
854  { };
855 
856  template<typename _Tp>
857  struct __is_nt_destructible_safe<_Tp, true, false>
858  : public false_type { };
859 
860  template<typename _Tp>
861  struct __is_nt_destructible_safe<_Tp, false, true>
862  : public true_type { };
863 
864  /// is_nothrow_destructible
865  template<typename _Tp>
866  struct is_nothrow_destructible
867  : public __is_nt_destructible_safe<_Tp>::type
868  { };
869 
870  /// is_constructible
871  template<typename _Tp, typename... _Args>
872  struct is_constructible
873  : public __bool_constant<__is_constructible(_Tp, _Args...)>
874  { };
875 
876  /// is_default_constructible
877  template<typename _Tp>
878  struct is_default_constructible
879  : public is_constructible<_Tp>::type
880  { };
881 
882  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
883  struct __is_copy_constructible_impl;
884 
885  template<typename _Tp>
886  struct __is_copy_constructible_impl<_Tp, false>
887  : public false_type { };
888 
889  template<typename _Tp>
890  struct __is_copy_constructible_impl<_Tp, true>
891  : public is_constructible<_Tp, const _Tp&>
892  { };
893 
894  /// is_copy_constructible
895  template<typename _Tp>
896  struct is_copy_constructible
897  : public __is_copy_constructible_impl<_Tp>
898  { };
899 
900  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
901  struct __is_move_constructible_impl;
902 
903  template<typename _Tp>
904  struct __is_move_constructible_impl<_Tp, false>
905  : public false_type { };
906 
907  template<typename _Tp>
908  struct __is_move_constructible_impl<_Tp, true>
909  : public is_constructible<_Tp, _Tp&&>
910  { };
911 
912  /// is_move_constructible
913  template<typename _Tp>
914  struct is_move_constructible
915  : public __is_move_constructible_impl<_Tp>
916  { };
917 
918  template<bool, typename _Tp, typename... _Args>
919  struct __is_nt_constructible_impl
920  : public false_type
921  { };
922 
923  template<typename _Tp, typename... _Args>
924  struct __is_nt_constructible_impl<true, _Tp, _Args...>
925  : public __bool_constant<noexcept(_Tp(std::declval<_Args>()...))>
926  { };
927 
928  template<typename _Tp, typename _Arg>
929  struct __is_nt_constructible_impl<true, _Tp, _Arg>
930  : public __bool_constant<noexcept(static_cast<_Tp>(std::declval<_Arg>()))>
931  { };
932 
933  template<typename _Tp>
934  struct __is_nt_constructible_impl<true, _Tp>
935  : public __bool_constant<noexcept(_Tp())>
936  { };
937 
938  template<typename _Tp, size_t _Num>
939  struct __is_nt_constructible_impl<true, _Tp[_Num]>
940  : public __bool_constant<noexcept(typename remove_all_extents<_Tp>::type())>
941  { };
942 
943  template<typename _Tp, typename... _Args>
944  using __is_nothrow_constructible_impl
945  = __is_nt_constructible_impl<__is_constructible(_Tp, _Args...),
946  _Tp, _Args...>;
947 
948  /// is_nothrow_constructible
949  template<typename _Tp, typename... _Args>
950  struct is_nothrow_constructible
951  : public __is_nothrow_constructible_impl<_Tp, _Args...>::type
952  { };
953 
954  /// is_nothrow_default_constructible
955  template<typename _Tp>
956  struct is_nothrow_default_constructible
957  : public __is_nothrow_constructible_impl<_Tp>::type
958  { };
959 
960 
961  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
962  struct __is_nothrow_copy_constructible_impl;
963 
964  template<typename _Tp>
965  struct __is_nothrow_copy_constructible_impl<_Tp, false>
966  : public false_type { };
967 
968  template<typename _Tp>
969  struct __is_nothrow_copy_constructible_impl<_Tp, true>
970  : public is_nothrow_constructible<_Tp, const _Tp&>
971  { };
972 
973  /// is_nothrow_copy_constructible
974  template<typename _Tp>
975  struct is_nothrow_copy_constructible
976  : public __is_nothrow_copy_constructible_impl<_Tp>
977  { };
978 
979  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
980  struct __is_nothrow_move_constructible_impl;
981 
982  template<typename _Tp>
983  struct __is_nothrow_move_constructible_impl<_Tp, false>
984  : public false_type { };
985 
986  template<typename _Tp>
987  struct __is_nothrow_move_constructible_impl<_Tp, true>
988  : public is_nothrow_constructible<_Tp, _Tp&&>
989  { };
990 
991  /// is_nothrow_move_constructible
992  template<typename _Tp>
993  struct is_nothrow_move_constructible
994  : public __is_nothrow_move_constructible_impl<_Tp>
995  { };
996 
997  /// is_assignable
998  template<typename _Tp, typename _Up>
999  struct is_assignable
1000  : public __bool_constant<__is_assignable(_Tp, _Up)>
1001  { };
1002 
1003  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1004  struct __is_copy_assignable_impl;
1005 
1006  template<typename _Tp>
1007  struct __is_copy_assignable_impl<_Tp, false>
1008  : public false_type { };
1009 
1010  template<typename _Tp>
1011  struct __is_copy_assignable_impl<_Tp, true>
1012  : public is_assignable<_Tp&, const _Tp&>
1013  { };
1014 
1015  /// is_copy_assignable
1016  template<typename _Tp>
1017  struct is_copy_assignable
1018  : public __is_copy_assignable_impl<_Tp>
1019  { };
1020 
1021  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1022  struct __is_move_assignable_impl;
1023 
1024  template<typename _Tp>
1025  struct __is_move_assignable_impl<_Tp, false>
1026  : public false_type { };
1027 
1028  template<typename _Tp>
1029  struct __is_move_assignable_impl<_Tp, true>
1030  : public is_assignable<_Tp&, _Tp&&>
1031  { };
1032 
1033  /// is_move_assignable
1034  template<typename _Tp>
1035  struct is_move_assignable
1036  : public __is_move_assignable_impl<_Tp>
1037  { };
1038 
1039  template<typename _Tp, typename _Up>
1040  struct __is_nt_assignable_impl
1041  : public integral_constant<bool, noexcept(declval<_Tp>() = declval<_Up>())>
1042  { };
1043 
1044  /// is_nothrow_assignable
1045  template<typename _Tp, typename _Up>
1046  struct is_nothrow_assignable
1047  : public __and_<is_assignable<_Tp, _Up>,
1048  __is_nt_assignable_impl<_Tp, _Up>>
1049  { };
1050 
1051  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1052  struct __is_nt_copy_assignable_impl;
1053 
1054  template<typename _Tp>
1055  struct __is_nt_copy_assignable_impl<_Tp, false>
1056  : public false_type { };
1057 
1058  template<typename _Tp>
1059  struct __is_nt_copy_assignable_impl<_Tp, true>
1060  : public is_nothrow_assignable<_Tp&, const _Tp&>
1061  { };
1062 
1063  /// is_nothrow_copy_assignable
1064  template<typename _Tp>
1065  struct is_nothrow_copy_assignable
1066  : public __is_nt_copy_assignable_impl<_Tp>
1067  { };
1068 
1069  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1070  struct __is_nt_move_assignable_impl;
1071 
1072  template<typename _Tp>
1073  struct __is_nt_move_assignable_impl<_Tp, false>
1074  : public false_type { };
1075 
1076  template<typename _Tp>
1077  struct __is_nt_move_assignable_impl<_Tp, true>
1078  : public is_nothrow_assignable<_Tp&, _Tp&&>
1079  { };
1080 
1081  /// is_nothrow_move_assignable
1082  template<typename _Tp>
1083  struct is_nothrow_move_assignable
1084  : public __is_nt_move_assignable_impl<_Tp>
1085  { };
1086 
1087  /// is_trivially_constructible
1088  template<typename _Tp, typename... _Args>
1089  struct is_trivially_constructible
1090  : public __and_<is_constructible<_Tp, _Args...>, __bool_constant<
1091  __is_trivially_constructible(_Tp, _Args...)>>::type
1092  { };
1093 
1094  /// is_trivially_default_constructible
1095  template<typename _Tp>
1096  struct is_trivially_default_constructible
1097  : public is_trivially_constructible<_Tp>::type
1098  { };
1099 
1100  struct __do_is_implicitly_default_constructible_impl
1101  {
1102  template <typename _Tp>
1103  static void __helper(const _Tp&);
1104 
1105  template <typename _Tp>
1106  static true_type __test(const _Tp&,
1107  decltype(__helper<const _Tp&>({}))* = 0);
1108 
1109  static false_type __test(...);
1110  };
1111 
1112  template<typename _Tp>
1113  struct __is_implicitly_default_constructible_impl
1114  : public __do_is_implicitly_default_constructible_impl
1115  {
1116  typedef decltype(__test(declval<_Tp>())) type;
1117  };
1118 
1119  template<typename _Tp>
1120  struct __is_implicitly_default_constructible_safe
1121  : public __is_implicitly_default_constructible_impl<_Tp>::type
1122  { };
1123 
1124  template <typename _Tp>
1125  struct __is_implicitly_default_constructible
1126  : public __and_<is_default_constructible<_Tp>,
1127  __is_implicitly_default_constructible_safe<_Tp>>
1128  { };
1129 
1130  /// is_trivially_copy_constructible
1131 
1132  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1133  struct __is_trivially_copy_constructible_impl;
1134 
1135  template<typename _Tp>
1136  struct __is_trivially_copy_constructible_impl<_Tp, false>
1137  : public false_type { };
1138 
1139  template<typename _Tp>
1140  struct __is_trivially_copy_constructible_impl<_Tp, true>
1141  : public __and_<is_copy_constructible<_Tp>,
1142  integral_constant<bool,
1143  __is_trivially_constructible(_Tp, const _Tp&)>>
1144  { };
1145 
1146  template<typename _Tp>
1147  struct is_trivially_copy_constructible
1148  : public __is_trivially_copy_constructible_impl<_Tp>
1149  { };
1150 
1151  /// is_trivially_move_constructible
1152 
1153  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1154  struct __is_trivially_move_constructible_impl;
1155 
1156  template<typename _Tp>
1157  struct __is_trivially_move_constructible_impl<_Tp, false>
1158  : public false_type { };
1159 
1160  template<typename _Tp>
1161  struct __is_trivially_move_constructible_impl<_Tp, true>
1162  : public __and_<is_move_constructible<_Tp>,
1163  integral_constant<bool,
1164  __is_trivially_constructible(_Tp, _Tp&&)>>
1165  { };
1166 
1167  template<typename _Tp>
1168  struct is_trivially_move_constructible
1169  : public __is_trivially_move_constructible_impl<_Tp>
1170  { };
1171 
1172  /// is_trivially_assignable
1173  template<typename _Tp, typename _Up>
1174  struct is_trivially_assignable
1175  : public __bool_constant<__is_trivially_assignable(_Tp, _Up)>
1176  { };
1177 
1178  /// is_trivially_copy_assignable
1179 
1180  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1181  struct __is_trivially_copy_assignable_impl;
1182 
1183  template<typename _Tp>
1184  struct __is_trivially_copy_assignable_impl<_Tp, false>
1185  : public false_type { };
1186 
1187  template<typename _Tp>
1188  struct __is_trivially_copy_assignable_impl<_Tp, true>
1189  : public __and_<is_copy_assignable<_Tp>,
1190  integral_constant<bool,
1191  __is_trivially_assignable(_Tp&, const _Tp&)>>
1192  { };
1193 
1194  template<typename _Tp>
1195  struct is_trivially_copy_assignable
1196  : public __is_trivially_copy_assignable_impl<_Tp>
1197  { };
1198 
1199  /// is_trivially_move_assignable
1200 
1201  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1202  struct __is_trivially_move_assignable_impl;
1203 
1204  template<typename _Tp>
1205  struct __is_trivially_move_assignable_impl<_Tp, false>
1206  : public false_type { };
1207 
1208  template<typename _Tp>
1209  struct __is_trivially_move_assignable_impl<_Tp, true>
1210  : public __and_<is_move_assignable<_Tp>,
1211  integral_constant<bool,
1212  __is_trivially_assignable(_Tp&, _Tp&&)>>
1213  { };
1214 
1215  template<typename _Tp>
1216  struct is_trivially_move_assignable
1217  : public __is_trivially_move_assignable_impl<_Tp>
1218  { };
1219 
1220  /// is_trivially_destructible
1221  template<typename _Tp>
1222  struct is_trivially_destructible
1223  : public __and_<is_destructible<_Tp>, integral_constant<bool,
1224  __has_trivial_destructor(_Tp)>>
1225  { };
1226 
1227 
1228  /// has_virtual_destructor
1229  template<typename _Tp>
1230  struct has_virtual_destructor
1231  : public integral_constant<bool, __has_virtual_destructor(_Tp)>
1232  { };
1233 
1234 
1235  // type property queries.
1236 
1237  /// alignment_of
1238  template<typename _Tp>
1239  struct alignment_of
1240  : public integral_constant<std::size_t, alignof(_Tp)> { };
1241 
1242  /// rank
1243  template<typename>
1244  struct rank
1245  : public integral_constant<std::size_t, 0> { };
1246 
1247  template<typename _Tp, std::size_t _Size>
1248  struct rank<_Tp[_Size]>
1249  : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1250 
1251  template<typename _Tp>
1252  struct rank<_Tp[]>
1253  : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1254 
1255  /// extent
1256  template<typename, unsigned _Uint>
1257  struct extent
1258  : public integral_constant<std::size_t, 0> { };
1259 
1260  template<typename _Tp, unsigned _Uint, std::size_t _Size>
1261  struct extent<_Tp[_Size], _Uint>
1262  : public integral_constant<std::size_t,
1263  _Uint == 0 ? _Size : extent<_Tp,
1264  _Uint - 1>::value>
1265  { };
1266 
1267  template<typename _Tp, unsigned _Uint>
1268  struct extent<_Tp[], _Uint>
1269  : public integral_constant<std::size_t,
1270  _Uint == 0 ? 0 : extent<_Tp,
1271  _Uint - 1>::value>
1272  { };
1273 
1274 
1275  // Type relations.
1276 
1277  /// is_same
1278  template<typename, typename>
1279  struct is_same
1280  : public false_type { };
1281 
1282  template<typename _Tp>
1283  struct is_same<_Tp, _Tp>
1284  : public true_type { };
1285 
1286  /// is_base_of
1287  template<typename _Base, typename _Derived>
1288  struct is_base_of
1289  : public integral_constant<bool, __is_base_of(_Base, _Derived)>
1290  { };
1291 
1292  template<typename _From, typename _To,
1293  bool = __or_<is_void<_From>, is_function<_To>,
1294  is_array<_To>>::value>
1295  struct __is_convertible_helper
1296  { typedef typename is_void<_To>::type type; };
1297 
1298  template<typename _From, typename _To>
1299  class __is_convertible_helper<_From, _To, false>
1300  {
1301  template<typename _To1>
1302  static void __test_aux(_To1);
1303 
1304  template<typename _From1, typename _To1,
1305  typename = decltype(__test_aux<_To1>(std::declval<_From1>()))>
1306  static true_type
1307  __test(int);
1308 
1309  template<typename, typename>
1310  static false_type
1311  __test(...);
1312 
1313  public:
1314  typedef decltype(__test<_From, _To>(0)) type;
1315  };
1316 
1317 
1318  /// is_convertible
1319  template<typename _From, typename _To>
1320  struct is_convertible
1321  : public __is_convertible_helper<_From, _To>::type
1322  { };
1323 
1324 
1325  // Const-volatile modifications.
1326 
1327  /// remove_const
1328  template<typename _Tp>
1329  struct remove_const
1330  { typedef _Tp type; };
1331 
1332  template<typename _Tp>
1333  struct remove_const<_Tp const>
1334  { typedef _Tp type; };
1335 
1336  /// remove_volatile
1337  template<typename _Tp>
1338  struct remove_volatile
1339  { typedef _Tp type; };
1340 
1341  template<typename _Tp>
1342  struct remove_volatile<_Tp volatile>
1343  { typedef _Tp type; };
1344 
1345  /// remove_cv
1346  template<typename _Tp>
1347  struct remove_cv
1348  {
1349  typedef typename
1350  remove_const<typename remove_volatile<_Tp>::type>::type type;
1351  };
1352 
1353  /// add_const
1354  template<typename _Tp>
1355  struct add_const
1356  { typedef _Tp const type; };
1357 
1358  /// add_volatile
1359  template<typename _Tp>
1360  struct add_volatile
1361  { typedef _Tp volatile type; };
1362 
1363  /// add_cv
1364  template<typename _Tp>
1365  struct add_cv
1366  {
1367  typedef typename
1368  add_const<typename add_volatile<_Tp>::type>::type type;
1369  };
1370 
1371 #if __cplusplus > 201103L
1372 
1373 #define __cpp_lib_transformation_trait_aliases 201304
1374 
1375  /// Alias template for remove_const
1376  template<typename _Tp>
1377  using remove_const_t = typename remove_const<_Tp>::type;
1378 
1379  /// Alias template for remove_volatile
1380  template<typename _Tp>
1381  using remove_volatile_t = typename remove_volatile<_Tp>::type;
1382 
1383  /// Alias template for remove_cv
1384  template<typename _Tp>
1385  using remove_cv_t = typename remove_cv<_Tp>::type;
1386 
1387  /// Alias template for add_const
1388  template<typename _Tp>
1389  using add_const_t = typename add_const<_Tp>::type;
1390 
1391  /// Alias template for add_volatile
1392  template<typename _Tp>
1393  using add_volatile_t = typename add_volatile<_Tp>::type;
1394 
1395  /// Alias template for add_cv
1396  template<typename _Tp>
1397  using add_cv_t = typename add_cv<_Tp>::type;
1398 #endif
1399 
1400  // Reference transformations.
1401 
1402  /// remove_reference
1403  template<typename _Tp>
1404  struct remove_reference
1405  { typedef _Tp type; };
1406 
1407  template<typename _Tp>
1408  struct remove_reference<_Tp&>
1409  { typedef _Tp type; };
1410 
1411  template<typename _Tp>
1412  struct remove_reference<_Tp&&>
1413  { typedef _Tp type; };
1414 
1415  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1416  struct __add_lvalue_reference_helper
1417  { typedef _Tp type; };
1418 
1419  template<typename _Tp>
1420  struct __add_lvalue_reference_helper<_Tp, true>
1421  { typedef _Tp& type; };
1422 
1423  /// add_lvalue_reference
1424  template<typename _Tp>
1425  struct add_lvalue_reference
1426  : public __add_lvalue_reference_helper<_Tp>
1427  { };
1428 
1429  template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1430  struct __add_rvalue_reference_helper
1431  { typedef _Tp type; };
1432 
1433  template<typename _Tp>
1434  struct __add_rvalue_reference_helper<_Tp, true>
1435  { typedef _Tp&& type; };
1436 
1437  /// add_rvalue_reference
1438  template<typename _Tp>
1439  struct add_rvalue_reference
1440  : public __add_rvalue_reference_helper<_Tp>
1441  { };
1442 
1443 #if __cplusplus > 201103L
1444  /// Alias template for remove_reference
1445  template<typename _Tp>
1446  using remove_reference_t = typename remove_reference<_Tp>::type;
1447 
1448  /// Alias template for add_lvalue_reference
1449  template<typename _Tp>
1450  using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type;
1451 
1452  /// Alias template for add_rvalue_reference
1453  template<typename _Tp>
1454  using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
1455 #endif
1456 
1457  // Sign modifications.
1458 
1459  // Utility for constructing identically cv-qualified types.
1460  template<typename _Unqualified, bool _IsConst, bool _IsVol>
1461  struct __cv_selector;
1462 
1463  template<typename _Unqualified>
1464  struct __cv_selector<_Unqualified, false, false>
1465  { typedef _Unqualified __type; };
1466 
1467  template<typename _Unqualified>
1468  struct __cv_selector<_Unqualified, false, true>
1469  { typedef volatile _Unqualified __type; };
1470 
1471  template<typename _Unqualified>
1472  struct __cv_selector<_Unqualified, true, false>
1473  { typedef const _Unqualified __type; };
1474 
1475  template<typename _Unqualified>
1476  struct __cv_selector<_Unqualified, true, true>
1477  { typedef const volatile _Unqualified __type; };
1478 
1479  template<typename _Qualified, typename _Unqualified,
1480  bool _IsConst = is_const<_Qualified>::value,
1481  bool _IsVol = is_volatile<_Qualified>::value>
1482  class __match_cv_qualifiers
1483  {
1484  typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match;
1485 
1486  public:
1487  typedef typename __match::__type __type;
1488  };
1489 
1490  // Utility for finding the unsigned versions of signed integral types.
1491  template<typename _Tp>
1492  struct __make_unsigned
1493  { typedef _Tp __type; };
1494 
1495  template<>
1496  struct __make_unsigned<char>
1497  { typedef unsigned char __type; };
1498 
1499  template<>
1500  struct __make_unsigned<signed char>
1501  { typedef unsigned char __type; };
1502 
1503  template<>
1504  struct __make_unsigned<short>
1505  { typedef unsigned short __type; };
1506 
1507  template<>
1508  struct __make_unsigned<int>
1509  { typedef unsigned int __type; };
1510 
1511  template<>
1512  struct __make_unsigned<long>
1513  { typedef unsigned long __type; };
1514 
1515  template<>
1516  struct __make_unsigned<long long>
1517  { typedef unsigned long long __type; };
1518 
1519 #if defined(__GLIBCXX_TYPE_INT_N_0)
1520  template<>
1521  struct __make_unsigned<__GLIBCXX_TYPE_INT_N_0>
1522  { typedef unsigned __GLIBCXX_TYPE_INT_N_0 __type; };
1523 #endif
1524 #if defined(__GLIBCXX_TYPE_INT_N_1)
1525  template<>
1526  struct __make_unsigned<__GLIBCXX_TYPE_INT_N_1>
1527  { typedef unsigned __GLIBCXX_TYPE_INT_N_1 __type; };
1528 #endif
1529 #if defined(__GLIBCXX_TYPE_INT_N_2)
1530  template<>
1531  struct __make_unsigned<__GLIBCXX_TYPE_INT_N_2>
1532  { typedef unsigned __GLIBCXX_TYPE_INT_N_2 __type; };
1533 #endif
1534 #if defined(__GLIBCXX_TYPE_INT_N_3)
1535  template<>
1536  struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3>
1537  { typedef unsigned __GLIBCXX_TYPE_INT_N_3 __type; };
1538 #endif
1539 
1540  // Select between integral and enum: not possible to be both.
1541  template<typename _Tp,
1542  bool _IsInt = is_integral<_Tp>::value,
1543  bool _IsEnum = is_enum<_Tp>::value>
1544  class __make_unsigned_selector;
1545 
1546  template<typename _Tp>
1547  class __make_unsigned_selector<_Tp, true, false>
1548  {
1549  typedef __make_unsigned<typename remove_cv<_Tp>::type> __unsignedt;
1550  typedef typename __unsignedt::__type __unsigned_type;
1551  typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
1552 
1553  public:
1554  typedef typename __cv_unsigned::__type __type;
1555  };
1556 
1557  template<typename _Tp>
1558  class __make_unsigned_selector<_Tp, false, true>
1559  {
1560  // With -fshort-enums, an enum may be as small as a char.
1561  typedef unsigned char __smallest;
1562  static const bool __b0 = sizeof(_Tp) <= sizeof(__smallest);
1563  static const bool __b1 = sizeof(_Tp) <= sizeof(unsigned short);
1564  static const bool __b2 = sizeof(_Tp) <= sizeof(unsigned int);
1565  static const bool __b3 = sizeof(_Tp) <= sizeof(unsigned long);
1566  typedef conditional<__b3, unsigned long, unsigned long long> __cond3;
1567  typedef typename __cond3::type __cond3_type;
1568  typedef conditional<__b2, unsigned int, __cond3_type> __cond2;
1569  typedef typename __cond2::type __cond2_type;
1570  typedef conditional<__b1, unsigned short, __cond2_type> __cond1;
1571  typedef typename __cond1::type __cond1_type;
1572 
1573  typedef typename conditional<__b0, __smallest, __cond1_type>::type
1574  __unsigned_type;
1575  typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
1576 
1577  public:
1578  typedef typename __cv_unsigned::__type __type;
1579  };
1580 
1581  // Given an integral/enum type, return the corresponding unsigned
1582  // integer type.
1583  // Primary template.
1584  /// make_unsigned
1585  template<typename _Tp>
1586  struct make_unsigned
1587  { typedef typename __make_unsigned_selector<_Tp>::__type type; };
1588 
1589  // Integral, but don't define.
1590  template<>
1591  struct make_unsigned<bool>;
1592 
1593 
1594  // Utility for finding the signed versions of unsigned integral types.
1595  template<typename _Tp>
1596  struct __make_signed
1597  { typedef _Tp __type; };
1598 
1599  template<>
1600  struct __make_signed<char>
1601  { typedef signed char __type; };
1602 
1603  template<>
1604  struct __make_signed<unsigned char>
1605  { typedef signed char __type; };
1606 
1607  template<>
1608  struct __make_signed<unsigned short>
1609  { typedef signed short __type; };
1610 
1611  template<>
1612  struct __make_signed<unsigned int>
1613  { typedef signed int __type; };
1614 
1615  template<>
1616  struct __make_signed<unsigned long>
1617  { typedef signed long __type; };
1618 
1619  template<>
1620  struct __make_signed<unsigned long long>
1621  { typedef signed long long __type; };
1622 
1623 #if defined(__GLIBCXX_TYPE_INT_N_0)
1624  template<>
1625  struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_0>
1626  { typedef __GLIBCXX_TYPE_INT_N_0 __type; };
1627 #endif
1628 #if defined(__GLIBCXX_TYPE_INT_N_1)
1629  template<>
1630  struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_1>
1631  { typedef __GLIBCXX_TYPE_INT_N_1 __type; };
1632 #endif
1633 #if defined(__GLIBCXX_TYPE_INT_N_2)
1634  template<>
1635  struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_2>
1636  { typedef __GLIBCXX_TYPE_INT_N_2 __type; };
1637 #endif
1638 #if defined(__GLIBCXX_TYPE_INT_N_3)
1639  template<>
1640  struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_3>
1641  { typedef __GLIBCXX_TYPE_INT_N_3 __type; };
1642 #endif
1643 
1644  // Select between integral and enum: not possible to be both.
1645  template<typename _Tp,
1646  bool _IsInt = is_integral<_Tp>::value,
1647  bool _IsEnum = is_enum<_Tp>::value>
1648  class __make_signed_selector;
1649 
1650  template<typename _Tp>
1651  class __make_signed_selector<_Tp, true, false>
1652  {
1653  typedef __make_signed<typename remove_cv<_Tp>::type> __signedt;
1654  typedef typename __signedt::__type __signed_type;
1655  typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed;
1656 
1657  public:
1658  typedef typename __cv_signed::__type __type;
1659  };
1660 
1661  template<typename _Tp>
1662  class __make_signed_selector<_Tp, false, true>
1663  {
1664  typedef typename __make_unsigned_selector<_Tp>::__type __unsigned_type;
1665 
1666  public:
1667  typedef typename __make_signed_selector<__unsigned_type>::__type __type;
1668  };
1669 
1670  // Given an integral/enum type, return the corresponding signed
1671  // integer type.
1672  // Primary template.
1673  /// make_signed
1674  template<typename _Tp>
1675  struct make_signed
1676  { typedef typename __make_signed_selector<_Tp>::__type type; };
1677 
1678  // Integral, but don't define.
1679  template<>
1680  struct make_signed<bool>;
1681 
1682 #if __cplusplus > 201103L
1683  /// Alias template for make_signed
1684  template<typename _Tp>
1685  using make_signed_t = typename make_signed<_Tp>::type;
1686 
1687  /// Alias template for make_unsigned
1688  template<typename _Tp>
1689  using make_unsigned_t = typename make_unsigned<_Tp>::type;
1690 #endif
1691 
1692  // Array modifications.
1693 
1694  /// remove_extent
1695  template<typename _Tp>
1696  struct remove_extent
1697  { typedef _Tp type; };
1698 
1699  template<typename _Tp, std::size_t _Size>
1700  struct remove_extent<_Tp[_Size]>
1701  { typedef _Tp type; };
1702 
1703  template<typename _Tp>
1704  struct remove_extent<_Tp[]>
1705  { typedef _Tp type; };
1706 
1707  /// remove_all_extents
1708  template<typename _Tp>
1709  struct remove_all_extents
1710  { typedef _Tp type; };
1711 
1712  template<typename _Tp, std::size_t _Size>
1713  struct remove_all_extents<_Tp[_Size]>
1714  { typedef typename remove_all_extents<_Tp>::type type; };
1715 
1716  template<typename _Tp>
1717  struct remove_all_extents<_Tp[]>
1718  { typedef typename remove_all_extents<_Tp>::type type; };
1719 
1720 #if __cplusplus > 201103L
1721  /// Alias template for remove_extent
1722  template<typename _Tp>
1723  using remove_extent_t = typename remove_extent<_Tp>::type;
1724 
1725  /// Alias template for remove_all_extents
1726  template<typename _Tp>
1727  using remove_all_extents_t = typename remove_all_extents<_Tp>::type;
1728 #endif
1729 
1730  // Pointer modifications.
1731 
1732  template<typename _Tp, typename>
1733  struct __remove_pointer_helper
1734  { typedef _Tp type; };
1735 
1736  template<typename _Tp, typename _Up>
1737  struct __remove_pointer_helper<_Tp, _Up*>
1738  { typedef _Up type; };
1739 
1740  /// remove_pointer
1741  template<typename _Tp>
1742  struct remove_pointer
1743  : public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
1744  { };
1745 
1746  /// add_pointer
1747  template<typename _Tp, bool = __or_<__is_referenceable<_Tp>,
1748  is_void<_Tp>>::value>
1749  struct __add_pointer_helper
1750  { typedef _Tp type; };
1751 
1752  template<typename _Tp>
1753  struct __add_pointer_helper<_Tp, true>
1754  { typedef typename remove_reference<_Tp>::type* type; };
1755 
1756  template<typename _Tp>
1757  struct add_pointer
1758  : public __add_pointer_helper<_Tp>
1759  { };
1760 
1761 #if __cplusplus > 201103L
1762  /// Alias template for remove_pointer
1763  template<typename _Tp>
1764  using remove_pointer_t = typename remove_pointer<_Tp>::type;
1765 
1766  /// Alias template for add_pointer
1767  template<typename _Tp>
1768  using add_pointer_t = typename add_pointer<_Tp>::type;
1769 #endif
1770 
1771  template<std::size_t _Len>
1772  struct __aligned_storage_msa
1773  {
1774  union __type
1775  {
1776  unsigned char __data[_Len];
1777  struct __attribute__((__aligned__)) { } __align;
1778  };
1779  };
1780 
1781  /**
1782  * @brief Alignment type.
1783  *
1784  * The value of _Align is a default-alignment which shall be the
1785  * most stringent alignment requirement for any C++ object type
1786  * whose size is no greater than _Len (3.9). The member typedef
1787  * type shall be a POD type suitable for use as uninitialized
1788  * storage for any object whose size is at most _Len and whose
1789  * alignment is a divisor of _Align.
1790  */
1791  template<std::size_t _Len, std::size_t _Align =
1792  __alignof__(typename __aligned_storage_msa<_Len>::__type)>
1793  struct aligned_storage
1794  {
1795  union type
1796  {
1797  unsigned char __data[_Len];
1798  struct __attribute__((__aligned__((_Align)))) { } __align;
1799  };
1800  };
1801 
1802  template <typename... _Types>
1803  struct __strictest_alignment
1804  {
1805  static const size_t _S_alignment = 0;
1806  static const size_t _S_size = 0;
1807  };
1808 
1809  template <typename _Tp, typename... _Types>
1810  struct __strictest_alignment<_Tp, _Types...>
1811  {
1812  static const size_t _S_alignment =
1813  alignof(_Tp) > __strictest_alignment<_Types...>::_S_alignment
1814  ? alignof(_Tp) : __strictest_alignment<_Types...>::_S_alignment;
1815  static const size_t _S_size =
1816  sizeof(_Tp) > __strictest_alignment<_Types...>::_S_size
1817  ? sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size;
1818  };
1819 
1820  /**
1821  * @brief Provide aligned storage for types.
1822  *
1823  * [meta.trans.other]
1824  *
1825  * Provides aligned storage for any of the provided types of at
1826  * least size _Len.
1827  *
1828  * @see aligned_storage
1829  */
1830  template <size_t _Len, typename... _Types>
1831  struct aligned_union
1832  {
1833  private:
1834  static_assert(sizeof...(_Types) != 0, "At least one type is required");
1835 
1836  using __strictest = __strictest_alignment<_Types...>;
1837  static const size_t _S_len = _Len > __strictest::_S_size
1838  ? _Len : __strictest::_S_size;
1839  public:
1840  /// The value of the strictest alignment of _Types.
1841  static const size_t alignment_value = __strictest::_S_alignment;
1842  /// The storage.
1843  typedef typename aligned_storage<_S_len, alignment_value>::type type;
1844  };
1845 
1846  template <size_t _Len, typename... _Types>
1847  const size_t aligned_union<_Len, _Types...>::alignment_value;
1848 
1849  // Decay trait for arrays and functions, used for perfect forwarding
1850  // in make_pair, make_tuple, etc.
1851  template<typename _Up,
1852  bool _IsArray = is_array<_Up>::value,
1853  bool _IsFunction = is_function<_Up>::value>
1854  struct __decay_selector;
1855 
1856  // NB: DR 705.
1857  template<typename _Up>
1858  struct __decay_selector<_Up, false, false>
1859  { typedef typename remove_cv<_Up>::type __type; };
1860 
1861  template<typename _Up>
1862  struct __decay_selector<_Up, true, false>
1863  { typedef typename remove_extent<_Up>::type* __type; };
1864 
1865  template<typename _Up>
1866  struct __decay_selector<_Up, false, true>
1867  { typedef typename add_pointer<_Up>::type __type; };
1868 
1869  /// decay
1870  template<typename _Tp>
1871  class decay
1872  {
1873  typedef typename remove_reference<_Tp>::type __remove_type;
1874 
1875  public:
1876  typedef typename __decay_selector<__remove_type>::__type type;
1877  };
1878 
1879  template<typename _Tp>
1880  class reference_wrapper;
1881 
1882  // Helper which adds a reference to a type when given a reference_wrapper
1883  template<typename _Tp>
1884  struct __strip_reference_wrapper
1885  {
1886  typedef _Tp __type;
1887  };
1888 
1889  template<typename _Tp>
1890  struct __strip_reference_wrapper<reference_wrapper<_Tp> >
1891  {
1892  typedef _Tp& __type;
1893  };
1894 
1895  template<typename _Tp>
1896  struct __decay_and_strip
1897  {
1898  typedef typename __strip_reference_wrapper<
1899  typename decay<_Tp>::type>::__type __type;
1900  };
1901 
1902 
1903  // Primary template.
1904  /// Define a member typedef @c type only if a boolean constant is true.
1905  template<bool, typename _Tp = void>
1906  struct enable_if
1907  { };
1908 
1909  // Partial specialization for true.
1910  template<typename _Tp>
1911  struct enable_if<true, _Tp>
1912  { typedef _Tp type; };
1913 
1914  template<typename... _Cond>
1915  using _Require = typename enable_if<__and_<_Cond...>::value>::type;
1916 
1917  // Primary template.
1918  /// Define a member typedef @c type to one of two argument types.
1919  template<bool _Cond, typename _Iftrue, typename _Iffalse>
1920  struct conditional
1921  { typedef _Iftrue type; };
1922 
1923  // Partial specialization for false.
1924  template<typename _Iftrue, typename _Iffalse>
1925  struct conditional<false, _Iftrue, _Iffalse>
1926  { typedef _Iffalse type; };
1927 
1928  /// common_type
1929  template<typename... _Tp>
1930  struct common_type;
1931 
1932  // Sfinae-friendly common_type implementation:
1933 
1934  struct __do_common_type_impl
1935  {
1936  template<typename _Tp, typename _Up>
1937  static __success_type<typename decay<decltype
1938  (true ? std::declval<_Tp>()
1939  : std::declval<_Up>())>::type> _S_test(int);
1940 
1941  template<typename, typename>
1942  static __failure_type _S_test(...);
1943  };
1944 
1945  template<typename _Tp, typename _Up>
1946  struct __common_type_impl
1947  : private __do_common_type_impl
1948  {
1949  typedef decltype(_S_test<_Tp, _Up>(0)) type;
1950  };
1951 
1952  struct __do_member_type_wrapper
1953  {
1954  template<typename _Tp>
1955  static __success_type<typename _Tp::type> _S_test(int);
1956 
1957  template<typename>
1958  static __failure_type _S_test(...);
1959  };
1960 
1961  template<typename _Tp>
1962  struct __member_type_wrapper
1963  : private __do_member_type_wrapper
1964  {
1965  typedef decltype(_S_test<_Tp>(0)) type;
1966  };
1967 
1968  template<typename _CTp, typename... _Args>
1969  struct __expanded_common_type_wrapper
1970  {
1971  typedef common_type<typename _CTp::type, _Args...> type;
1972  };
1973 
1974  template<typename... _Args>
1975  struct __expanded_common_type_wrapper<__failure_type, _Args...>
1976  { typedef __failure_type type; };
1977 
1978  template<>
1979  struct common_type<>
1980  { };
1981 
1982  template<typename _Tp>
1983  struct common_type<_Tp>
1984  : common_type<_Tp, _Tp>
1985  { };
1986 
1987  template<typename _Tp, typename _Up>
1988  struct common_type<_Tp, _Up>
1989  : public __common_type_impl<_Tp, _Up>::type
1990  { };
1991 
1992  template<typename _Tp, typename _Up, typename... _Vp>
1993  struct common_type<_Tp, _Up, _Vp...>
1994  : public __expanded_common_type_wrapper<typename __member_type_wrapper<
1995  common_type<_Tp, _Up>>::type, _Vp...>::type
1996  { };
1997 
1998  /// The underlying type of an enum.
1999  template<typename _Tp>
2000  struct underlying_type
2001  {
2002  typedef __underlying_type(_Tp) type;
2003  };
2004 
2005  template<typename _Tp>
2006  struct __declval_protector
2007  {
2008  static const bool __stop = false;
2009  };
2010 
2011  template<typename _Tp>
2012  auto declval() noexcept -> decltype(__declval<_Tp>(0))
2013  {
2014  static_assert(__declval_protector<_Tp>::__stop,
2015  "declval() must not be used!");
2016  return __declval<_Tp>(0);
2017  }
2018 
2019  // wchar_t, char16_t and char32_t are integral types but are neither
2020  // signed integer types nor unsigned integer types, so must be
2021  // transformed to the integer type with the smallest rank that has the
2022  // same size and signedness.
2023  // Use the partial specialization for enumeration types to do that,
2024  // which means these explicit specializations must be defined after
2025  // std::conditional has been defined.
2026 
2027 #if defined(_GLIBCXX_USE_WCHAR_T)
2028  template<>
2029  struct __make_unsigned<wchar_t>
2030  {
2031  using __type
2032  = typename __make_unsigned_selector<wchar_t, false, true>::__type;
2033  };
2034 
2035  template<>
2036  struct __make_signed<wchar_t>
2037  {
2038  using __type
2039  = typename __make_signed_selector<wchar_t, false, true>::__type;
2040  };
2041 #endif
2042 
2043  template<>
2044  struct __make_unsigned<char16_t>
2045  {
2046  using __type
2047  = typename __make_unsigned_selector<char16_t, false, true>::__type;
2048  };
2049 
2050  template<>
2051  struct __make_signed<char16_t>
2052  {
2053  using __type
2054  = typename __make_signed_selector<char16_t, false, true>::__type;
2055  };
2056 
2057  template<>
2058  struct __make_unsigned<char32_t>
2059  {
2060  using __type
2061  = typename __make_unsigned_selector<char32_t, false, true>::__type;
2062  };
2063 
2064  template<>
2065  struct __make_signed<char32_t>
2066  {
2067  using __type
2068  = typename __make_signed_selector<char32_t, false, true>::__type;
2069  };
2070 
2071 
2072  /// result_of
2073  template<typename _Signature>
2074  class result_of;
2075 
2076  // Sfinae-friendly result_of implementation:
2077 
2078 #define __cpp_lib_result_of_sfinae 201210
2079 
2080  struct __invoke_memfun_ref { };
2081  struct __invoke_memfun_deref { };
2082  struct __invoke_memobj_ref { };
2083  struct __invoke_memobj_deref { };
2084  struct __invoke_other { };
2085 
2086  // Associate a tag type with a specialization of __success_type.
2087  template<typename _Tp, typename _Tag>
2088  struct __result_of_success : __success_type<_Tp>
2089  { using __invoke_type = _Tag; };
2090 
2091  // [func.require] paragraph 1 bullet 1:
2092  struct __result_of_memfun_ref_impl
2093  {
2094  template<typename _Fp, typename _Tp1, typename... _Args>
2095  static __result_of_success<decltype(
2096  (std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...)
2097  ), __invoke_memfun_ref> _S_test(int);
2098 
2099  template<typename...>
2100  static __failure_type _S_test(...);
2101  };
2102 
2103  template<typename _MemPtr, typename _Arg, typename... _Args>
2104  struct __result_of_memfun_ref
2105  : private __result_of_memfun_ref_impl
2106  {
2107  typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type;
2108  };
2109 
2110  // [func.require] paragraph 1 bullet 2:
2111  struct __result_of_memfun_deref_impl
2112  {
2113  template<typename _Fp, typename _Tp1, typename... _Args>
2114  static __result_of_success<decltype(
2115  ((*std::declval<_Tp1>()).*std::declval<_Fp>())(std::declval<_Args>()...)
2116  ), __invoke_memfun_deref> _S_test(int);
2117 
2118  template<typename...>
2119  static __failure_type _S_test(...);
2120  };
2121 
2122  template<typename _MemPtr, typename _Arg, typename... _Args>
2123  struct __result_of_memfun_deref
2124  : private __result_of_memfun_deref_impl
2125  {
2126  typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type;
2127  };
2128 
2129  // [func.require] paragraph 1 bullet 3:
2130  struct __result_of_memobj_ref_impl
2131  {
2132  template<typename _Fp, typename _Tp1>
2133  static __result_of_success<decltype(
2134  std::declval<_Tp1>().*std::declval<_Fp>()
2135  ), __invoke_memobj_ref> _S_test(int);
2136 
2137  template<typename, typename>
2138  static __failure_type _S_test(...);
2139  };
2140 
2141  template<typename _MemPtr, typename _Arg>
2142  struct __result_of_memobj_ref
2143  : private __result_of_memobj_ref_impl
2144  {
2145  typedef decltype(_S_test<_MemPtr, _Arg>(0)) type;
2146  };
2147 
2148  // [func.require] paragraph 1 bullet 4:
2149  struct __result_of_memobj_deref_impl
2150  {
2151  template<typename _Fp, typename _Tp1>
2152  static __result_of_success<decltype(
2153  (*std::declval<_Tp1>()).*std::declval<_Fp>()
2154  ), __invoke_memobj_deref> _S_test(int);
2155 
2156  template<typename, typename>
2157  static __failure_type _S_test(...);
2158  };
2159 
2160  template<typename _MemPtr, typename _Arg>
2161  struct __result_of_memobj_deref
2162  : private __result_of_memobj_deref_impl
2163  {
2164  typedef decltype(_S_test<_MemPtr, _Arg>(0)) type;
2165  };
2166 
2167  template<typename _MemPtr, typename _Arg>
2168  struct __result_of_memobj;
2169 
2170  template<typename _Res, typename _Class, typename _Arg>
2171  struct __result_of_memobj<_Res _Class::*, _Arg>
2172  {
2173  typedef typename remove_cv<typename remove_reference<
2174  _Arg>::type>::type _Argval;
2175  typedef _Res _Class::* _MemPtr;
2176  typedef typename conditional<__or_<is_same<_Argval, _Class>,
2177  is_base_of<_Class, _Argval>>::value,
2178  __result_of_memobj_ref<_MemPtr, _Arg>,
2179  __result_of_memobj_deref<_MemPtr, _Arg>
2180  >::type::type type;
2181  };
2182 
2183  template<typename _MemPtr, typename _Arg, typename... _Args>
2184  struct __result_of_memfun;
2185 
2186  template<typename _Res, typename _Class, typename _Arg, typename... _Args>
2187  struct __result_of_memfun<_Res _Class::*, _Arg, _Args...>
2188  {
2189  typedef typename remove_cv<typename remove_reference<
2190  _Arg>::type>::type _Argval;
2191  typedef _Res _Class::* _MemPtr;
2192  typedef typename conditional<__or_<is_same<_Argval, _Class>,
2193  is_base_of<_Class, _Argval>>::value,
2194  __result_of_memfun_ref<_MemPtr, _Arg, _Args...>,
2195  __result_of_memfun_deref<_MemPtr, _Arg, _Args...>
2196  >::type::type type;
2197  };
2198 
2199  // _GLIBCXX_RESOLVE_LIB_DEFECTS
2200  // 2219. INVOKE-ing a pointer to member with a reference_wrapper
2201  // as the object expression
2202 
2203  // Used by result_of, invoke etc. to unwrap a reference_wrapper.
2204  template<typename _Tp, typename _Up = typename decay<_Tp>::type>
2205  struct __inv_unwrap
2206  {
2207  using type = _Tp;
2208  };
2209 
2210  template<typename _Tp, typename _Up>
2211  struct __inv_unwrap<_Tp, reference_wrapper<_Up>>
2212  {
2213  using type = _Up&;
2214  };
2215 
2216  template<bool, bool, typename _Functor, typename... _ArgTypes>
2217  struct __result_of_impl
2218  {
2219  typedef __failure_type type;
2220  };
2221 
2222  template<typename _MemPtr, typename _Arg>
2223  struct __result_of_impl<true, false, _MemPtr, _Arg>
2224  : public __result_of_memobj<typename decay<_MemPtr>::type,
2225  typename __inv_unwrap<_Arg>::type>
2226  { };
2227 
2228  template<typename _MemPtr, typename _Arg, typename... _Args>
2229  struct __result_of_impl<false, true, _MemPtr, _Arg, _Args...>
2230  : public __result_of_memfun<typename decay<_MemPtr>::type,
2231  typename __inv_unwrap<_Arg>::type, _Args...>
2232  { };
2233 
2234  // [func.require] paragraph 1 bullet 5:
2235  struct __result_of_other_impl
2236  {
2237  template<typename _Fn, typename... _Args>
2238  static __result_of_success<decltype(
2239  std::declval<_Fn>()(std::declval<_Args>()...)
2240  ), __invoke_other> _S_test(int);
2241 
2242  template<typename...>
2243  static __failure_type _S_test(...);
2244  };
2245 
2246  template<typename _Functor, typename... _ArgTypes>
2247  struct __result_of_impl<false, false, _Functor, _ArgTypes...>
2248  : private __result_of_other_impl
2249  {
2250  typedef decltype(_S_test<_Functor, _ArgTypes...>(0)) type;
2251  };
2252 
2253  // __invoke_result (std::invoke_result for C++11)
2254  template<typename _Functor, typename... _ArgTypes>
2255  struct __invoke_result
2256  : public __result_of_impl<
2257  is_member_object_pointer<
2258  typename remove_reference<_Functor>::type
2259  >::value,
2260  is_member_function_pointer<
2261  typename remove_reference<_Functor>::type
2262  >::value,
2263  _Functor, _ArgTypes...
2264  >::type
2265  { };
2266 
2267  template<typename _Functor, typename... _ArgTypes>
2268  struct result_of<_Functor(_ArgTypes...)>
2269  : public __invoke_result<_Functor, _ArgTypes...>
2270  { };
2271 
2272 #if __cplusplus >= 201402L
2273  /// Alias template for aligned_storage
2274  template<size_t _Len, size_t _Align =
2275  __alignof__(typename __aligned_storage_msa<_Len>::__type)>
2276  using aligned_storage_t = typename aligned_storage<_Len, _Align>::type;
2277 
2278  template <size_t _Len, typename... _Types>
2279  using aligned_union_t = typename aligned_union<_Len, _Types...>::type;
2280 
2281  /// Alias template for decay
2282  template<typename _Tp>
2283  using decay_t = typename decay<_Tp>::type;
2284 
2285  /// Alias template for enable_if
2286  template<bool _Cond, typename _Tp = void>
2287  using enable_if_t = typename enable_if<_Cond, _Tp>::type;
2288 
2289  /// Alias template for conditional
2290  template<bool _Cond, typename _Iftrue, typename _Iffalse>
2291  using conditional_t = typename conditional<_Cond, _Iftrue, _Iffalse>::type;
2292 
2293  /// Alias template for common_type
2294  template<typename... _Tp>
2295  using common_type_t = typename common_type<_Tp...>::type;
2296 
2297  /// Alias template for underlying_type
2298  template<typename _Tp>
2299  using underlying_type_t = typename underlying_type<_Tp>::type;
2300 
2301  /// Alias template for result_of
2302  template<typename _Tp>
2303  using result_of_t = typename result_of<_Tp>::type;
2304 #endif // C++14
2305 
2306  // __enable_if_t (std::enable_if_t for C++11)
2307  template<bool _Cond, typename _Tp = void>
2308  using __enable_if_t = typename enable_if<_Cond, _Tp>::type;
2309 
2310  // __void_t (std::void_t for C++11)
2311  template<typename...> using __void_t = void;
2312 
2313 #if __cplusplus >= 201703L || !defined(__STRICT_ANSI__) // c++17 or gnu++11
2314 #define __cpp_lib_void_t 201411
2315  /// A metafunction that always yields void, used for detecting valid types.
2316  template<typename...> using void_t = void;
2317 #endif
2318 
2319  /// Implementation of the detection idiom (negative case).
2320  template<typename _Default, typename _AlwaysVoid,
2321  template<typename...> class _Op, typename... _Args>
2322  struct __detector
2323  {
2324  using value_t = false_type;
2325  using type = _Default;
2326  };
2327 
2328  /// Implementation of the detection idiom (positive case).
2329  template<typename _Default, template<typename...> class _Op,
2330  typename... _Args>
2331  struct __detector<_Default, __void_t<_Op<_Args...>>, _Op, _Args...>
2332  {
2333  using value_t = true_type;
2334  using type = _Op<_Args...>;
2335  };
2336 
2337  // Detect whether _Op<_Args...> is a valid type, use _Default if not.
2338  template<typename _Default, template<typename...> class _Op,
2339  typename... _Args>
2340  using __detected_or = __detector<_Default, void, _Op, _Args...>;
2341 
2342  // _Op<_Args...> if that is a valid type, otherwise _Default.
2343  template<typename _Default, template<typename...> class _Op,
2344  typename... _Args>
2345  using __detected_or_t
2346  = typename __detected_or<_Default, _Op, _Args...>::type;
2347 
2348  /// @} group metaprogramming
2349 
2350  /**
2351  * Use SFINAE to determine if the type _Tp has a publicly-accessible
2352  * member type _NTYPE.
2353  */
2354 #define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
2355  template<typename _Tp, typename = __void_t<>> \
2356  struct __has_##_NTYPE \
2357  : false_type \
2358  { }; \
2359  template<typename _Tp> \
2360  struct __has_##_NTYPE<_Tp, __void_t<typename _Tp::_NTYPE>> \
2361  : true_type \
2362  { };
2363 
2364  template <typename _Tp>
2365  struct __is_swappable;
2366 
2367  template <typename _Tp>
2368  struct __is_nothrow_swappable;
2369 
2370  template<typename... _Elements>
2371  class tuple;
2372 
2373  template<typename>
2374  struct __is_tuple_like_impl : false_type
2375  { };
2376 
2377  template<typename... _Tps>
2378  struct __is_tuple_like_impl<tuple<_Tps...>> : true_type
2379  { };
2380 
2381  // Internal type trait that allows us to sfinae-protect tuple_cat.
2382  template<typename _Tp>
2383  struct __is_tuple_like
2384  : public __is_tuple_like_impl<typename remove_cv<
2385  typename remove_reference<_Tp>::type>::type>::type
2386  { };
2387 
2388  template<typename _Tp>
2389  inline
2390  typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>,
2391  is_move_constructible<_Tp>,
2392  is_move_assignable<_Tp>>::value>::type
2393  swap(_Tp&, _Tp&)
2394  noexcept(__and_<is_nothrow_move_constructible<_Tp>,
2395  is_nothrow_move_assignable<_Tp>>::value);
2396 
2397  template<typename _Tp, size_t _Nm>
2398  inline
2399  typename enable_if<__is_swappable<_Tp>::value>::type
2400  swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
2401  noexcept(__is_nothrow_swappable<_Tp>::value);
2402 
2403  namespace __swappable_details {
2404  using std::swap;
2405 
2406  struct __do_is_swappable_impl
2407  {
2408  template<typename _Tp, typename
2409  = decltype(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))>
2410  static true_type __test(int);
2411 
2412  template<typename>
2413  static false_type __test(...);
2414  };
2415 
2416  struct __do_is_nothrow_swappable_impl
2417  {
2418  template<typename _Tp>
2419  static __bool_constant<
2420  noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>()))
2421  > __test(int);
2422 
2423  template<typename>
2424  static false_type __test(...);
2425  };
2426 
2427  } // namespace __swappable_details
2428 
2429  template<typename _Tp>
2430  struct __is_swappable_impl
2431  : public __swappable_details::__do_is_swappable_impl
2432  {
2433  typedef decltype(__test<_Tp>(0)) type;
2434  };
2435 
2436  template<typename _Tp>
2437  struct __is_nothrow_swappable_impl
2438  : public __swappable_details::__do_is_nothrow_swappable_impl
2439  {
2440  typedef decltype(__test<_Tp>(0)) type;
2441  };
2442 
2443  template<typename _Tp>
2444  struct __is_swappable
2445  : public __is_swappable_impl<_Tp>::type
2446  { };
2447 
2448  template<typename _Tp>
2449  struct __is_nothrow_swappable
2450  : public __is_nothrow_swappable_impl<_Tp>::type
2451  { };
2452 
2453 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
2454 #define __cpp_lib_is_swappable 201603
2455  /// Metafunctions used for detecting swappable types: p0185r1
2456 
2457  /// is_swappable
2458  template<typename _Tp>
2459  struct is_swappable
2460  : public __is_swappable_impl<_Tp>::type
2461  { };
2462 
2463  /// is_nothrow_swappable
2464  template<typename _Tp>
2465  struct is_nothrow_swappable
2466  : public __is_nothrow_swappable_impl<_Tp>::type
2467  { };
2468 
2469 #if __cplusplus >= 201402L
2470  /// is_swappable_v
2471  template<typename _Tp>
2472  _GLIBCXX17_INLINE constexpr bool is_swappable_v =
2473  is_swappable<_Tp>::value;
2474 
2475  /// is_nothrow_swappable_v
2476  template<typename _Tp>
2477  _GLIBCXX17_INLINE constexpr bool is_nothrow_swappable_v =
2478  is_nothrow_swappable<_Tp>::value;
2479 #endif // __cplusplus >= 201402L
2480 
2481  namespace __swappable_with_details {
2482  using std::swap;
2483 
2484  struct __do_is_swappable_with_impl
2485  {
2486  template<typename _Tp, typename _Up, typename
2487  = decltype(swap(std::declval<_Tp>(), std::declval<_Up>())),
2488  typename
2489  = decltype(swap(std::declval<_Up>(), std::declval<_Tp>()))>
2490  static true_type __test(int);
2491 
2492  template<typename, typename>
2493  static false_type __test(...);
2494  };
2495 
2496  struct __do_is_nothrow_swappable_with_impl
2497  {
2498  template<typename _Tp, typename _Up>
2499  static __bool_constant<
2500  noexcept(swap(std::declval<_Tp>(), std::declval<_Up>()))
2501  &&
2502  noexcept(swap(std::declval<_Up>(), std::declval<_Tp>()))
2503  > __test(int);
2504 
2505  template<typename, typename>
2506  static false_type __test(...);
2507  };
2508 
2509  } // namespace __swappable_with_details
2510 
2511  template<typename _Tp, typename _Up>
2512  struct __is_swappable_with_impl
2513  : public __swappable_with_details::__do_is_swappable_with_impl
2514  {
2515  typedef decltype(__test<_Tp, _Up>(0)) type;
2516  };
2517 
2518  // Optimization for the homogenous lvalue case, not required:
2519  template<typename _Tp>
2520  struct __is_swappable_with_impl<_Tp&, _Tp&>
2521  : public __swappable_details::__do_is_swappable_impl
2522  {
2523  typedef decltype(__test<_Tp&>(0)) type;
2524  };
2525 
2526  template<typename _Tp, typename _Up>
2527  struct __is_nothrow_swappable_with_impl
2528  : public __swappable_with_details::__do_is_nothrow_swappable_with_impl
2529  {
2530  typedef decltype(__test<_Tp, _Up>(0)) type;
2531  };
2532 
2533  // Optimization for the homogenous lvalue case, not required:
2534  template<typename _Tp>
2535  struct __is_nothrow_swappable_with_impl<_Tp&, _Tp&>
2536  : public __swappable_details::__do_is_nothrow_swappable_impl
2537  {
2538  typedef decltype(__test<_Tp&>(0)) type;
2539  };
2540 
2541  /// is_swappable_with
2542  template<typename _Tp, typename _Up>
2543  struct is_swappable_with
2544  : public __is_swappable_with_impl<_Tp, _Up>::type
2545  { };
2546 
2547  /// is_nothrow_swappable_with
2548  template<typename _Tp, typename _Up>
2549  struct is_nothrow_swappable_with
2550  : public __is_nothrow_swappable_with_impl<_Tp, _Up>::type
2551  { };
2552 
2553 #if __cplusplus >= 201402L
2554  /// is_swappable_with_v
2555  template<typename _Tp, typename _Up>
2556  _GLIBCXX17_INLINE constexpr bool is_swappable_with_v =
2557  is_swappable_with<_Tp, _Up>::value;
2558 
2559  /// is_nothrow_swappable_with_v
2560  template<typename _Tp, typename _Up>
2561  _GLIBCXX17_INLINE constexpr bool is_nothrow_swappable_with_v =
2562  is_nothrow_swappable_with<_Tp, _Up>::value;
2563 #endif // __cplusplus >= 201402L
2564 
2565 #endif// c++1z or gnu++11
2566 
2567  // __is_invocable (std::is_invocable for C++11)
2568 
2569  template<typename _Result, typename _Ret, typename = void>
2570  struct __is_invocable_impl : false_type { };
2571 
2572  template<typename _Result, typename _Ret>
2573  struct __is_invocable_impl<_Result, _Ret, __void_t<typename _Result::type>>
2574  : __or_<is_void<_Ret>, is_convertible<typename _Result::type, _Ret>>::type
2575  { };
2576 
2577  template<typename _Fn, typename... _ArgTypes>
2578  struct __is_invocable
2579  : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
2580  { };
2581 
2582  template<typename _Fn, typename _Tp, typename... _Args>
2583  constexpr bool __call_is_nt(__invoke_memfun_ref)
2584  {
2585  using _Up = typename __inv_unwrap<_Tp>::type;
2586  return noexcept((std::declval<_Up>().*std::declval<_Fn>())(
2587  std::declval<_Args>()...));
2588  }
2589 
2590  template<typename _Fn, typename _Tp, typename... _Args>
2591  constexpr bool __call_is_nt(__invoke_memfun_deref)
2592  {
2593  return noexcept(((*std::declval<_Tp>()).*std::declval<_Fn>())(
2594  std::declval<_Args>()...));
2595  }
2596 
2597  template<typename _Fn, typename _Tp>
2598  constexpr bool __call_is_nt(__invoke_memobj_ref)
2599  {
2600  using _Up = typename __inv_unwrap<_Tp>::type;
2601  return noexcept(std::declval<_Up>().*std::declval<_Fn>());
2602  }
2603 
2604  template<typename _Fn, typename _Tp>
2605  constexpr bool __call_is_nt(__invoke_memobj_deref)
2606  {
2607  return noexcept((*std::declval<_Tp>()).*std::declval<_Fn>());
2608  }
2609 
2610  template<typename _Fn, typename... _Args>
2611  constexpr bool __call_is_nt(__invoke_other)
2612  {
2613  return noexcept(std::declval<_Fn>()(std::declval<_Args>()...));
2614  }
2615 
2616  template<typename _Result, typename _Fn, typename... _Args>
2617  struct __call_is_nothrow
2618  : __bool_constant<
2619  std::__call_is_nt<_Fn, _Args...>(typename _Result::__invoke_type{})
2620  >
2621  { };
2622 
2623  template<typename _Fn, typename... _Args>
2624  using __call_is_nothrow_
2625  = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>;
2626 
2627  // __is_nothrow_invocable (std::is_nothrow_invocable for C++11)
2628  template<typename _Fn, typename... _Args>
2629  struct __is_nothrow_invocable
2630  : __and_<__is_invocable<_Fn, _Args...>,
2631  __call_is_nothrow_<_Fn, _Args...>>::type
2632  { };
2633 
2634  struct __nonesuch {
2635  __nonesuch() = delete;
2636  ~__nonesuch() = delete;
2637  __nonesuch(__nonesuch const&) = delete;
2638  void operator=(__nonesuch const&) = delete;
2639  };
2640 
2641 #if __cplusplus >= 201703L
2642 # define __cpp_lib_is_invocable 201703
2643 
2644  /// std::invoke_result
2645  template<typename _Functor, typename... _ArgTypes>
2646  struct invoke_result
2647  : public __invoke_result<_Functor, _ArgTypes...>
2648  { };
2649 
2650  /// std::invoke_result_t
2651  template<typename _Fn, typename... _Args>
2652  using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
2653 
2654  /// std::is_invocable
2655  template<typename _Fn, typename... _ArgTypes>
2656  struct is_invocable
2657  : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type
2658  { };
2659 
2660  /// std::is_invocable_r
2661  template<typename _Ret, typename _Fn, typename... _ArgTypes>
2662  struct is_invocable_r
2663  : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>::type
2664  { };
2665 
2666  /// std::is_nothrow_invocable
2667  template<typename _Fn, typename... _ArgTypes>
2668  struct is_nothrow_invocable
2669  : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>,
2670  __call_is_nothrow_<_Fn, _ArgTypes...>>::type
2671  { };
2672 
2673  template<typename _Result, typename _Ret, typename = void>
2674  struct __is_nt_invocable_impl : false_type { };
2675 
2676  template<typename _Result, typename _Ret>
2677  struct __is_nt_invocable_impl<_Result, _Ret,
2678  __void_t<typename _Result::type>>
2679  : __or_<is_void<_Ret>,
2680  __and_<is_convertible<typename _Result::type, _Ret>,
2681  is_nothrow_constructible<_Ret, typename _Result::type>>>
2682  { };
2683 
2684  /// std::is_nothrow_invocable_r
2685  template<typename _Ret, typename _Fn, typename... _ArgTypes>
2686  struct is_nothrow_invocable_r
2687  : __and_<__is_nt_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>,
2688  __call_is_nothrow_<_Fn, _ArgTypes...>>::type
2689  { };
2690 
2691  /// std::is_invocable_v
2692  template<typename _Fn, typename... _Args>
2693  inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value;
2694 
2695  /// std::is_nothrow_invocable_v
2696  template<typename _Fn, typename... _Args>
2697  inline constexpr bool is_nothrow_invocable_v
2698  = is_nothrow_invocable<_Fn, _Args...>::value;
2699 
2700  /// std::is_invocable_r_v
2701  template<typename _Fn, typename... _Args>
2702  inline constexpr bool is_invocable_r_v
2703  = is_invocable_r<_Fn, _Args...>::value;
2704 
2705  /// std::is_nothrow_invocable_r_v
2706  template<typename _Fn, typename... _Args>
2707  inline constexpr bool is_nothrow_invocable_r_v
2708  = is_nothrow_invocable_r<_Fn, _Args...>::value;
2709 #endif // C++17
2710 
2711 #if __cplusplus >= 201703L
2712 # define __cpp_lib_type_trait_variable_templates 201510L
2713 template <typename _Tp>
2714  inline constexpr bool is_void_v = is_void<_Tp>::value;
2715 template <typename _Tp>
2716  inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
2717 template <typename _Tp>
2718  inline constexpr bool is_integral_v = is_integral<_Tp>::value;
2719 template <typename _Tp>
2720  inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
2721 template <typename _Tp>
2722  inline constexpr bool is_array_v = is_array<_Tp>::value;
2723 template <typename _Tp>
2724  inline constexpr bool is_pointer_v = is_pointer<_Tp>::value;
2725 template <typename _Tp>
2726  inline constexpr bool is_lvalue_reference_v =
2727  is_lvalue_reference<_Tp>::value;
2728 template <typename _Tp>
2729  inline constexpr bool is_rvalue_reference_v =
2730  is_rvalue_reference<_Tp>::value;
2731 template <typename _Tp>
2732  inline constexpr bool is_member_object_pointer_v =
2733  is_member_object_pointer<_Tp>::value;
2734 template <typename _Tp>
2735  inline constexpr bool is_member_function_pointer_v =
2736  is_member_function_pointer<_Tp>::value;
2737 template <typename _Tp>
2738  inline constexpr bool is_enum_v = is_enum<_Tp>::value;
2739 template <typename _Tp>
2740  inline constexpr bool is_union_v = is_union<_Tp>::value;
2741 template <typename _Tp>
2742  inline constexpr bool is_class_v = is_class<_Tp>::value;
2743 template <typename _Tp>
2744  inline constexpr bool is_function_v = is_function<_Tp>::value;
2745 template <typename _Tp>
2746  inline constexpr bool is_reference_v = is_reference<_Tp>::value;
2747 template <typename _Tp>
2748  inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
2749 template <typename _Tp>
2750  inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
2751 template <typename _Tp>
2752  inline constexpr bool is_object_v = is_object<_Tp>::value;
2753 template <typename _Tp>
2754  inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
2755 template <typename _Tp>
2756  inline constexpr bool is_compound_v = is_compound<_Tp>::value;
2757 template <typename _Tp>
2758  inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
2759 template <typename _Tp>
2760  inline constexpr bool is_const_v = is_const<_Tp>::value;
2761 template <typename _Tp>
2762  inline constexpr bool is_volatile_v = is_volatile<_Tp>::value;
2763 template <typename _Tp>
2764  inline constexpr bool is_trivial_v = is_trivial<_Tp>::value;
2765 template <typename _Tp>
2766  inline constexpr bool is_trivially_copyable_v =
2767  is_trivially_copyable<_Tp>::value;
2768 template <typename _Tp>
2769  inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
2770 template <typename _Tp>
2771  inline constexpr bool is_pod_v = is_pod<_Tp>::value;
2772 template <typename _Tp>
2773  inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
2774 template <typename _Tp>
2775  inline constexpr bool is_empty_v = is_empty<_Tp>::value;
2776 template <typename _Tp>
2777  inline constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value;
2778 template <typename _Tp>
2779  inline constexpr bool is_abstract_v = is_abstract<_Tp>::value;
2780 template <typename _Tp>
2781  inline constexpr bool is_final_v = is_final<_Tp>::value;
2782 template <typename _Tp>
2783  inline constexpr bool is_signed_v = is_signed<_Tp>::value;
2784 template <typename _Tp>
2785  inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;
2786 template <typename _Tp, typename... _Args>
2787  inline constexpr bool is_constructible_v =
2788  is_constructible<_Tp, _Args...>::value;
2789 template <typename _Tp>
2790  inline constexpr bool is_default_constructible_v =
2791  is_default_constructible<_Tp>::value;
2792 template <typename _Tp>
2793  inline constexpr bool is_copy_constructible_v =
2794  is_copy_constructible<_Tp>::value;
2795 template <typename _Tp>
2796  inline constexpr bool is_move_constructible_v =
2797  is_move_constructible<_Tp>::value;
2798 template <typename _Tp, typename _Up>
2799  inline constexpr bool is_assignable_v = is_assignable<_Tp, _Up>::value;
2800 template <typename _Tp>
2801  inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value;
2802 template <typename _Tp>
2803  inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value;
2804 template <typename _Tp>
2805  inline constexpr bool is_destructible_v = is_destructible<_Tp>::value;
2806 template <typename _Tp, typename... _Args>
2807  inline constexpr bool is_trivially_constructible_v =
2808  is_trivially_constructible<_Tp, _Args...>::value;
2809 template <typename _Tp>
2810  inline constexpr bool is_trivially_default_constructible_v =
2811  is_trivially_default_constructible<_Tp>::value;
2812 template <typename _Tp>
2813  inline constexpr bool is_trivially_copy_constructible_v =
2814  is_trivially_copy_constructible<_Tp>::value;
2815 template <typename _Tp>
2816  inline constexpr bool is_trivially_move_constructible_v =
2817  is_trivially_move_constructible<_Tp>::value;
2818 template <typename _Tp, typename _Up>
2819  inline constexpr bool is_trivially_assignable_v =
2820  is_trivially_assignable<_Tp, _Up>::value;
2821 template <typename _Tp>
2822  inline constexpr bool is_trivially_copy_assignable_v =
2823  is_trivially_copy_assignable<_Tp>::value;
2824 template <typename _Tp>
2825  inline constexpr bool is_trivially_move_assignable_v =
2826  is_trivially_move_assignable<_Tp>::value;
2827 template <typename _Tp>
2828  inline constexpr bool is_trivially_destructible_v =
2829  is_trivially_destructible<_Tp>::value;
2830 template <typename _Tp, typename... _Args>
2831  inline constexpr bool is_nothrow_constructible_v =
2832  is_nothrow_constructible<_Tp, _Args...>::value;
2833 template <typename _Tp>
2834  inline constexpr bool is_nothrow_default_constructible_v =
2835  is_nothrow_default_constructible<_Tp>::value;
2836 template <typename _Tp>
2837  inline constexpr bool is_nothrow_copy_constructible_v =
2838  is_nothrow_copy_constructible<_Tp>::value;
2839 template <typename _Tp>
2840  inline constexpr bool is_nothrow_move_constructible_v =
2841  is_nothrow_move_constructible<_Tp>::value;
2842 template <typename _Tp, typename _Up>
2843  inline constexpr bool is_nothrow_assignable_v =
2844  is_nothrow_assignable<_Tp, _Up>::value;
2845 template <typename _Tp>
2846  inline constexpr bool is_nothrow_copy_assignable_v =
2847  is_nothrow_copy_assignable<_Tp>::value;
2848 template <typename _Tp>
2849  inline constexpr bool is_nothrow_move_assignable_v =
2850  is_nothrow_move_assignable<_Tp>::value;
2851 template <typename _Tp>
2852  inline constexpr bool is_nothrow_destructible_v =
2853  is_nothrow_destructible<_Tp>::value;
2854 template <typename _Tp>
2855  inline constexpr bool has_virtual_destructor_v =
2856  has_virtual_destructor<_Tp>::value;
2857 template <typename _Tp>
2858  inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
2859 template <typename _Tp>
2860  inline constexpr size_t rank_v = rank<_Tp>::value;
2861 template <typename _Tp, unsigned _Idx = 0>
2862  inline constexpr size_t extent_v = extent<_Tp, _Idx>::value;
2863 template <typename _Tp, typename _Up>
2864  inline constexpr bool is_same_v = is_same<_Tp, _Up>::value;
2865 template <typename _Base, typename _Derived>
2866  inline constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value;
2867 template <typename _From, typename _To>
2868  inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
2869 
2870 #if __GNUC__ >= 7
2871 # define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
2872 #elif defined(__is_identifier)
2873 // For non-GNU compilers:
2874 # if ! __is_identifier(__has_unique_object_representations)
2875 # define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
2876 # endif
2877 #endif
2878 
2879 #ifdef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
2880 # define __cpp_lib_has_unique_object_representations 201606
2881  /// has_unique_object_representations
2882  template<typename _Tp>
2883  struct has_unique_object_representations
2884  : bool_constant<__has_unique_object_representations(
2885  remove_cv_t<remove_all_extents_t<_Tp>>
2886  )>
2887  { };
2888 
2889  template<typename _Tp>
2890  inline constexpr bool has_unique_object_representations_v
2891  = has_unique_object_representations<_Tp>::value;
2892 #endif
2893 #undef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
2894 
2895 #if __GNUC__ >= 7
2896 # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
2897 #elif defined(__is_identifier)
2898 // For non-GNU compilers:
2899 # if ! __is_identifier(__is_aggregate)
2900 # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
2901 # endif
2902 #endif
2903 
2904 #ifdef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
2905 #define __cpp_lib_is_aggregate 201703
2906  /// is_aggregate
2907  template<typename _Tp>
2908  struct is_aggregate
2909  : bool_constant<__is_aggregate(remove_cv_t<_Tp>)> { };
2910 
2911  /// is_aggregate_v
2912  template<typename _Tp>
2913  inline constexpr bool is_aggregate_v = is_aggregate<_Tp>::value;
2914 #endif
2915 #undef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
2916 
2917 #endif // C++17
2918 
2919 #if __cplusplus > 201703L
2920  /// Byte order
2921  enum class endian
2922  {
2923  little = __ORDER_LITTLE_ENDIAN__,
2924  big = __ORDER_BIG_ENDIAN__,
2925  native = __BYTE_ORDER__
2926  };
2927 #endif // C++2a
2928 
2929 _GLIBCXX_END_NAMESPACE_VERSION
2930 } // namespace std
2931 
2932 #endif // C++11
2933 
2934 #endif // _GLIBCXX_TYPE_TRAITS