]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/ |
2 | Copyright 2007 John Maddock. | |
3 | Distributed under the Boost Software License, Version 1.0. | |
4 | (See accompanying file LICENSE_1_0.txt or copy at | |
5 | http://www.boost.org/LICENSE_1_0.txt). | |
6 | ] | |
7 | ||
8 | [section:value_traits Type Traits that Describe the Properties of a Type] | |
9 | ||
10 | These traits are all /value traits/, which is to say the traits classes all | |
11 | inherit from __integral_constant, and are used to access some numerical | |
12 | property of a type. Often this is a simple true or false Boolean value, | |
13 | but in a few cases may be some other integer value (for example when dealing | |
14 | with type alignments, or array bounds: see `__alignment_of`, `__rank` and `__extent`). | |
15 | ||
16 | [section:primary Categorizing a Type] | |
17 | ||
18 | These traits identify what "kind" of type some type `T` is. These are split into | |
19 | two groups: primary traits which are all mutually exclusive, and composite traits | |
20 | that are compositions of one or more primary traits. | |
21 | ||
22 | For any given type, exactly one primary type trait will inherit from | |
23 | __true_type, and all the others will inherit from __false_type, in other | |
24 | words these traits are mutually exclusive. | |
25 | ||
26 | This means that `__is_integral<T>::value` and `__is_floating_point<T>::value` | |
27 | will only ever be true for built-in types; if you want to check for a | |
28 | user-defined class type that behaves "as if" it is an integral or floating point type, | |
29 | then use the `std::numeric_limits template` instead. | |
30 | ||
31 | [*Synopsis:] | |
32 | ||
33 | template <class T> | |
34 | struct __is_array; | |
35 | ||
36 | template <class T> | |
37 | struct __is_class; | |
38 | ||
39 | template <class T> | |
40 | struct __is_complex; | |
41 | ||
42 | template <class T> | |
43 | struct __is_enum; | |
44 | ||
45 | template <class T> | |
46 | struct __is_floating_point; | |
47 | ||
48 | template <class T> | |
49 | struct __is_function; | |
50 | ||
51 | template <class T> | |
52 | struct __is_integral; | |
53 | ||
54 | template <class T> | |
55 | struct __is_member_function_pointer; | |
56 | ||
57 | template <class T> | |
58 | struct __is_member_object_pointer; | |
59 | ||
60 | template <class T> | |
61 | struct __is_pointer; | |
62 | ||
63 | template <class T> | |
64 | struct __is_lvalue_reference; | |
65 | ||
66 | template <class T> | |
67 | struct __is_rvalue_reference; | |
68 | ||
69 | template <class T> | |
70 | struct __is_union; | |
71 | ||
72 | template <class T> | |
73 | struct __is_void; | |
74 | ||
75 | The following traits are made up of the union of one or more type | |
76 | categorizations. A type may belong to more than one of these categories, | |
77 | in addition to one of the primary categories. | |
78 | ||
79 | template <class T> | |
80 | struct __is_arithmetic; | |
81 | ||
82 | template <class T> | |
83 | struct __is_compound; | |
84 | ||
85 | template <class T> | |
86 | struct __is_fundamental; | |
87 | ||
88 | template <class T> | |
89 | struct __is_member_pointer; | |
90 | ||
91 | template <class T> | |
92 | struct __is_object; | |
93 | ||
94 | template <class T> | |
95 | struct __is_reference; | |
96 | ||
97 | template <class T> | |
98 | struct __is_scalar; | |
99 | ||
100 | [endsect] | |
101 | ||
102 | [section:properties General Type Properties] | |
103 | ||
104 | The following templates describe the general properties of a type. | |
105 | ||
106 | [*Synopsis:] | |
107 | ||
108 | template <class T> | |
109 | struct __alignment_of; | |
110 | ||
111 | template <class T> | |
112 | struct __has_new_operator; | |
113 | ||
114 | template <class T> | |
115 | struct __has_nothrow_assign; | |
116 | ||
117 | template <class T> | |
118 | struct __has_nothrow_constructor; | |
119 | ||
120 | template <class T> | |
121 | struct __has_nothrow_default_constructor; | |
122 | ||
123 | template <class T> | |
124 | struct __has_nothrow_copy; | |
125 | ||
126 | template <class T> | |
127 | struct __has_nothrow_copy_constructor; | |
128 | ||
129 | template <class T> | |
130 | struct __has_nothrow_destructor; | |
131 | ||
132 | template <class T> | |
133 | struct __has_trivial_assign; | |
134 | ||
135 | template <class T> | |
136 | struct __has_trivial_constructor; | |
137 | ||
138 | template <class T> | |
139 | struct __has_trivial_default_constructor; | |
140 | ||
141 | template <class T> | |
142 | struct __has_trivial_copy; | |
143 | ||
144 | template <class T> | |
145 | struct __has_trivial_copy_constructor; | |
146 | ||
147 | template <class T> | |
148 | struct __has_trivial_destructor; | |
149 | ||
150 | template <class T> | |
151 | struct __has_virtual_destructor; | |
152 | ||
153 | template <class T> | |
154 | struct __is_abstract; | |
155 | ||
156 | template <class T, class U> | |
157 | struct __is_assignable; | |
158 | ||
159 | template <class T> | |
160 | struct __is_copy_constructible; | |
161 | ||
162 | template <class T> | |
163 | struct __is_copy_assignable; | |
164 | ||
165 | template <class T, class... Args> | |
166 | struct __is_constructible; | |
167 | ||
168 | template <class T> | |
169 | struct __is_default_constructible; | |
170 | ||
171 | template <class T> | |
172 | struct __is_destructible; | |
173 | ||
174 | template <class T> | |
175 | struct __is_const; | |
176 | ||
177 | template <class T> | |
178 | struct __is_empty; | |
179 | ||
180 | template <class T> | |
181 | struct __is_final; | |
182 | ||
183 | template <class T> | |
184 | struct __is_stateless; | |
185 | ||
186 | template <class T> | |
187 | struct __is_pod; | |
188 | ||
189 | template <class T> | |
190 | struct __is_polymorphic; | |
191 | ||
192 | template <class T> | |
193 | struct __is_signed; | |
194 | ||
195 | template <class T> | |
196 | struct __is_unsigned; | |
197 | ||
198 | template <class T> | |
199 | struct __is_volatile; | |
200 | ||
201 | template <class T, std::size_t N = 0> | |
202 | struct __extent; | |
203 | ||
204 | template <class T> | |
205 | struct __rank; | |
206 | ||
207 | [endsect] | |
208 | ||
209 | [section:relate Relationships Between Two Types] | |
210 | ||
211 | These templates determine the whether there is a relationship | |
212 | between two types: | |
213 | ||
214 | [*Synopsis:] | |
215 | ||
216 | template <class Base, class Derived> | |
217 | struct __is_base_of; | |
218 | ||
219 | template <class Base, class Derived> | |
220 | struct __is_virtual_base_of; | |
221 | ||
222 | template <class From, class To> | |
223 | struct __is_convertible; | |
224 | ||
225 | template <class T, class U> | |
226 | struct __is_same; | |
227 | ||
228 | [endsect] | |
229 | ||
230 | [include operators.qbk] | |
231 | ||
232 | [endsect] |