libstdc++
experimental/type_traits
Go to the documentation of this file.
1 // Variable Templates For Type Traits -*- C++ -*-
2 
3 // Copyright (C) 2014-2015 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 experimental/type_traits
26  * This is a TS C++ Library header.
27  */
28 
29 //
30 // N3932 Variable Templates For Type Traits (Revision 1)
31 //
32 
33 #ifndef _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS
34 #define _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS 1
35 
36 #pragma GCC system_header
37 
38 #if __cplusplus <= 201103L
39 # include <bits/c++14_warning.h>
40 #else
41 
42 #include <type_traits>
43 
44 
45 namespace std _GLIBCXX_VISIBILITY(default)
46 {
47 namespace experimental
48 {
49 inline namespace fundamentals_v1
50 {
51 _GLIBCXX_BEGIN_NAMESPACE_VERSION
52 
53 #define __cpp_lib_experimental_type_trait_variable_templates 201402
54 
55 // See C++14 §20.10.4.1, primary type categories
56 template <typename _Tp>
57  constexpr bool is_void_v = is_void<_Tp>::value;
58 template <typename _Tp>
59  constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
60 template <typename _Tp>
61  constexpr bool is_integral_v = is_integral<_Tp>::value;
62 template <typename _Tp>
63  constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
64 template <typename _Tp>
65  constexpr bool is_array_v = is_array<_Tp>::value;
66 template <typename _Tp>
67  constexpr bool is_pointer_v = is_pointer<_Tp>::value;
68 template <typename _Tp>
69  constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value;
70 template <typename _Tp>
71  constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value;
72 template <typename _Tp>
73  constexpr bool is_member_object_pointer_v =
74  is_member_object_pointer<_Tp>::value;
75 template <typename _Tp>
76  constexpr bool is_member_function_pointer_v =
77  is_member_function_pointer<_Tp>::value;
78 template <typename _Tp>
79  constexpr bool is_enum_v = is_enum<_Tp>::value;
80 template <typename _Tp>
81  constexpr bool is_union_v = is_union<_Tp>::value;
82 template <typename _Tp>
83  constexpr bool is_class_v = is_class<_Tp>::value;
84 template <typename _Tp>
85  constexpr bool is_function_v = is_function<_Tp>::value;
86 
87 // See C++14 §20.10.4.2, composite type categories
88 template <typename _Tp>
89  constexpr bool is_reference_v = is_reference<_Tp>::value;
90 template <typename _Tp>
91  constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
92 template <typename _Tp>
93  constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
94 template <typename _Tp>
95  constexpr bool is_object_v = is_object<_Tp>::value;
96 template <typename _Tp>
97  constexpr bool is_scalar_v = is_scalar<_Tp>::value;
98 template <typename _Tp>
99  constexpr bool is_compound_v = is_compound<_Tp>::value;
100 template <typename _Tp>
101  constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
102 
103 // See C++14 §20.10.4.3, type properties
104 template <typename _Tp>
105  constexpr bool is_const_v = is_const<_Tp>::value;
106 template <typename _Tp>
107  constexpr bool is_volatile_v = is_volatile<_Tp>::value;
108 template <typename _Tp>
109  constexpr bool is_trivial_v = is_trivial<_Tp>::value;
110 template <typename _Tp>
111  constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value;
112 template <typename _Tp>
113  constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
114 template <typename _Tp>
115  constexpr bool is_pod_v = is_pod<_Tp>::value;
116 template <typename _Tp>
117  constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
118 template <typename _Tp>
119  constexpr bool is_empty_v = is_empty<_Tp>::value;
120 template <typename _Tp>
121  constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value;
122 template <typename _Tp>
123  constexpr bool is_abstract_v = is_abstract<_Tp>::value;
124 template <typename _Tp>
125  constexpr bool is_final_v = is_final<_Tp>::value;
126 template <typename _Tp>
127  constexpr bool is_signed_v = is_signed<_Tp>::value;
128 template <typename _Tp>
129  constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;
130 template <typename _Tp, typename... _Args>
131  constexpr bool is_constructible_v = is_constructible<_Tp, _Args...>::value;
132 template <typename _Tp>
133  constexpr bool is_default_constructible_v =
134  is_default_constructible<_Tp>::value;
135 template <typename _Tp>
136  constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value;
137 template <typename _Tp>
138  constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value;
139 template <typename _Tp, typename _Up>
140  constexpr bool is_assignable_v = is_assignable<_Tp, _Up>::value;
141 template <typename _Tp>
142  constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value;
143 template <typename _Tp>
144  constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value;
145 template <typename _Tp>
146  constexpr bool is_destructible_v = is_destructible<_Tp>::value;
147 template <typename _Tp, typename... _Args>
148  constexpr bool is_trivially_constructible_v =
149  is_trivially_constructible<_Tp, _Args...>::value;
150 template <typename _Tp>
151  constexpr bool is_trivially_default_constructible_v =
152  is_trivially_default_constructible<_Tp>::value;
153 template <typename _Tp>
154  constexpr bool is_trivially_copy_constructible_v =
155  is_trivially_copy_constructible<_Tp>::value;
156 template <typename _Tp>
157  constexpr bool is_trivially_move_constructible_v =
158  is_trivially_move_constructible<_Tp>::value;
159 template <typename _Tp, typename _Up>
160  constexpr bool is_trivially_assignable_v =
161  is_trivially_assignable<_Tp, _Up>::value;
162 template <typename _Tp>
163  constexpr bool is_trivially_copy_assignable_v =
164  is_trivially_copy_assignable<_Tp>::value;
165 template <typename _Tp>
166  constexpr bool is_trivially_move_assignable_v =
167  is_trivially_move_assignable<_Tp>::value;
168 template <typename _Tp>
169  constexpr bool is_trivially_destructible_v =
170  is_trivially_destructible<_Tp>::value;
171 template <typename _Tp, typename... _Args>
172  constexpr bool is_nothrow_constructible_v =
173  is_nothrow_constructible<_Tp, _Args...>::value;
174 template <typename _Tp>
175  constexpr bool is_nothrow_default_constructible_v =
176  is_nothrow_default_constructible<_Tp>::value;
177 template <typename _Tp>
178  constexpr bool is_nothrow_copy_constructible_v =
179  is_nothrow_copy_constructible<_Tp>::value;
180 template <typename _Tp>
181  constexpr bool is_nothrow_move_constructible_v =
182  is_nothrow_move_constructible<_Tp>::value;
183 template <typename _Tp, typename _Up>
184  constexpr bool is_nothrow_assignable_v =
185  is_nothrow_assignable<_Tp, _Up>::value;
186 template <typename _Tp>
187  constexpr bool is_nothrow_copy_assignable_v =
188  is_nothrow_copy_assignable<_Tp>::value;
189 template <typename _Tp>
190  constexpr bool is_nothrow_move_assignable_v =
191  is_nothrow_move_assignable<_Tp>::value;
192 template <typename _Tp>
193  constexpr bool is_nothrow_destructible_v =
194  is_nothrow_destructible<_Tp>::value;
195 template <typename _Tp>
196  constexpr bool has_virtual_destructor_v =
197  has_virtual_destructor<_Tp>::value;
198 
199 // See C++14 §20.10.5, type property queries
200 template <typename _Tp>
201  constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
202 template <typename _Tp>
203  constexpr size_t rank_v = rank<_Tp>::value;
204 template <typename _Tp, unsigned _Idx = 0>
205  constexpr size_t extent_v = extent<_Tp, _Idx>::value;
206 
207 // See C++14 §20.10.6, type relations
208 template <typename _Tp, typename _Up>
209  constexpr bool is_same_v = is_same<_Tp, _Up>::value;
210 template <typename _Base, typename _Derived>
211  constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value;
212 template <typename _From, typename _To>
213  constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
214 
215 
216  // 3.3.2, Other type transformations
217  // invocation_type (still unimplemented)
218  // raw_invocation_type (still unimplemented)
219  // invocation_type_t (still unimplemented)
220  // raw_invocation_type_t (still unimplemented)
221 _GLIBCXX_END_NAMESPACE_VERSION
222 } // namespace fundamentals_v1
223 } // namespace experimental
224 } // namespace std
225 
226 #endif // __cplusplus <= 201103L
227 
228 #endif // _GLIBCXX_EXPERIMENTAL_TYPE_TRAITS