]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/auto_index/test/test1.gold
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / tools / auto_index / test / test1.gold
1 <?xml version="1.0"?>
2 <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3 <!--
4
5 This file is based upon the type traits docs, but has had additional XML elements added to it
6 to ensure complete testing.
7
8 -->
9
10 <chapter xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" id="boost_typetraits" rev:last-revision="$Date: 2008-11-28 12:41:45 +0000 (Fri, 28 Nov 2008) $">
11 <chapterinfo><author>
12 <firstname>various</firstname> <surname>authors</surname>
13 </author><copyright>
14 <year>2000</year> <year>2006</year> <holder>Adobe Systems Inc, David Abrahams,
15 Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat
16 Marcus, Itay Maman, John Maddock, Alexander Nasonov, Thorsten Ottosen, Robert
17 Ramey and Jeremy Siek</holder>
18 </copyright><legalnotice>
19 <para>
20 Distributed under the Boost Software License, Version 1.0. (See accompanying
21 file LICENSE_1_0.txt or copy at <ulink url="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</ulink>)
22 </para>
23 </legalnotice></chapterinfo>
24 <title>Boost.TypeTraits</title>
25 <para>
26 A printer-friendly <ulink url="http://svn.boost.org/svn/boost/sandbox/pdf/type_traits/release/type_traits.pdf">PDF
27 version of this manual is also available</ulink>.
28 </para>
29 <section id="boost_typetraits.intro"><indexterm type="test_index_1"><primary>type-traits</primary><secondary>Introduction</secondary></indexterm><indexterm><primary>Introduction</primary><secondary>type-traits</secondary></indexterm><indexterm type="test_index_1"><primary>type-traits</primary><secondary>Introduction</secondary></indexterm><indexterm><primary>Introduction</primary><secondary>type-traits</secondary></indexterm><indexterm type="test_index_1"><primary>type-traits</primary><secondary>Introduction</secondary></indexterm><indexterm><primary>Introduction</primary><secondary>type-traits</secondary></indexterm>
30 <title><link linkend="boost_typetraits.intro"> Introduction</link></title>
31 <para>
32 The Boost type-traits library contains a set of very specific traits classes,
33 each of which encapsulate a single trait from the C++ type system; for example,
34 is a type a pointer or a reference type? Or does a type have a trivial constructor,
35 or a const-qualifier?
36 </para>
37 <para>
38 The type-traits classes share a unified design: each class inherits from a
39 the type <link linkend="boost_typetraits.reference.integral_constant">true_type</link>
40 if the type has the specified property and inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>
41 otherwise.
42 </para>
43 <para>
44 The type-traits library also contains a set of classes that perform a specific
45 transformation on a type; for example, they can remove a top-level const or
46 volatile qualifier from a type. Each class that performs a transformation defines
47 a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
48 that is the result of the transformation.
49 </para>
50 </section>
51 <section id="boost_typetraits.background"><indexterm type="test_index_2"><primary>type-traits</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>type-traits</secondary></indexterm><indexterm type="test_index_2"><primary>type-traits</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>type-traits</secondary></indexterm><indexterm type="class_name"><primary>remove_extent</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>remove_extent</secondary></indexterm><indexterm type="class_name"><primary>is_pointer</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>is_pointer</secondary></indexterm><indexterm type="class_name"><primary>is_void</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>is_void</secondary></indexterm><indexterm type="test_index_2"><primary>type-traits</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>type-traits</secondary></indexterm><indexterm type="test_index_2"><primary>type-traits</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>type-traits</secondary></indexterm><indexterm type="test_index_2"><primary>type-traits</primary><secondary>Background and Tutorial</secondary></indexterm><indexterm><primary>Background and Tutorial</primary><secondary>type-traits</secondary></indexterm>
52 <title><link linkend="boost_typetraits.background"> Background and Tutorial</link></title>
53 <para>
54 The following is an updated version of the article "C++ Type traits"
55 by John Maddock and Steve Cleary that appeared in the October 2000 issue of
56 <ulink url="http://www.ddj.com">Dr Dobb's Journal</ulink>.
57 </para>
58 <para>
59 Generic programming (writing code which works with any data type meeting a
60 set of requirements) has become the method of choice for providing reusable
61 code. However, there are times in generic programming when "generic"
62 just isn't good enough - sometimes the differences between types are too large
63 for an efficient generic implementation. This is when the traits technique
64 becomes important - by encapsulating those properties that need to be considered
65 on a type by type basis inside a traits class, we can minimize the amount of
66 code that has to differ from one type to another, and maximize the amount of
67 generic code.
68 </para>
69 <?dbfo keep-together="auto" ?>
70 <para>
71 <indexterm>
72 <primary>Foo1</primary>
73 </indexterm>
74 Consider an example: when working with character strings, one common operation
75 is to determine the length of a null terminated string. Clearly it's possible
76 to write generic code that can do this, but it turns out that there are much
77 more efficient methods available: for example, the C library functions <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">strlen</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">wcslen</phrase></computeroutput>
78 are usually written in assembler, and with suitable hardware support can be
79 considerably faster than a generic version written in C++. The authors of the
80 C++ standard library realized this, and abstracted the properties of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">wchar_t</phrase></computeroutput>
81 into the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput>.
82 Generic code that works with character strings can simply use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase><phrase role="special">&lt;&gt;::</phrase><phrase role="identifier">length</phrase></computeroutput> to determine the length of a null
83 terminated string, safe in the knowledge that specializations of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput> will use the most appropriate
84 method available to them.
85 </para>
86 <anchor id="boost_typetraits.background.type_traits"/>
87 <bridgehead renderas="sect4">
88 <link linkend="boost_typetraits.background.type_traits">Type Traits</link>
89 </bridgehead>
90 <para>
91 Class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">char_traits</phrase></computeroutput> is a classic
92 example of a collection of type specific properties wrapped up in a single
93 class - what Nathan Myers termed a <emphasis>baggage class</emphasis><link linkend="background.references">[1]</link>. In the Boost type-traits library,
94 we<link linkend="background.references">[2]</link> have written a set of very
95 specific traits classes, each of which encapsulate a single trait from the
96 C++ type system; for example, is a type a pointer or a reference type? Or does
97 a type have a trivial constructor, or a const-qualifier? The type-traits classes
98 share a unified design: each class inherits from a the type <link linkend="boost_typetraits.reference.integral_constant">true_type</link>
99 if the type has the specified property and inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>
100 otherwise. As we will show, these classes can be used in generic programming
101 to determine the properties of a given type and introduce optimizations that
102 are appropriate for that case.
103 </para>
104 <para>
105 The type-traits library also contains a set of classes that perform a specific
106 transformation on a type; for example, they can remove a top-level const or
107 volatile qualifier from a type. Each class that performs a transformation defines
108 a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
109 that is the result of the transformation. All of the type-traits classes are
110 defined inside namespace <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase></computeroutput>;
111 for brevity, namespace-qualification is omitted in most of the code samples
112 given.
113 </para>
114 <anchor id="boost_typetraits.background.implementation"/>
115 <bridgehead renderas="sect4">
116 <link linkend="boost_typetraits.background.implementation">Implementation</link>
117 </bridgehead>
118 <para>
119 There are far too many separate classes contained in the type-traits library
120 to give a full implementation here - see the source code in the Boost library
121 for the full details - however, most of the implementation is fairly repetitive
122 anyway, so here we will just give you a flavor for how some of the classes
123 are implemented. Beginning with possibly the simplest class in the library,
124 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase></computeroutput> inherits
125 from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>
126 only if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>.
127 </para>
128
129 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
130 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase>
131
132 <phrase role="keyword">template</phrase> <phrase role="special">&lt;&gt;</phrase>
133 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link><phrase role="special">&lt;</phrase><phrase role="keyword">void</phrase><phrase role="special">&gt;</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase>
134 </programlisting>
135 <para>
136 Here we define a primary version of the template class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_void">is_void</link></computeroutput>,
137 and provide a full-specialization when <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
138 is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>. While full specialization
139 of a template class is an important technique, sometimes we need a solution
140 that is halfway between a fully generic solution, and a full specialization.
141 This is exactly the situation for which the standards committee defined partial
142 template-class specialization. As an example, consider the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase></computeroutput>:
143 here we needed a primary version that handles all the cases where T is not
144 a pointer, and a partial specialization to handle all the cases where T is
145 a pointer:
146 </para>
147
148 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
149 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase>
150
151 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
152 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">*&gt;</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase>
153 </programlisting>
154 <para>
155 The syntax for partial specialization is somewhat arcane and could easily occupy
156 an article in its own right; like full specialization, in order to write a
157 partial specialization for a class, you must first declare the primary template.
158 The partial specialization contains an extra &lt;...&gt; after the class name
159 that contains the partial specialization parameters; these define the types
160 that will bind to that partial specialization rather than the default template.
161 The rules for what can appear in a partial specialization are somewhat convoluted,
162 but as a rule of thumb if you can legally write two function overloads of the
163 form:
164 </para>
165
166 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase> <phrase role="identifier">foo</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">);</phrase>
167 <phrase role="keyword">void</phrase> <phrase role="identifier">foo</phrase><phrase role="special">(</phrase><phrase role="identifier">U</phrase><phrase role="special">);</phrase>
168 </programlisting>
169 <para>
170 Then you can also write a partial specialization of the form:
171 </para>
172
173 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
174 <phrase role="keyword">class</phrase> <phrase role="identifier">c</phrase><phrase role="special">{</phrase> <phrase role="comment">/*details*/</phrase> <phrase role="special">};</phrase>
175
176 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
177 <phrase role="keyword">class</phrase> <phrase role="identifier">c</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">U</phrase><phrase role="special">&gt;{</phrase> <phrase role="comment">/*details*/</phrase> <phrase role="special">};</phrase>
178 </programlisting>
179 <para>
180 This rule is by no means foolproof, but it is reasonably simple to remember
181 and close enough to the actual rule to be useful for everyday use.
182 </para>
183 <para>
184 As a more complex example of partial specialization consider the class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase></computeroutput>. This
185 class defines a single typedef-member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
186 that is the same type as T but with any top-level array bounds removed; this
187 is an example of a traits class that performs a transformation on a type:
188 </para>
189
190 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
191 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link>
192 <phrase role="special">{</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase>
193
194 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase><phrase role="special">&gt;</phrase>
195 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">[</phrase><phrase role="identifier">N</phrase><phrase role="special">]&gt;</phrase>
196 <phrase role="special">{</phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase>
197 </programlisting>
198 <para>
199 The aim of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.remove_extent">remove_extent</link></computeroutput>
200 is this: imagine a generic algorithm that is passed an array type as a template
201 parameter, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.remove_extent">remove_extent</link></computeroutput>
202 provides a means of determining the underlying type of the array. For example
203 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">][</phrase><phrase role="number">5</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> would evaluate to the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">5</phrase><phrase role="special">]</phrase></computeroutput>. This example also shows that the number of
204 template parameters in a partial specialization does not have to match the
205 number in the default template. However, the number of parameters that appear
206 after the class name do have to match the number and type of the parameters
207 in the default template.
208 </para>
209 <anchor id="boost_typetraits.background.optimized_copy"/>
210 <bridgehead renderas="sect4">
211 <link linkend="boost_typetraits.background.optimized_copy">Optimized copy</link>
212 </bridgehead>
213 <para>
214 As an example of how the type traits classes can be used, consider the standard
215 library algorithm copy:
216 </para>
217
218 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">Iter1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">Iter2</phrase><phrase role="special">&gt;</phrase>
219 <phrase role="identifier">Iter2</phrase> <phrase role="identifier">copy</phrase><phrase role="special">(</phrase><phrase role="identifier">Iter1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">Iter1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">Iter2</phrase> <phrase role="identifier">out</phrase><phrase role="special">);</phrase>
220 </programlisting>
221 <para>
222 Obviously, there's no problem writing a generic version of copy that works
223 for all iterator types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput>
224 and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput>; however, there are
225 some circumstances when the copy operation can best be performed by a call
226 to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>. In order to implement
227 copy in terms of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> all
228 of the following conditions need to be met:
229 </para>
230 <itemizedlist>
231 <listitem>
232 Both of the iterator types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput>
233 and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput> must be pointers.
234 </listitem>
235 <listitem>
236 Both <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter2</phrase></computeroutput> must point to the same type - excluding
237 const and volatile-qualifiers.
238 </listitem>
239 <listitem>
240 The type pointed to by <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Iter1</phrase></computeroutput>
241 must have a trivial assignment operator.
242 </listitem>
243 </itemizedlist>
244 <para>
245 By trivial assignment operator we mean that the type is either a scalar type<link linkend="background.references">[3]</link> or:
246 </para>
247 <itemizedlist>
248 <listitem>
249 The type has no user defined assignment operator.
250 </listitem>
251 <listitem>
252 The type does not have any data members that are references.
253 </listitem>
254 <listitem>
255 All base classes, and all data member objects must have trivial assignment
256 operators.
257 </listitem>
258 </itemizedlist>
259 <para>
260 If all these conditions are met then a type can be copied using <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput> rather than using a compiler generated
261 assignment operator. The type-traits library provides a class <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput>,
262 such that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is true only if T has a trivial assignment
263 operator. This class "just works" for scalar types, but has to be
264 explicitly specialised for class/struct types that also happen to have a trivial
265 assignment operator. In other words if <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link>
266 gives the wrong answer, it will give the "safe" wrong answer - that
267 trivial assignment is not allowable.
268 </para>
269 <para>
270 The code for an optimized version of copy that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>
271 where appropriate is given in <link linkend="boost_typetraits.examples.copy">the
272 examples</link>. The code begins by defining a template function <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">do_copy</phrase></computeroutput> that performs a "slow but safe"
273 copy. The last parameter passed to this function may be either a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>
274 or a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">false_type</link></computeroutput>.
275 Following that there is an overload of do<emphasis role="underline">copy that
276 uses `memcpy`: this time the iterators are required to actually be pointers
277 to the same type, and the final parameter must be a `</emphasis>_true_type<computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">.</phrase> <phrase role="identifier">Finally</phrase><phrase role="special">,</phrase> <phrase role="identifier">the</phrase> <phrase role="identifier">version</phrase>
278 <phrase role="identifier">of</phrase> </computeroutput>copy<computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="identifier">calls</phrase>
279 </computeroutput>do<emphasis role="underline">copy`, passing `</emphasis>_has_trivial_assign&lt;value_type&gt;()`
280 as the final parameter: this will dispatch to the optimized version where appropriate,
281 otherwise it will call the "slow but safe version".
282 </para>
283 <anchor id="boost_typetraits.background.was_it_worth_it_"/>
284 <bridgehead renderas="sect4">
285 <link linkend="boost_typetraits.background.was_it_worth_it_">Was it worth it?</link>
286 </bridgehead>
287 <para>
288 It has often been repeated in these columns that "premature optimization
289 is the root of all evil" <link linkend="background.references">[4]</link>.
290 So the question must be asked: was our optimization premature? To put this
291 in perspective the timings for our version of copy compared a conventional
292 generic copy<link linkend="background.references">[5]</link> are shown in table
293 1.
294 </para>
295 <para>
296 Clearly the optimization makes a difference in this case; but, to be fair,
297 the timings are loaded to exclude cache miss effects - without this accurate
298 comparison between algorithms becomes difficult. However, perhaps we can add
299 a couple of caveats to the premature optimization rule:
300 </para>
301 <itemizedlist>
302 <listitem>
303 If you use the right algorithm for the job in the first place then optimization
304 will not be required; in some cases, memcpy is the right algorithm.
305 </listitem>
306 <listitem>
307 If a component is going to be reused in many places by many people then optimizations
308 may well be worthwhile where they would not be so for a single case - in
309 other words, the likelihood that the optimization will be absolutely necessary
310 somewhere, sometime is that much higher. Just as importantly the perceived
311 value of the stock implementation will be higher: there is no point standardizing
312 an algorithm if users reject it on the grounds that there are better, more
313 heavily optimized versions available.
314 </listitem>
315 </itemizedlist>
316 <table frame="all"> <title>Time taken to copy 1000 elements using `copy&lt;const
317 T*, T*&gt;` (times in micro-seconds)</title>
318 <tgroup cols="3">
319 <thead>
320 <row>
321 <entry>
322 <para>
323 Version
324 </para>
325 </entry><entry>
326 <para>
327 T
328 </para>
329 </entry><entry>
330 <para>
331 Time
332 </para>
333 </entry>
334 </row>
335 </thead>
336 <tbody>
337 <row>
338 <entry>
339 <para>
340 "Optimized" copy
341 </para>
342 </entry><entry>
343 <para>
344 char
345 </para>
346 </entry><entry>
347 <para>
348 0.99
349 </para>
350 </entry>
351 </row>
352 <row>
353 <entry>
354 <para>
355 Conventional copy
356 </para>
357 </entry><entry>
358 <para>
359 char
360 </para>
361 </entry><entry>
362 <para>
363 8.07
364 </para>
365 </entry>
366 </row>
367 <row>
368 <entry>
369 <para>
370 "Optimized" copy
371 </para>
372 </entry><entry>
373 <para>
374 int
375 </para>
376 </entry><entry>
377 <para>
378 2.52
379 </para>
380 </entry>
381 </row>
382 <row>
383 <entry>
384 <para>
385 Conventional copy
386 </para>
387 </entry><entry>
388 <para>
389 int
390 </para>
391 </entry><entry>
392 <para>
393 8.02
394 </para>
395 </entry>
396 </row>
397 </tbody>
398 </tgroup>
399 </table> <anchor id="boost_typetraits.background.pair_of_references"/>
400 <bridgehead renderas="sect4">
401 <link linkend="boost_typetraits.background.pair_of_references">Pair of References</link>
402 </bridgehead>
403 <para>
404 The optimized copy example shows how type traits may be used to perform optimization
405 decisions at compile-time. Another important usage of type traits is to allow
406 code to compile that otherwise would not do so unless excessive partial specialization
407 is used. This is possible by delegating partial specialization to the type
408 traits classes. Our example for this form of usage is a pair that can hold
409 references <link linkend="background.references">[6]</link>.
410 </para>
411 <para>
412 First, let us examine the definition of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">pair</phrase></computeroutput>, omitting
413 the comparison operators, default constructor, and template copy constructor
414 for simplicity:
415 </para>
416
417 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">&gt;</phrase>
418 <phrase role="keyword">struct</phrase> <phrase role="identifier">pair</phrase>
419 <phrase role="special">{</phrase>
420 <phrase role="keyword">typedef</phrase> <phrase role="identifier">T1</phrase> <phrase role="identifier">first_type</phrase><phrase role="special">;</phrase>
421 <phrase role="keyword">typedef</phrase> <phrase role="identifier">T2</phrase> <phrase role="identifier">second_type</phrase><phrase role="special">;</phrase>
422
423 <phrase role="identifier">T1</phrase> <phrase role="identifier">first</phrase><phrase role="special">;</phrase>
424 <phrase role="identifier">T2</phrase> <phrase role="identifier">second</phrase><phrase role="special">;</phrase>
425
426 <phrase role="identifier">pair</phrase><phrase role="special">(</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">&amp;</phrase> <phrase role="identifier">nfirst</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">&amp;</phrase> <phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase>
427 <phrase role="special">:</phrase><phrase role="identifier">first</phrase><phrase role="special">(</phrase><phrase role="identifier">nfirst</phrase><phrase role="special">),</phrase> <phrase role="identifier">second</phrase><phrase role="special">(</phrase><phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase> <phrase role="special">}</phrase>
428 <phrase role="special">};</phrase>
429 </programlisting>
430 <para>
431 Now, this "pair" cannot hold references as it currently stands, because
432 the constructor would require taking a reference to a reference, which is currently
433 illegal <link linkend="background.references">[7]</link>. Let us consider what
434 the constructor's parameters would have to be in order to allow "pair"
435 to hold non-reference types, references, and constant references:
436 </para>
437 <table frame="all"> <title>Required Constructor Argument Types</title>
438 <tgroup cols="2">
439 <thead>
440 <row>
441 <entry>
442 <para>
443 Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T1</phrase></computeroutput>
444 </para>
445 </entry><entry>
446 <para>
447 Type of parameter to initializing constructor
448 </para>
449 </entry>
450 </row>
451 </thead>
452 <tbody>
453 <row>
454 <entry>
455 <para>
456 T
457 </para>
458 </entry><entry>
459 <para>
460 const T &amp;
461 </para>
462 </entry>
463 </row>
464 <row>
465 <entry>
466 <para>
467 T &amp;
468 </para>
469 </entry><entry>
470 <para>
471 T &amp;
472 </para>
473 </entry>
474 </row>
475 <row>
476 <entry>
477 <para>
478 const T &amp;
479 </para>
480 </entry><entry>
481 <para>
482 const T &amp;
483 </para>
484 </entry>
485 </row>
486 </tbody>
487 </tgroup>
488 </table>
489 <para>
490 A little familiarity with the type traits classes allows us to construct a
491 single mapping that allows us to determine the type of parameter from the type
492 of the contained class. The type traits classes provide a transformation <link linkend="boost_typetraits.reference.add_reference">add_reference</link>, which
493 adds a reference to its type, unless it is already a reference.
494 </para>
495 <table frame="all"> <title>Using add_reference to synthesize the correct constructor
496 type</title>
497 <tgroup cols="3">
498 <thead>
499 <row>
500 <entry>
501 <para>
502 Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T1</phrase></computeroutput>
503 </para>
504 </entry><entry>
505 <para>
506 Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase></computeroutput>
507 </para>
508 </entry><entry>
509 <para>
510 Type of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
511 </para>
512 </entry>
513 </row>
514 </thead>
515 <tbody>
516 <row>
517 <entry>
518 <para>
519 T
520 </para>
521 </entry><entry>
522 <para>
523 const T
524 </para>
525 </entry><entry>
526 <para>
527 const T &amp;
528 </para>
529 </entry>
530 </row>
531 <row>
532 <entry>
533 <para>
534 T &amp;
535 </para>
536 </entry><entry>
537 <para>
538 T &amp; [8]
539 </para>
540 </entry><entry>
541 <para>
542 T &amp;
543 </para>
544 </entry>
545 </row>
546 <row>
547 <entry>
548 <para>
549 const T &amp;
550 </para>
551 </entry><entry>
552 <para>
553 const T &amp;
554 </para>
555 </entry><entry>
556 <para>
557 const T &amp;
558 </para>
559 </entry>
560 </row>
561 </tbody>
562 </tgroup>
563 </table>
564 <para>
565 This allows us to build a primary template definition for <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput>
566 that can contain non-reference types, reference types, and constant reference
567 types:
568 </para>
569
570 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">&gt;</phrase>
571 <phrase role="keyword">struct</phrase> <phrase role="identifier">pair</phrase>
572 <phrase role="special">{</phrase>
573 <phrase role="keyword">typedef</phrase> <phrase role="identifier">T1</phrase> <phrase role="identifier">first_type</phrase><phrase role="special">;</phrase>
574 <phrase role="keyword">typedef</phrase> <phrase role="identifier">T2</phrase> <phrase role="identifier">second_type</phrase><phrase role="special">;</phrase>
575
576 <phrase role="identifier">T1</phrase> <phrase role="identifier">first</phrase><phrase role="special">;</phrase>
577 <phrase role="identifier">T2</phrase> <phrase role="identifier">second</phrase><phrase role="special">;</phrase>
578
579 <phrase role="identifier">pair</phrase><phrase role="special">(</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special">&lt;</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T1</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">nfirst</phrase><phrase role="special">,</phrase>
580 <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special">&lt;</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T2</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase>
581 <phrase role="special">:</phrase><phrase role="identifier">first</phrase><phrase role="special">(</phrase><phrase role="identifier">nfirst</phrase><phrase role="special">),</phrase> <phrase role="identifier">second</phrase><phrase role="special">(</phrase><phrase role="identifier">nsecond</phrase><phrase role="special">)</phrase> <phrase role="special">{</phrase> <phrase role="special">}</phrase>
582 <phrase role="special">};</phrase>
583 </programlisting>
584 <para>
585 Add back in the standard comparison operators, default constructor, and template
586 copy constructor (which are all the same), and you have a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">pair</phrase></computeroutput> that
587 can hold reference types!
588 </para>
589 <para>
590 This same extension could have been done using partial template specialization
591 of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput>, but to specialize
592 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">pair</phrase></computeroutput> in this way would require
593 three partial specializations, plus the primary template. Type traits allows
594 us to define a single primary template that adjusts itself auto-magically to
595 any of these partial specializations, instead of a brute-force partial specialization
596 approach. Using type traits in this fashion allows programmers to delegate
597 partial specialization to the type traits classes, resulting in code that is
598 easier to maintain and easier to understand.
599 </para>
600 <anchor id="boost_typetraits.background.conclusion"/>
601 <bridgehead renderas="sect4">
602 <link linkend="boost_typetraits.background.conclusion">Conclusion</link>
603 </bridgehead>
604 <para>
605 We hope that in this article we have been able to give you some idea of what
606 type-traits are all about. A more complete listing of the available classes
607 are in the boost documentation, along with further examples using type traits.
608 Templates have enabled C++ uses to take the advantage of the code reuse that
609 generic programming brings; hopefully this article has shown that generic programming
610 does not have to sink to the lowest common denominator, and that templates
611 can be optimal as well as generic.
612 </para>
613 <anchor id="boost_typetraits.background.acknowledgements"/>
614 <bridgehead renderas="sect4">
615 <link linkend="boost_typetraits.background.acknowledgements">Acknowledgements</link>
616 </bridgehead>
617 <para>
618 The authors would like to thank Beman Dawes and Howard Hinnant for their helpful
619 comments when preparing this article.
620 </para>
621 <anchor id="background.references"/> <anchor id="boost_typetraits.background.references"/>
622 <bridgehead renderas="sect4">
623 <link linkend="boost_typetraits.background.references">References</link>
624 </bridgehead>
625 <orderedlist inheritnum="ignore" continuation="restarts">
626 <listitem>
627 Nathan C. Myers, C++ Report, June 1995.
628 </listitem>
629 <listitem>
630 The type traits library is based upon contributions by Steve Cleary, Beman
631 Dawes, Howard Hinnant and John Maddock: it can be found at www.boost.org.
632 </listitem>
633 <listitem>
634 A scalar type is an arithmetic type (i.e. a built-in integer or floating
635 point type), an enumeration type, a pointer, a pointer to member, or a const-
636 or volatile-qualified version of one of these types.
637 </listitem>
638 <listitem>
639 This quote is from Donald Knuth, ACM Computing Surveys, December 1974, pg
640 268.
641 </listitem>
642 <listitem>
643 The test code is available as part of the boost utility library (see algo_opt_examples.cpp),
644 the code was compiled with gcc 2.95 with all optimisations turned on, tests
645 were conducted on a 400MHz Pentium II machine running Microsoft Windows 98.
646 </listitem>
647 <listitem>
648 John Maddock and Howard Hinnant have submitted a "compressed_pair"
649 library to Boost, which uses a technique similar to the one described here
650 to hold references. Their pair also uses type traits to determine if any
651 of the types are empty, and will derive instead of contain to conserve space
652 -- hence the name "compressed".
653 </listitem>
654 <listitem>
655 This is actually an issue with the C++ Core Language Working Group (issue
656 #106), submitted by Bjarne Stroustrup. The tentative resolution is to allow
657 a "reference to a reference to T" to mean the same thing as a "reference
658 to T", but only in template instantiation, in a method similar to multiple
659 cv-qualifiers.
660 </listitem>
661 <listitem>
662 For those of you who are wondering why this shouldn't be const-qualified,
663 remember that references are always implicitly constant (for example, you
664 can't re-assign a reference). Remember also that "const T &amp;"
665 is something completely different. For this reason, cv-qualifiers on template
666 type arguments that are references are ignored.
667 </listitem>
668 </orderedlist>
669 </section>
670 <section id="boost_typetraits.category">
671 <title><link linkend="boost_typetraits.category"> Type Traits by Category</link></title>
672 <section id="boost_typetraits.category.value_traits">
673 <title><link linkend="boost_typetraits.category.value_traits"> Type Traits
674 that Describe the Properties of a Type</link></title>
675 <para>
676 <indexterm>
677 <primary>Foo2</primary>
678 <secondary>Bar2</secondary>
679 </indexterm>
680 These traits are all <emphasis>value traits</emphasis>, which is to say the
681 traits classes all inherit from <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link>,
682 and are used to access some numerical property of a type. Often this is a
683 simple true or false Boolean value, but in a few cases may be some other
684 integer value (for example when dealing with type alignments, or array bounds:
685 see <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.alignment_of">alignment_of</link></computeroutput>,
686 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.rank">rank</link></computeroutput>
687 and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.extent">extent</link></computeroutput>).
688 </para>
689 <section id="boost_typetraits.category.value_traits.primary">
690 <title><link linkend="boost_typetraits.category.value_traits.primary"> Categorizing
691 a Type</link></title>
692 <para>
693 These traits identify what "kind" of type some type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is. These are split into two groups:
694 primary traits which are all mutually exclusive, and composite traits that
695 are compositions of one or more primary traits.
696 </para>
697 <para>
698 For any given type, exactly one primary type trait will inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
699 and all the others will inherit from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>,
700 in other words these traits are mutually exclusive.
701 </para>
702 <para>
703 This means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_integral">is_integral</link><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
704 and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
705 will only ever be true for built-in types; if you want to check for a user-defined
706 class type that behaves "as if" it is an integral or floating
707 point type, then use the <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">numeric_limits</phrase>
708 <phrase role="keyword">template</phrase></computeroutput> instead.
709 </para>
710 <para>
711 <emphasis role="bold">Synopsis:</emphasis>
712 </para>
713
714 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
715 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_array">is_array</link><phrase role="special">;</phrase>
716
717 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
718 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_class">is_class</link><phrase role="special">;</phrase>
719
720 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
721 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_complex">is_complex</link><phrase role="special">;</phrase>
722
723 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
724 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_enum">is_enum</link><phrase role="special">;</phrase>
725
726 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
727 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link><phrase role="special">;</phrase>
728
729 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
730 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_function">is_function</link><phrase role="special">;</phrase>
731
732 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
733 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_integral">is_integral</link><phrase role="special">;</phrase>
734
735 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
736 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link><phrase role="special">;</phrase>
737
738 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
739 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_object_pointer">is_member_object_pointer</link><phrase role="special">;</phrase>
740
741 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
742 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special">;</phrase>
743
744 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
745 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special">;</phrase>
746
747 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
748 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_union">is_union</link><phrase role="special">;</phrase>
749
750 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
751 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_void">is_void</link><phrase role="special">;</phrase>
752 </programlisting>
753 <para>
754 The following traits are made up of the union of one or more type categorizations.
755 A type may belong to more than one of these categories, in addition to
756 one of the primary categories.
757 </para>
758
759 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
760 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_arithmetic">is_arithmetic</link><phrase role="special">;</phrase>
761
762 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
763 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_compound">is_compound</link><phrase role="special">;</phrase>
764
765 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
766 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_fundamental">is_fundamental</link><phrase role="special">;</phrase>
767
768 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
769 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link><phrase role="special">;</phrase>
770
771 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
772 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_object">is_object</link><phrase role="special">;</phrase>
773
774 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
775 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_scalar">is_scalar</link><phrase role="special">;</phrase>
776 </programlisting>
777 </section>
778 <section id="boost_typetraits.category.value_traits.properties">
779 <title><link linkend="boost_typetraits.category.value_traits.properties">
780 General Type Properties</link></title>
781 <para>
782 The following templates describe the general properties of a type.
783 </para>
784 <para>
785 <emphasis role="bold">Synopsis:</emphasis>
786 </para>
787
788 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
789 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.alignment_of">alignment_of</link><phrase role="special">;</phrase>
790
791 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
792 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_assign">has_nothrow_assign</link><phrase role="special">;</phrase>
793
794 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
795 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link><phrase role="special">;</phrase>
796
797 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
798 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_default_constructor</link><phrase role="special">;</phrase>
799
800 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
801 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link><phrase role="special">;</phrase>
802
803 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
804 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy_constructor</link><phrase role="special">;</phrase>
805
806 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
807 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special">;</phrase>
808
809 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
810 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link><phrase role="special">;</phrase>
811
812 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
813 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_default_constructor</link><phrase role="special">;</phrase>
814
815 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
816 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link><phrase role="special">;</phrase>
817
818 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
819 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy_constructor</link><phrase role="special">;</phrase>
820
821 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
822 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link><phrase role="special">;</phrase>
823
824 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
825 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.has_virtual_destructor">has_virtual_destructor</link><phrase role="special">;</phrase>
826
827 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
828 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_abstract">is_abstract</link><phrase role="special">;</phrase>
829
830 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
831 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_const">is_const</link><phrase role="special">;</phrase>
832
833 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
834 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_empty">is_empty</link><phrase role="special">;</phrase>
835
836 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
837 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_stateless">is_stateless</link><phrase role="special">;</phrase>
838
839 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
840 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special">;</phrase>
841
842 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
843 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link><phrase role="special">;</phrase>
844
845 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
846 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_signed">is_signed</link><phrase role="special">;</phrase>
847
848 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
849 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_unsigned">is_unsigned</link><phrase role="special">;</phrase>
850
851 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
852 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_volatile">is_volatile</link><phrase role="special">;</phrase>
853
854 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">&gt;</phrase>
855 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.extent">extent</link><phrase role="special">;</phrase>
856
857 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
858 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.rank">rank</link><phrase role="special">;</phrase>
859 </programlisting>
860 </section>
861 <section id="boost_typetraits.category.value_traits.relate">
862 <title><link linkend="boost_typetraits.category.value_traits.relate"> Relationships
863 Between Two Types</link></title>
864 <para>
865 These templates determine the whether there is a relationship between two
866 types:
867 </para>
868 <para>
869 <emphasis role="bold">Synopsis:</emphasis>
870 </para>
871
872 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">&gt;</phrase>
873 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_base_of">is_base_of</link><phrase role="special">;</phrase>
874
875 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">To</phrase><phrase role="special">&gt;</phrase>
876 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link><phrase role="special">;</phrase>
877
878 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">U</phrase><phrase role="special">&gt;</phrase>
879 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_same">is_same</link><phrase role="special">;</phrase>
880 </programlisting>
881 </section>
882 </section>
883 <section id="boost_typetraits.category.transform"><indexterm type="macro_name"><primary>BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</primary><secondary>Type Traits that Transform One Type to Another</secondary></indexterm><indexterm><primary>Type Traits that Transform One Type to Another</primary><secondary>BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</primary><secondary>Type Traits that Transform One Type to Another</secondary></indexterm><indexterm><primary>Type Traits that Transform One Type to Another</primary><secondary>BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</secondary></indexterm>
884 <title><link linkend="boost_typetraits.category.transform"> Type Traits that
885 Transform One Type to Another</link></title>
886 <para>
887 The following templates transform one type to another, based upon some well-defined
888 rule. Each template has a single member called <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
889 that is the result of applying the transformation to the template argument
890 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>.
891 </para>
892 <para>
893 <emphasis role="bold">Synopsis:</emphasis>
894 </para>
895
896 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
897 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_const">add_const</link><phrase role="special">;</phrase>
898
899 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
900 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_cv">add_cv</link><phrase role="special">;</phrase>
901
902 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
903 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_pointer">add_pointer</link><phrase role="special">;</phrase>
904
905 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
906 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_reference">add_reference</link><phrase role="special">;</phrase>
907
908 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
909 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.add_volatile">add_volatile</link><phrase role="special">;</phrase>
910
911 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
912 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.decay">decay</link><phrase role="special">;</phrase>
913
914 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
915 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.floating_point_promotion">floating_point_promotion</link><phrase role="special">;</phrase>
916
917 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
918 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.integral_promotion">integral_promotion</link><phrase role="special">;</phrase>
919
920 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
921 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.make_signed">make_signed</link><phrase role="special">;</phrase>
922
923 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
924 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.make_unsigned">make_unsigned</link><phrase role="special">;</phrase>
925
926 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
927 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.promote">promote</link><phrase role="special">;</phrase>
928
929 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
930 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_all_extents">remove_all_extents</link><phrase role="special">;</phrase>
931
932 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
933 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_const">remove_const</link><phrase role="special">;</phrase>
934
935 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
936 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_cv">remove_cv</link><phrase role="special">;</phrase>
937
938 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
939 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_extent">remove_extent</link><phrase role="special">;</phrase>
940
941 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
942 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link><phrase role="special">;</phrase>
943
944 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
945 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_reference">remove_reference</link><phrase role="special">;</phrase>
946
947 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
948 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.remove_volatile">remove_volatile</link><phrase role="special">;</phrase>
949 </programlisting>
950 <anchor id="boost_typetraits.category.transform.broken_compiler_workarounds_"/>
951 <bridgehead renderas="sect4">
952 <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">Broken
953 Compiler Workarounds:</link>
954 </bridgehead>
955 <para>
956 For all of these templates support for partial specialization of class templates
957 is required to correctly implement the transformation. On the other hand,
958 practice shows that many of the templates from this category are very useful,
959 and often essential for implementing some generic libraries. Lack of these
960 templates is often one of the major limiting factors in porting those libraries
961 to compilers that do not yet support this language feature. As some of these
962 compilers are going to be around for a while, and at least one of them is
963 very wide-spread, it was decided that the library should provide workarounds
964 where possible.
965 </para>
966 <para>
967 The basic idea behind the workaround is to manually define full specializations
968 of all type transformation templates for all fundamental types, and all their
969 1st and 2nd rank cv-[un]qualified derivative pointer types, and to provide
970 a user-level macro that will define all the explicit specializations needed
971 for any user-defined type T.
972 </para>
973 <para>
974 The first part guarantees the successful compilation of something like this:
975 </para>
976
977 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase>
978 <phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase>
979 <phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase>
980 <phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase>
981 <phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">*,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">*&amp;&gt;::</phrase><phrase role="identifier">type</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase>
982 <phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">*,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase><phrase role="special">*&amp;&gt;::</phrase><phrase role="identifier">type</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase>
983 <phrase role="special">...</phrase>
984 <phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase>
985 </programlisting>
986 <para>
987 and the second part provides the library's users with a mechanism to make
988 the above code work not only for <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>,
989 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput> or other built-in type,
990 but for their own types as well:
991 </para>
992
993 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">namespace</phrase> <phrase role="identifier">myspace</phrase><phrase role="special">{</phrase>
994 <phrase role="keyword">struct</phrase> <phrase role="identifier">MyClass</phrase> <phrase role="special">{};</phrase>
995 <phrase role="special">}</phrase>
996 <phrase role="comment">// declare this at global scope:
997 </phrase><phrase role="identifier">BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION</phrase><phrase role="special">(</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">)</phrase>
998 <phrase role="comment">// transformations on myspace::MyClass now work:
999 </phrase><phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase>
1000 <phrase role="identifier">BOOST_STATIC_ASSERT</phrase><phrase role="special">((</phrase><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">,</phrase> <phrase role="identifier">remove_const</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">myspace</phrase><phrase role="special">::</phrase><phrase role="identifier">MyClass</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase><phrase role="special">));</phrase>
1001 <phrase role="comment">// etc.
1002 </phrase></programlisting>
1003 <para>
1004 Note that the macro BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION evaluates
1005 to nothing on those compilers that <emphasis role="bold">do</emphasis> support
1006 partial specialization.
1007 </para>
1008 </section>
1009 <section id="boost_typetraits.category.alignment">
1010 <title><link linkend="boost_typetraits.category.alignment"> Synthesizing Types
1011 with Specific Alignments</link></title>
1012 <para>
1013 Some low level memory management routines need to synthesize a POD type with
1014 specific alignment properties. The template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.type_with_alignment">type_with_alignment</link></computeroutput>
1015 finds the smallest type with a specified alignment, while template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.aligned_storage">aligned_storage</link></computeroutput>
1016 creates a type with a specific size and alignment.
1017 </para>
1018 <para>
1019 <emphasis role="bold">Synopsis</emphasis>
1020 </para>
1021
1022 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">&gt;</phrase>
1023 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.type_with_alignment">type_with_alignment</link><phrase role="special">;</phrase>
1024
1025 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Size</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">&gt;</phrase>
1026 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.aligned_storage">aligned_storage</link><phrase role="special">;</phrase>
1027 </programlisting>
1028 </section>
1029 <section id="boost_typetraits.category.function">
1030 <title><link linkend="boost_typetraits.category.function"> Decomposing Function
1031 Types</link></title>
1032 <para>
1033 The class template <link linkend="boost_typetraits.reference.function_traits">function_traits</link>
1034 extracts information from function types (see also <link linkend="boost_typetraits.reference.is_function">is_function</link>).
1035 This traits class allows you to tell how many arguments a function takes,
1036 what those argument types are, and what the return type is.
1037 </para>
1038 <para>
1039 <emphasis role="bold">Synopsis</emphasis>
1040 </para>
1041
1042 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">&gt;</phrase>
1043 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.function_traits">function_traits</link><phrase role="special">;</phrase>
1044 </programlisting>
1045 </section>
1046 </section>
1047 <section id="boost_typetraits.user_defined"><indexterm type="class_name"><primary>is_union</primary><secondary>User Defined Specializations</secondary></indexterm><indexterm><primary>User Defined Specializations</primary><secondary>is_union</secondary></indexterm><indexterm type="class_name"><primary>is_class</primary><secondary>User Defined Specializations</secondary></indexterm><indexterm><primary>User Defined Specializations</primary><secondary>is_class</secondary></indexterm>
1048 <title><link linkend="boost_typetraits.user_defined"> User Defined Specializations</link></title>
1049 <para>
1050 Occationally the end user may need to provide their own specialization for
1051 one of the type traits - typically where intrinsic compiler support is required
1052 to implement a specific trait fully. These specializations should derive from
1053 boost::<link linkend="boost_typetraits.reference.integral_constant">true_type</link>
1054 or boost::<link linkend="boost_typetraits.reference.integral_constant">false_type</link>
1055 as appropriate:
1056 </para>
1057
1058 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pod</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase>
1059 <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_class</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase>
1060 <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_union</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase>
1061
1062 <phrase role="keyword">struct</phrase> <phrase role="identifier">my_pod</phrase><phrase role="special">{};</phrase>
1063 <phrase role="keyword">struct</phrase> <phrase role="identifier">my_union</phrase>
1064 <phrase role="special">{</phrase>
1065 <phrase role="keyword">char</phrase> <phrase role="identifier">c</phrase><phrase role="special">;</phrase>
1066 <phrase role="keyword">int</phrase> <phrase role="identifier">i</phrase><phrase role="special">;</phrase>
1067 <phrase role="special">};</phrase>
1068
1069 <phrase role="keyword">namespace</phrase> <phrase role="identifier">boost</phrase>
1070 <phrase role="special">{</phrase>
1071 <phrase role="keyword">template</phrase><phrase role="special">&lt;&gt;</phrase>
1072 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special">&lt;</phrase><phrase role="identifier">my_pod</phrase><phrase role="special">&gt;</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase>
1073
1074 <phrase role="keyword">template</phrase><phrase role="special">&lt;&gt;</phrase>
1075 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_pod">is_pod</link><phrase role="special">&lt;</phrase><phrase role="identifier">my_union</phrase><phrase role="special">&gt;</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase>
1076
1077 <phrase role="keyword">template</phrase><phrase role="special">&lt;&gt;</phrase>
1078 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_union">is_union</link><phrase role="special">&lt;</phrase><phrase role="identifier">my_union</phrase><phrase role="special">&gt;</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">{};</phrase>
1079
1080 <phrase role="keyword">template</phrase><phrase role="special">&lt;&gt;</phrase>
1081 <phrase role="keyword">struct</phrase> <link linkend="boost_typetraits.reference.is_class">is_class</link><phrase role="special">&lt;</phrase><phrase role="identifier">my_union</phrase><phrase role="special">&gt;</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">{};</phrase>
1082 <phrase role="special">}</phrase>
1083 </programlisting>
1084 </section>
1085 <section id="boost_typetraits.intrinsics"><indexterm type="macro_name"><primary>BOOST_IS_UNION</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_UNION</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_POLYMORPHIC</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_POLYMORPHIC</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_POD</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_POD</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_ENUM</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_ENUM</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_EMPTY</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_EMPTY</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_CONVERTIBLE</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_CONVERTIBLE</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_CLASS</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_CLASS</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_BASE_OF</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_BASE_OF</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_IS_ABSTRACT</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_IS_ABSTRACT</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_VIRTUAL_DESTRUCTOR</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_VIRTUAL_DESTRUCTOR</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_TRIVIAL_DESTRUCTOR</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_TRIVIAL_DESTRUCTOR</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_TRIVIAL_COPY</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_TRIVIAL_COPY</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_TRIVIAL_CONSTRUCTOR</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_TRIVIAL_CONSTRUCTOR</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_TRIVIAL_ASSIGN</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_TRIVIAL_ASSIGN</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_NOTHROW_COPY</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_NOTHROW_COPY</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_NOTHROW_CONSTRUCTOR</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_NOTHROW_CONSTRUCTOR</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_HAS_NOTHROW_ASSIGN</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_HAS_NOTHROW_ASSIGN</secondary></indexterm><indexterm type="macro_name"><primary>BOOST_ALIGNMENT_OF</primary><secondary>Support for Compiler Intrinsics</secondary></indexterm><indexterm><primary>Support for Compiler Intrinsics</primary><secondary>BOOST_ALIGNMENT_OF</secondary></indexterm>
1086 <title><link linkend="boost_typetraits.intrinsics"> Support for Compiler Intrinsics</link></title>
1087 <para>
1088 There are some traits that can not be implemented within the current C++ language:
1089 to make these traits "just work" with user defined types, some kind
1090 of additional help from the compiler is required. Currently (April 2008) Visual
1091 C++ 8 and 9, GNU GCC 4.3 and MWCW 9 provide the necessary intrinsics, and other
1092 compilers will no doubt follow in due course.
1093 </para>
1094 <para>
1095 The Following traits classes always need compiler support to do the right thing
1096 for all types (but all have safe fallback positions if this support is unavailable):
1097 </para>
1098 <itemizedlist>
1099 <listitem>
1100 <link linkend="boost_typetraits.reference.is_union">is_union</link>
1101 </listitem>
1102 <listitem>
1103 <link linkend="boost_typetraits.reference.is_pod">is_pod</link>
1104 </listitem>
1105 <listitem>
1106 <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link>
1107 </listitem>
1108 <listitem>
1109 <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link>
1110 </listitem>
1111 <listitem>
1112 <link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link>
1113 </listitem>
1114 <listitem>
1115 <link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link>
1116 </listitem>
1117 <listitem>
1118 <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link>
1119 </listitem>
1120 <listitem>
1121 <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link>
1122 </listitem>
1123 <listitem>
1124 <link linkend="boost_typetraits.reference.has_nothrow_assign">has_nothrow_assign</link>
1125 </listitem>
1126 <listitem>
1127 <link linkend="boost_typetraits.reference.has_virtual_destructor">has_virtual_destructor</link>
1128 </listitem>
1129 </itemizedlist>
1130 <para>
1131 The following traits classes can't be portably implemented in the C++ language,
1132 although in practice, the implementations do in fact do the right thing on
1133 all the compilers we know about:
1134 </para>
1135 <itemizedlist>
1136 <listitem>
1137 <link linkend="boost_typetraits.reference.is_empty">is_empty</link>
1138 </listitem>
1139 <listitem>
1140 <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link>
1141 </listitem>
1142 </itemizedlist>
1143 <para>
1144 The following traits classes are dependent on one or more of the above:
1145 </para>
1146 <itemizedlist>
1147 <listitem>
1148 <link linkend="boost_typetraits.reference.is_class">is_class</link>
1149 </listitem>
1150 <listitem>
1151 <link linkend="boost_typetraits.reference.is_stateless">is_stateless</link>
1152 </listitem>
1153 </itemizedlist>
1154 <para>
1155 The hooks for compiler-intrinsic support are defined in <ulink url="../../../../boost/type_traits/intrinsics.hpp">boost/type_traits/intrinsics.hpp</ulink>,
1156 adding support for new compilers is simply a matter of defining one of more
1157 of the following macros:
1158 </para>
1159 <table frame="all"> <title>Macros for Compiler Intrinsics</title>
1160 <tgroup cols="2">
1161 <thead>
1162 <row>
1163 <entry>
1164 <para>
1165 BOOST_IS_UNION(T)
1166 </para>
1167 </entry><entry>
1168 <para>
1169 Should evaluate to true if T is a union type
1170 </para>
1171 </entry>
1172 </row>
1173 </thead>
1174 <tbody>
1175 <row>
1176 <entry>
1177 <para>
1178 BOOST_IS_POD(T)
1179 </para>
1180 </entry><entry>
1181 <para>
1182 Should evaluate to true if T is a POD type
1183 </para>
1184 </entry>
1185 </row>
1186 <row>
1187 <entry>
1188 <para>
1189 BOOST_IS_EMPTY(T)
1190 </para>
1191 </entry><entry>
1192 <para>
1193 Should evaluate to true if T is an empty struct or union
1194 </para>
1195 </entry>
1196 </row>
1197 <row>
1198 <entry>
1199 <para>
1200 BOOST_HAS_TRIVIAL_CONSTRUCTOR(T)
1201 </para>
1202 </entry><entry>
1203 <para>
1204 Should evaluate to true if the default constructor for T is trivial (i.e.
1205 has no effect)
1206 </para>
1207 </entry>
1208 </row>
1209 <row>
1210 <entry>
1211 <para>
1212 BOOST_HAS_TRIVIAL_COPY(T)
1213 </para>
1214 </entry><entry>
1215 <para>
1216 Should evaluate to true if T has a trivial copy constructor (and can
1217 therefore be replaced by a call to memcpy)
1218 </para>
1219 </entry>
1220 </row>
1221 <row>
1222 <entry>
1223 <para>
1224 BOOST_HAS_TRIVIAL_ASSIGN(T)
1225 </para>
1226 </entry><entry>
1227 <para>
1228 Should evaluate to true if T has a trivial assignment operator (and can
1229 therefore be replaced by a call to memcpy)
1230 </para>
1231 </entry>
1232 </row>
1233 <row>
1234 <entry>
1235 <para>
1236 BOOST_HAS_TRIVIAL_DESTRUCTOR(T)
1237 </para>
1238 </entry><entry>
1239 <para>
1240 Should evaluate to true if T has a trivial destructor (i.e. ~T() has
1241 no effect)
1242 </para>
1243 </entry>
1244 </row>
1245 <row>
1246 <entry>
1247 <para>
1248 BOOST_HAS_NOTHROW_CONSTRUCTOR(T)
1249 </para>
1250 </entry><entry>
1251 <para>
1252 Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase>
1253 <phrase role="identifier">x</phrase><phrase role="special">;</phrase></computeroutput>
1254 can not throw
1255 </para>
1256 </entry>
1257 </row>
1258 <row>
1259 <entry>
1260 <para>
1261 BOOST_HAS_NOTHROW_COPY(T)
1262 </para>
1263 </entry><entry>
1264 <para>
1265 Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase><phrase role="special">(</phrase><phrase role="identifier">t</phrase><phrase role="special">)</phrase></computeroutput> can not throw
1266 </para>
1267 </entry>
1268 </row>
1269 <row>
1270 <entry>
1271 <para>
1272 BOOST_HAS_NOTHROW_ASSIGN(T)
1273 </para>
1274 </entry><entry>
1275 <para>
1276 Should evaluate to true if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase>
1277 <phrase role="identifier">t</phrase><phrase role="special">,</phrase>
1278 <phrase role="identifier">u</phrase><phrase role="special">;</phrase>
1279 <phrase role="identifier">t</phrase> <phrase role="special">=</phrase>
1280 <phrase role="identifier">u</phrase></computeroutput> can not throw
1281 </para>
1282 </entry>
1283 </row>
1284 <row>
1285 <entry>
1286 <para>
1287 BOOST_HAS_VIRTUAL_DESTRUCTOR(T)
1288 </para>
1289 </entry><entry>
1290 <para>
1291 Should evaluate to true T has a virtual destructor
1292 </para>
1293 </entry>
1294 </row>
1295 <row>
1296 <entry>
1297 <para>
1298 BOOST_IS_ABSTRACT(T)
1299 </para>
1300 </entry><entry>
1301 <para>
1302 Should evaluate to true if T is an abstract type
1303 </para>
1304 </entry>
1305 </row>
1306 <row>
1307 <entry>
1308 <para>
1309 BOOST_IS_BASE_OF(T,U)
1310 </para>
1311 </entry><entry>
1312 <para>
1313 Should evaluate to true if T is a base class of U
1314 </para>
1315 </entry>
1316 </row>
1317 <row>
1318 <entry>
1319 <para>
1320 BOOST_IS_CLASS(T)
1321 </para>
1322 </entry><entry>
1323 <para>
1324 Should evaluate to true if T is a class type
1325 </para>
1326 </entry>
1327 </row>
1328 <row>
1329 <entry>
1330 <para>
1331 BOOST_IS_CONVERTIBLE(T,U)
1332 </para>
1333 </entry><entry>
1334 <para>
1335 Should evaluate to true if T is convertible to U
1336 </para>
1337 </entry>
1338 </row>
1339 <row>
1340 <entry>
1341 <para>
1342 BOOST_IS_ENUM(T)
1343 </para>
1344 </entry><entry>
1345 <para>
1346 Should evaluate to true is T is an enum
1347 </para>
1348 </entry>
1349 </row>
1350 <row>
1351 <entry>
1352 <para>
1353 BOOST_IS_POLYMORPHIC(T)
1354 </para>
1355 </entry><entry>
1356 <para>
1357 Should evaluate to true if T is a polymorphic type
1358 </para>
1359 </entry>
1360 </row>
1361 <row>
1362 <entry>
1363 <para>
1364 BOOST_ALIGNMENT_OF(T)
1365 </para>
1366 </entry><entry>
1367 <para>
1368 Should evaluate to the alignment requirements of type T.
1369 </para>
1370 </entry>
1371 </row>
1372 </tbody>
1373 </tgroup>
1374 </table>
1375 </section>
1376 <section id="boost_typetraits.mpl">
1377 <title><link linkend="boost_typetraits.mpl"> MPL Interoperability</link></title>
1378 <para>
1379 All the value based traits in this library conform to MPL's requirements for
1380 an <ulink url="../../../../libs/mpl/doc/refmanual/integral-constant.html">Integral
1381 Constant type</ulink>: that includes a number of rather intrusive workarounds
1382 for broken compilers.
1383 </para>
1384 <para>
1385 Purely as an implementation detail, this means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>
1386 inherits from <ulink url="../../../../libs/mpl/doc/refmanual/bool.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">true_</phrase></computeroutput></ulink>,
1387 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">false_type</link></computeroutput>
1388 inherits from <ulink url="../../../../libs/mpl/doc/refmanual/bool.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">false_</phrase></computeroutput></ulink>,
1389 and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase>
1390 <phrase role="identifier">v</phrase><phrase role="special">&gt;</phrase></computeroutput>
1391 inherits from <ulink url="../../../../libs/mpl/doc/refmanual/integral-c.html"><computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mpl</phrase><phrase role="special">::</phrase><phrase role="identifier">integral_c</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">v</phrase><phrase role="special">&gt;</phrase></computeroutput></ulink>
1392 (provided <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>)
1393 </para>
1394 </section>
1395 <section id="boost_typetraits.examples">
1396 <title><link linkend="boost_typetraits.examples"> Examples</link></title>
1397 <section id="boost_typetraits.examples.copy"><indexterm type="typedef_name"><primary>value_type</primary><secondary>An Optimized Version of std::copy</secondary></indexterm><indexterm><primary>Optimized Version of std::copy</primary><secondary>value_type</secondary></indexterm>
1398 <title><link linkend="boost_typetraits.examples.copy"> An Optimized Version
1399 of std::copy</link></title>
1400 <para>
1401 Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">copy</phrase></computeroutput>
1402 that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput>
1403 to determine whether to use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>
1404 to optimise the copy operation (see <ulink url="../../examples/copy_example.cpp">copy_example.cpp</ulink>):
1405 </para>
1406
1407 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">//
1408 </phrase><phrase role="comment">// opt::copy
1409 </phrase><phrase role="comment">// same semantics as std::copy
1410 </phrase><phrase role="comment">// calls memcpy where appropriate.
1411 </phrase><phrase role="comment">//
1412 </phrase>
1413 <phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase>
1414
1415 <phrase role="keyword">template</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">,</phrase> <phrase role="keyword">bool</phrase> <phrase role="identifier">b</phrase><phrase role="special">&gt;</phrase>
1416 <phrase role="identifier">I2</phrase> <phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="identifier">b</phrase><phrase role="special">&gt;&amp;)</phrase>
1417 <phrase role="special">{</phrase>
1418 <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase>
1419 <phrase role="special">{</phrase>
1420 <phrase role="special">*</phrase><phrase role="identifier">out</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase>
1421 <phrase role="special">++</phrase><phrase role="identifier">out</phrase><phrase role="special">;</phrase>
1422 <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase>
1423 <phrase role="special">}</phrase>
1424 <phrase role="keyword">return</phrase> <phrase role="identifier">out</phrase><phrase role="special">;</phrase>
1425 <phrase role="special">}</phrase>
1426
1427 <phrase role="keyword">template</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
1428 <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&amp;)</phrase>
1429 <phrase role="special">{</phrase>
1430 <phrase role="identifier">memcpy</phrase><phrase role="special">(</phrase><phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="special">(</phrase><phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">)*</phrase><phrase role="keyword">sizeof</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">));</phrase>
1431 <phrase role="keyword">return</phrase> <phrase role="identifier">out</phrase><phrase role="special">+(</phrase><phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">);</phrase>
1432 <phrase role="special">}</phrase>
1433
1434
1435 <phrase role="special">}</phrase>
1436
1437 <phrase role="keyword">template</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">&gt;</phrase>
1438 <phrase role="keyword">inline</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">copy</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I1</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">out</phrase><phrase role="special">)</phrase>
1439 <phrase role="special">{</phrase>
1440 <phrase role="comment">//
1441 </phrase> <phrase role="comment">// We can copy with memcpy if T has a trivial assignment operator,
1442 </phrase> <phrase role="comment">// and if the iterator arguments are actually pointers (this last
1443 </phrase> <phrase role="comment">// requirement we detect with overload resolution):
1444 </phrase> <phrase role="comment">//
1445 </phrase> <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">I1</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase> <phrase role="identifier">value_type</phrase><phrase role="special">;</phrase>
1446 <phrase role="keyword">return</phrase> <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">copy_imp</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">out</phrase><phrase role="special">,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special">&lt;</phrase><phrase role="identifier">value_type</phrase><phrase role="special">&gt;());</phrase>
1447 <phrase role="special">}</phrase>
1448 </programlisting>
1449 </section>
1450 <section id="boost_typetraits.examples.fill">
1451 <title><link linkend="boost_typetraits.examples.fill"> An Optimised Version
1452 of std::fill</link></title>
1453 <para>
1454 Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">fill</phrase></computeroutput>
1455 that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link></computeroutput>
1456 to determine whether to use <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memset</phrase></computeroutput>
1457 to optimise the fill operation (see <ulink url="../../examples/fill_example.cpp">fill_example.cpp</ulink>):
1458 </para>
1459
1460 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">//
1461 </phrase><phrase role="comment">// fill
1462 </phrase><phrase role="comment">// same as std::fill, but uses memset where appropriate
1463 </phrase><phrase role="comment">//
1464 </phrase><phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase>
1465
1466 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">bool</phrase> <phrase role="identifier">b</phrase><phrase role="special">&gt;</phrase>
1467 <phrase role="keyword">void</phrase> <phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&amp;</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="identifier">b</phrase><phrase role="special">&gt;&amp;)</phrase>
1468 <phrase role="special">{</phrase>
1469 <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase>
1470 <phrase role="special">{</phrase>
1471 <phrase role="special">*</phrase><phrase role="identifier">first</phrase> <phrase role="special">=</phrase> <phrase role="identifier">val</phrase><phrase role="special">;</phrase>
1472 <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase>
1473 <phrase role="special">}</phrase>
1474 <phrase role="special">}</phrase>
1475
1476 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
1477 <phrase role="keyword">void</phrase> <phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&amp;</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&amp;)</phrase>
1478 <phrase role="special">{</phrase>
1479 <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">memset</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">-</phrase><phrase role="identifier">first</phrase><phrase role="special">);</phrase>
1480 <phrase role="special">}</phrase>
1481
1482 <phrase role="special">}</phrase>
1483
1484 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">I</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
1485 <phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">fill</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase><phrase role="special">&amp;</phrase> <phrase role="identifier">val</phrase><phrase role="special">)</phrase>
1486 <phrase role="special">{</phrase>
1487 <phrase role="comment">//
1488 </phrase> <phrase role="comment">// We can do an optimised fill if T has a trivial assignment
1489 </phrase> <phrase role="comment">// operator and if it's size is one:
1490 </phrase> <phrase role="comment">//
1491 </phrase> <phrase role="keyword">typedef</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase>
1492 <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_assign">has_trivial_assign</link><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase> <phrase role="special">&amp;&amp;</phrase> <phrase role="special">(</phrase><phrase role="keyword">sizeof</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase> <phrase role="special">==</phrase> <phrase role="number">1</phrase><phrase role="special">)&gt;</phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">;</phrase>
1493 <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_fill</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">,</phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">());</phrase>
1494 <phrase role="special">}</phrase>
1495 </programlisting>
1496 </section>
1497 <section id="boost_typetraits.examples.destruct">
1498 <title><link linkend="boost_typetraits.examples.destruct"> An Example that
1499 Omits Destructor Calls For Types with Trivial Destructors</link></title>
1500 <para>
1501 Demonstrates a simple algorithm that uses <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">__has_trivial_destruct</phrase></computeroutput>
1502 to determine whether to destructors need to be called (see <ulink url="../../examples/trivial_destructor_example.cpp">trivial_destructor_example.cpp</ulink>):
1503 </para>
1504
1505 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">//
1506 </phrase><phrase role="comment">// algorithm destroy_array:
1507 </phrase><phrase role="comment">// The reverse of std::unitialized_copy, takes a block of
1508 </phrase><phrase role="comment">// initialized memory and calls destructors on all objects therein.
1509 </phrase><phrase role="comment">//
1510 </phrase>
1511 <phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase>
1512
1513 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
1514 <phrase role="keyword">void</phrase> <phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">&amp;)</phrase>
1515 <phrase role="special">{</phrase>
1516 <phrase role="keyword">while</phrase><phrase role="special">(</phrase><phrase role="identifier">first</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">last</phrase><phrase role="special">)</phrase>
1517 <phrase role="special">{</phrase>
1518 <phrase role="identifier">first</phrase><phrase role="special">-&gt;~</phrase><phrase role="identifier">T</phrase><phrase role="special">();</phrase>
1519 <phrase role="special">++</phrase><phrase role="identifier">first</phrase><phrase role="special">;</phrase>
1520 <phrase role="special">}</phrase>
1521 <phrase role="special">}</phrase>
1522
1523 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
1524 <phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">first</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">last</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&amp;)</phrase>
1525 <phrase role="special">{</phrase>
1526 <phrase role="special">}</phrase>
1527
1528 <phrase role="special">}</phrase> <phrase role="comment">// namespace detail
1529 </phrase>
1530 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
1531 <phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">p1</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase><phrase role="special">*</phrase> <phrase role="identifier">p2</phrase><phrase role="special">)</phrase>
1532 <phrase role="special">{</phrase>
1533 <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_destroy_array</phrase><phrase role="special">(</phrase><phrase role="identifier">p1</phrase><phrase role="special">,</phrase> <phrase role="identifier">p2</phrase><phrase role="special">,</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.has_trivial_destructor">has_trivial_destructor</link><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;());</phrase>
1534 <phrase role="special">}</phrase>
1535 </programlisting>
1536 </section>
1537 <section id="boost_typetraits.examples.iter">
1538 <title><link linkend="boost_typetraits.examples.iter"> An improved Version
1539 of std::iter_swap</link></title>
1540 <para>
1541 Demonstrates a version of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iter_swap</phrase></computeroutput>
1542 that use type traits to determine whether an it's arguments are proxying
1543 iterators or not, if they're not then it just does a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">swap</phrase></computeroutput>
1544 of it's dereferenced arguments (the same as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iter_swap</phrase></computeroutput>
1545 does), however if they are proxying iterators then takes special care over
1546 the swap to ensure that the algorithm works correctly for both proxying iterators,
1547 and even iterators of different types (see <ulink url="../../examples/iter_swap_example.cpp">iter_swap_example.cpp</ulink>):
1548 </para>
1549
1550 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="comment">//
1551 </phrase><phrase role="comment">// iter_swap:
1552 </phrase><phrase role="comment">// tests whether iterator is a proxying iterator or not, and
1553 </phrase><phrase role="comment">// uses optimal form accordingly:
1554 </phrase><phrase role="comment">//
1555 </phrase><phrase role="keyword">namespace</phrase> <phrase role="identifier">detail</phrase><phrase role="special">{</phrase>
1556
1557 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">&gt;</phrase>
1558 <phrase role="keyword">static</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">false_type</link><phrase role="special">&amp;)</phrase>
1559 <phrase role="special">{</phrase>
1560 <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">I</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase> <phrase role="identifier">v_t</phrase><phrase role="special">;</phrase>
1561 <phrase role="identifier">v_t</phrase> <phrase role="identifier">v</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">one</phrase><phrase role="special">;</phrase>
1562 <phrase role="special">*</phrase><phrase role="identifier">one</phrase> <phrase role="special">=</phrase> <phrase role="special">*</phrase><phrase role="identifier">two</phrase><phrase role="special">;</phrase>
1563 <phrase role="special">*</phrase><phrase role="identifier">two</phrase> <phrase role="special">=</phrase> <phrase role="identifier">v</phrase><phrase role="special">;</phrase>
1564 <phrase role="special">}</phrase>
1565 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I</phrase><phrase role="special">&gt;</phrase>
1566 <phrase role="keyword">static</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">true_type</link><phrase role="special">&amp;)</phrase>
1567 <phrase role="special">{</phrase>
1568 <phrase role="keyword">using</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">swap</phrase><phrase role="special">;</phrase>
1569 <phrase role="identifier">swap</phrase><phrase role="special">(*</phrase><phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="special">*</phrase><phrase role="identifier">two</phrase><phrase role="special">);</phrase>
1570 <phrase role="special">}</phrase>
1571
1572 <phrase role="special">}</phrase>
1573
1574 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">typename</phrase> <phrase role="identifier">I1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">I2</phrase><phrase role="special">&gt;</phrase>
1575 <phrase role="keyword">inline</phrase> <phrase role="keyword">void</phrase> <phrase role="identifier">iter_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">I1</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">I2</phrase> <phrase role="identifier">two</phrase><phrase role="special">)</phrase>
1576 <phrase role="special">{</phrase>
1577 <phrase role="comment">//
1578 </phrase> <phrase role="comment">// See is both arguments are non-proxying iterators,
1579 </phrase> <phrase role="comment">// and if both iterator the same type:
1580 </phrase> <phrase role="comment">//
1581 </phrase> <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">I1</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">reference</phrase> <phrase role="identifier">r1_t</phrase><phrase role="special">;</phrase>
1582 <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">iterator_traits</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">I2</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">reference</phrase> <phrase role="identifier">r2_t</phrase><phrase role="special">;</phrase>
1583
1584 <phrase role="keyword">typedef</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase>
1585 <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special">&lt;</phrase><phrase role="identifier">r1_t</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase>
1586 <phrase role="special">&amp;&amp;</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_reference">is_reference</link><phrase role="special">&lt;</phrase><phrase role="identifier">r2_t</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase>
1587 <phrase role="special">&amp;&amp;</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><link linkend="boost_typetraits.reference.is_same">is_same</link><phrase role="special">&lt;</phrase><phrase role="identifier">r1_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">r2_t</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase><phrase role="special">&gt;</phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">;</phrase>
1588
1589 <phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">do_swap</phrase><phrase role="special">(</phrase><phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">two</phrase><phrase role="special">,</phrase> <phrase role="identifier">truth_type</phrase><phrase role="special">());</phrase>
1590 <phrase role="special">}</phrase>
1591 </programlisting>
1592 </section>
1593 <section id="boost_typetraits.examples.to_double">
1594 <title><link linkend="boost_typetraits.examples.to_double"> Convert Numeric
1595 Types and Enums to double</link></title>
1596 <para>
1597 Demonstrates a conversion of <ulink url="../../../../libs/numeric/conversion/doc/html/boost_numericconversion/definitions.html#boost_numericconversion.definitions.numeric_types">Numeric
1598 Types</ulink> and enum types to double:
1599 </para>
1600
1601 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
1602 <phrase role="keyword">inline</phrase> <phrase role="keyword">double</phrase> <phrase role="identifier">to_double</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;</phrase> <phrase role="identifier">value</phrase><phrase role="special">)</phrase>
1603 <phrase role="special">{</phrase>
1604 <phrase role="keyword">typedef</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">promote</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase> <phrase role="identifier">promoted</phrase><phrase role="special">;</phrase>
1605 <phrase role="keyword">return</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">numeric</phrase><phrase role="special">::</phrase><phrase role="identifier">converter</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase><phrase role="identifier">promoted</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">convert</phrase><phrase role="special">(</phrase><phrase role="identifier">value</phrase><phrase role="special">);</phrase>
1606 <phrase role="special">}</phrase>
1607 </programlisting>
1608 </section>
1609 </section>
1610 <section id="boost_typetraits.reference">
1611 <title><link linkend="boost_typetraits.reference"> Alphabetical Reference</link></title>
1612 <section id="boost_typetraits.reference.add_const"><indexterm type="class_name"><primary>Constrained Index Term</primary><secondary>add_const</secondary></indexterm><indexterm><primary>add_const</primary><secondary>Constrained Index Term</secondary></indexterm><indexterm type="class_name"><primary>Constrained Index Term</primary><secondary>add_const</secondary></indexterm><indexterm><primary>add_const</primary><secondary>Constrained Index Term</secondary></indexterm><indexterm type="class_name"><primary>add_const</primary><secondary>add_const</secondary></indexterm><indexterm type="class_name"><primary>Constrained Index Term</primary><secondary>add_const</secondary></indexterm><indexterm><primary>add_const</primary><secondary>Constrained Index Term</secondary></indexterm><indexterm type="class_name"><primary>Constrained Index Term</primary><secondary>add_const</secondary></indexterm><indexterm><primary>add_const</primary><secondary>Constrained Index Term</secondary></indexterm>
1613 <title><link linkend="boost_typetraits.reference.add_const"> add_const</link></title>
1614 <indexterm type="class_name">
1615 <primary>one</primary>
1616 <secondary>two</secondary>
1617 </indexterm>
1618
1619 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
1620 <phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase>
1621 <phrase role="special">{</phrase>
1622 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
1623 <phrase role="special">};</phrase>
1624 </programlisting>
1625 <para>
1626 <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase>
1627 <phrase role="keyword">const</phrase></computeroutput> for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>.
1628 </para>
1629 <para>
1630 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3.
1631 </para>
1632 <para>
1633 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
1634 does not support partial specialization of class-templates then this template
1635 will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
1636 will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
1637 except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
1638 workarounds</link> have been applied.
1639 </para>
1640 <para>
1641 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
1642 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
1643 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
1644 </para>
1645 <table frame="all"> <title>Examples</title>
1646 <tgroup cols="2">
1647 <thead>
1648 <row>
1649 <entry>
1650 <para>
1651 Expression
1652 </para>
1653 </entry><entry>
1654 <para>
1655 Result Type
1656 </para>
1657 </entry>
1658 </row>
1659 </thead>
1660 <tbody>
1661 <row>
1662 <entry>
1663 <para>
1664 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1665 </para>
1666 </entry><entry>
1667 <para>
1668 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput>
1669 </para>
1670 </entry>
1671 </row>
1672 <row>
1673 <entry>
1674 <para>
1675 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1676 </para>
1677 </entry><entry>
1678 <para>
1679 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&amp;</phrase></computeroutput>
1680 </para>
1681 </entry>
1682 </row>
1683 <row>
1684 <entry>
1685 <para>
1686 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1687 </para>
1688 </entry><entry>
1689 <para>
1690 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase>
1691 <phrase role="keyword">const</phrase></computeroutput>
1692 </para>
1693 </entry>
1694 </row>
1695 <row>
1696 <entry>
1697 <para>
1698 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1699 </para>
1700 </entry><entry>
1701 <para>
1702 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput>
1703 </para>
1704 </entry>
1705 </row>
1706 </tbody>
1707 </tgroup>
1708 </table>
1709 </section>
1710 <section id="boost_typetraits.reference.add_cv"><indexterm type="class_name"><primary>add_cv</primary><secondary>add_cv</secondary></indexterm>
1711 <title><link linkend="boost_typetraits.reference.add_cv"> add_cv</link></title>
1712 <indexterm type="class_name">
1713 <primary>one</primary>
1714 <secondary>two</secondary>
1715 <tertiary>three</tertiary>
1716 </indexterm>
1717
1718 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
1719 <phrase role="keyword">struct</phrase> <phrase role="identifier">add_cv</phrase>
1720 <phrase role="special">{</phrase>
1721 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
1722 <phrase role="special">};</phrase>
1723 </programlisting>
1724 <para>
1725 <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase>
1726 <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase></computeroutput>
1727 for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>.
1728 </para>
1729 <para>
1730 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3.
1731 </para>
1732 <para>
1733 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
1734 does not support partial specialization of class-templates then this template
1735 will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
1736 will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
1737 except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
1738 workarounds</link> have been applied.
1739 </para>
1740 <para>
1741 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
1742 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_cv</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
1743 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
1744 </para>
1745 <table frame="all"> <title>Examples</title>
1746 <tgroup cols="2">
1747 <thead>
1748 <row>
1749 <entry>
1750 <para>
1751 Expression
1752 </para>
1753 </entry><entry>
1754 <para>
1755 Result Type
1756 </para>
1757 </entry>
1758 </row>
1759 </thead>
1760 <tbody>
1761 <row>
1762 <entry>
1763 <para>
1764 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1765 </para>
1766 </entry><entry>
1767 <para>
1768 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase>
1769 <phrase role="keyword">volatile</phrase></computeroutput>
1770 </para>
1771 </entry>
1772 </row>
1773 <row>
1774 <entry>
1775 <para>
1776 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1777 </para>
1778 </entry><entry>
1779 <para>
1780 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&amp;</phrase></computeroutput>
1781 </para>
1782 </entry>
1783 </row>
1784 <row>
1785 <entry>
1786 <para>
1787 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1788 </para>
1789 </entry><entry>
1790 <para>
1791 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase>
1792 <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase></computeroutput>
1793 </para>
1794 </entry>
1795 </row>
1796 <row>
1797 <entry>
1798 <para>
1799 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_cv</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1800 </para>
1801 </entry><entry>
1802 <para>
1803 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase>
1804 <phrase role="keyword">volatile</phrase></computeroutput>
1805 </para>
1806 </entry>
1807 </row>
1808 </tbody>
1809 </tgroup>
1810 </table>
1811 </section>
1812 <section id="boost_typetraits.reference.add_pointer"><indexterm type="class_name"><primary>add_pointer</primary><secondary>add_pointer</secondary></indexterm>
1813 <title><link linkend="boost_typetraits.reference.add_pointer"> add_pointer</link></title>
1814
1815 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
1816 <phrase role="keyword">struct</phrase> <phrase role="identifier">add_pointer</phrase>
1817 <phrase role="special">{</phrase>
1818 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
1819 <phrase role="special">};</phrase>
1820 </programlisting>
1821 <para>
1822 <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase><phrase role="special">*</phrase></computeroutput>.
1823 </para>
1824 <para>
1825 The rationale for this template is that it produces the same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">TYPEOF</phrase><phrase role="special">(&amp;</phrase><phrase role="identifier">t</phrase><phrase role="special">)</phrase></computeroutput>, where
1826 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">t</phrase></computeroutput> is an object of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>.
1827 </para>
1828 <para>
1829 <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.1.
1830 </para>
1831 <para>
1832 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
1833 does not support partial specialization of class-templates then this template
1834 will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
1835 will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
1836 except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
1837 workarounds</link> have been applied.
1838 </para>
1839 <para>
1840 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
1841 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
1842 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
1843 </para>
1844 <table frame="all"> <title>Examples</title>
1845 <tgroup cols="2">
1846 <thead>
1847 <row>
1848 <entry>
1849 <para>
1850 Expression
1851 </para>
1852 </entry><entry>
1853 <para>
1854 Result Type
1855 </para>
1856 </entry>
1857 </row>
1858 </thead>
1859 <tbody>
1860 <row>
1861 <entry>
1862 <para>
1863 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1864 </para>
1865 </entry><entry>
1866 <para>
1867 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput>
1868 </para>
1869 </entry>
1870 </row>
1871 <row>
1872 <entry>
1873 <para>
1874 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1875 </para>
1876 </entry><entry>
1877 <para>
1878 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput>
1879 </para>
1880 </entry>
1881 </row>
1882 <row>
1883 <entry>
1884 <para>
1885 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1886 </para>
1887 </entry><entry>
1888 <para>
1889 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">**</phrase></computeroutput>
1890 </para>
1891 </entry>
1892 </row>
1893 <row>
1894 <entry>
1895 <para>
1896 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1897 </para>
1898 </entry><entry>
1899 <para>
1900 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">**</phrase></computeroutput>
1901 </para>
1902 </entry>
1903 </row>
1904 </tbody>
1905 </tgroup>
1906 </table>
1907 </section>
1908 <section id="boost_typetraits.reference.add_reference"><indexterm type="class_name"><primary>add_reference</primary><secondary>add_reference</secondary></indexterm>
1909 <title><link linkend="boost_typetraits.reference.add_reference"> add_reference</link></title>
1910
1911 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
1912 <phrase role="keyword">struct</phrase> <phrase role="identifier">add_reference</phrase>
1913 <phrase role="special">{</phrase>
1914 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
1915 <phrase role="special">};</phrase>
1916 </programlisting>
1917 <para>
1918 <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
1919 is not a reference type then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase><phrase role="special">&amp;</phrase></computeroutput>, otherwise <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>.
1920 </para>
1921 <para>
1922 <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.2.
1923 </para>
1924 <para>
1925 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
1926 does not support partial specialization of class-templates then this template
1927 will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
1928 will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
1929 except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
1930 workarounds</link> have been applied.
1931 </para>
1932 <para>
1933 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
1934 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
1935 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
1936 </para>
1937 <table frame="all"> <title>Examples</title>
1938 <tgroup cols="2">
1939 <thead>
1940 <row>
1941 <entry>
1942 <para>
1943 Expression
1944 </para>
1945 </entry><entry>
1946 <para>
1947 Result Type
1948 </para>
1949 </entry>
1950 </row>
1951 </thead>
1952 <tbody>
1953 <row>
1954 <entry>
1955 <para>
1956 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1957 </para>
1958 </entry><entry>
1959 <para>
1960 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&amp;</phrase></computeroutput>
1961 </para>
1962 </entry>
1963 </row>
1964 <row>
1965 <entry>
1966 <para>
1967 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1968 </para>
1969 </entry><entry>
1970 <para>
1971 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;</phrase></computeroutput>
1972 </para>
1973 </entry>
1974 </row>
1975 <row>
1976 <entry>
1977 <para>
1978 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1979 </para>
1980 </entry><entry>
1981 <para>
1982 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&amp;</phrase></computeroutput>
1983 </para>
1984 </entry>
1985 </row>
1986 <row>
1987 <entry>
1988 <para>
1989 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
1990 </para>
1991 </entry><entry>
1992 <para>
1993 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&amp;</phrase></computeroutput>
1994 </para>
1995 </entry>
1996 </row>
1997 </tbody>
1998 </tgroup>
1999 </table>
2000 </section>
2001 <section id="boost_typetraits.reference.add_volatile"><indexterm type="class_name"><primary>add_volatile</primary><secondary>add_volatile</secondary></indexterm>
2002 <title><link linkend="boost_typetraits.reference.add_volatile"> add_volatile</link></title>
2003 <indexterm type="class_name">
2004 <primary>one</primary>
2005 </indexterm>
2006
2007 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2008 <phrase role="keyword">struct</phrase> <phrase role="identifier">add_volatile</phrase>
2009 <phrase role="special">{</phrase>
2010 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
2011 <phrase role="special">};</phrase>
2012 </programlisting>
2013 <para>
2014 <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase>
2015 <phrase role="keyword">volatile</phrase></computeroutput> for all <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>.
2016 </para>
2017 <para>
2018 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3.
2019 </para>
2020 <para>
2021 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
2022 does not support partial specialization of class-templates then this template
2023 will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
2024 will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
2025 except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
2026 workarounds</link> have been applied.
2027 </para>
2028 <para>
2029 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
2030 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">add_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2031 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2032 </para>
2033 <table frame="all"> <title>Examples</title>
2034 <tgroup cols="2">
2035 <thead>
2036 <row>
2037 <entry>
2038 <para>
2039 Expression
2040 </para>
2041 </entry><entry>
2042 <para>
2043 Result Type
2044 </para>
2045 </entry>
2046 </row>
2047 </thead>
2048 <tbody>
2049 <row>
2050 <entry>
2051 <para>
2052 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
2053 </para>
2054 </entry><entry>
2055 <para>
2056 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput>
2057 </para>
2058 </entry>
2059 </row>
2060 <row>
2061 <entry>
2062 <para>
2063 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
2064 </para>
2065 </entry><entry>
2066 <para>
2067 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&amp;</phrase></computeroutput>
2068 </para>
2069 </entry>
2070 </row>
2071 <row>
2072 <entry>
2073 <para>
2074 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
2075 </para>
2076 </entry><entry>
2077 <para>
2078 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase>
2079 <phrase role="keyword">volatile</phrase></computeroutput>
2080 </para>
2081 </entry>
2082 </row>
2083 <row>
2084 <entry>
2085 <para>
2086 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">add_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
2087 </para>
2088 </entry><entry>
2089 <para>
2090 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase>
2091 <phrase role="keyword">volatile</phrase></computeroutput>
2092 </para>
2093 </entry>
2094 </row>
2095 </tbody>
2096 </tgroup>
2097 </table>
2098 </section>
2099 <section id="boost_typetraits.reference.aligned_storage"><indexterm type="class_name"><primary>aligned_storage</primary><secondary>aligned_storage</secondary></indexterm>
2100 <title><link linkend="boost_typetraits.reference.aligned_storage"> aligned_storage</link></title>
2101
2102 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Size</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">&gt;</phrase>
2103 <phrase role="keyword">struct</phrase> <phrase role="identifier">aligned_storage</phrase>
2104 <phrase role="special">{</phrase>
2105 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
2106 <phrase role="special">};</phrase>
2107 </programlisting>
2108 <para>
2109 <emphasis role="bold">type:</emphasis> a built-in or POD type with size
2110 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Size</phrase></computeroutput> and an alignment that
2111 is a multiple of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Align</phrase></computeroutput>.
2112 </para>
2113 <para>
2114 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
2115 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">aligned_storage</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2116 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2117 </para>
2118 </section>
2119 <section id="boost_typetraits.reference.alignment_of"><indexterm type="class_name"><primary>integral_constant</primary><secondary>alignment_of</secondary></indexterm><indexterm><primary>alignment_of</primary><secondary>integral_constant</secondary></indexterm><indexterm type="class_name"><primary>alignment_of</primary><secondary>alignment_of</secondary></indexterm>
2120 <title><link linkend="boost_typetraits.reference.alignment_of"> alignment_of</link></title>
2121
2122 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2123 <phrase role="keyword">struct</phrase> <phrase role="identifier">alignment_of</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)&gt;</phrase> <phrase role="special">{};</phrase>
2124 </programlisting>
2125 <para>
2126 <emphasis role="bold">Inherits:</emphasis> Class template alignment<emphasis role="underline">of inherits from `</emphasis>_integral_constant&lt;std::size_t,
2127 ALIGNOF(T)&gt;<computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">,</phrase> <phrase role="identifier">where</phrase>
2128 </computeroutput>ALIGNOF(T)` is the alignment of type T.
2129 </para>
2130 <para>
2131 <emphasis>Note: strictly speaking you should only rely on the value of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> being
2132 a multiple of the true alignment of T, although in practice it does compute
2133 the correct value in all the cases we know about.</emphasis>
2134 </para>
2135 <para>
2136 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
2137 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">alignment_of</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2138 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2139 </para>
2140 <para>
2141 <emphasis role="bold">Examples:</emphasis>
2142 </para>
2143 <blockquote>
2144 <para>
2145 <para>
2146 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput>
2147 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)&gt;</phrase></computeroutput>.
2148 </para>
2149 </para>
2150 </blockquote>
2151 <blockquote>
2152 <para>
2153 <para>
2154 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">char</phrase><phrase role="special">)&gt;</phrase></computeroutput>.
2155 </para>
2156 </para>
2157 </blockquote>
2158 <blockquote>
2159 <para>
2160 <para>
2161 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">double</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
2162 with value <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">ALIGNOF</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput>.
2163 </para>
2164 </para>
2165 </blockquote>
2166 <blockquote>
2167 <para>
2168 <para>
2169 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">alignment_of</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>.
2170 </para>
2171 </para>
2172 </blockquote>
2173 </section>
2174 <section id="boost_typetraits.reference.decay"><indexterm type="class_name"><primary>decay</primary><secondary>decay</secondary></indexterm>
2175 <title><link linkend="boost_typetraits.reference.decay"> decay</link></title>
2176
2177 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2178 <phrase role="keyword">struct</phrase> <phrase role="identifier">decay</phrase>
2179 <phrase role="special">{</phrase>
2180 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
2181 <phrase role="special">};</phrase>
2182 </programlisting>
2183 <para>
2184 <emphasis role="bold">type:</emphasis> Let <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput>
2185 be the result of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>, then if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput>
2186 is an array type, the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">U</phrase><phrase role="special">&gt;*</phrase></computeroutput>,
2187 otherwise if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput> is a function
2188 type then the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase><phrase role="special">*</phrase></computeroutput>, otherwise the result is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput>.
2189 </para>
2190 <para>
2191 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1.
2192 </para>
2193 <para>
2194 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
2195 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">decay</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2196 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2197 </para>
2198 <table frame="all"> <title>Examples</title>
2199 <tgroup cols="2">
2200 <thead>
2201 <row>
2202 <entry>
2203 <para>
2204 Expression
2205 </para>
2206 </entry><entry>
2207 <para>
2208 Result Type
2209 </para>
2210 </entry>
2211 </row>
2212 </thead>
2213 <tbody>
2214 <row>
2215 <entry>
2216 <para>
2217 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
2218 </para>
2219 </entry><entry>
2220 <para>
2221 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]*</phrase></computeroutput>
2222 </para>
2223 </entry>
2224 </row>
2225 <row>
2226 <entry>
2227 <para>
2228 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">(&amp;)[</phrase><phrase role="number">2</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
2229 </para>
2230 </entry><entry>
2231 <para>
2232 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput>
2233 </para>
2234 </entry>
2235 </row>
2236 <row>
2237 <entry>
2238 <para>
2239 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">decay</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">(&amp;)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
2240 </para>
2241 </entry><entry>
2242 <para>
2243 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput>
2244 </para>
2245 </entry>
2246 </row>
2247 <row>
2248 <entry>
2249 <para>
2250 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase></computeroutput>
2251 </para>
2252 </entry><entry>
2253 <para>
2254 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput>
2255 </para>
2256 </entry>
2257 </row>
2258 <row>
2259 <entry>
2260 <para>
2261 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput>
2262 </para>
2263 </entry><entry>
2264 <para>
2265 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">)</phrase></computeroutput>
2266 </para>
2267 </entry>
2268 </row>
2269 </tbody>
2270 </tgroup>
2271 </table>
2272 </section>
2273 <section id="boost_typetraits.reference.extent"><indexterm type="class_name"><primary>integral_constant</primary><secondary>extent</secondary></indexterm><indexterm><primary>extent</primary><secondary>integral_constant</secondary></indexterm><indexterm type="class_name"><primary>extent</primary><secondary>extent</secondary></indexterm>
2274 <title><link linkend="boost_typetraits.reference.extent"> extent</link></title>
2275
2276 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">N</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">&gt;</phrase>
2277 <phrase role="keyword">struct</phrase> <phrase role="identifier">extent</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)&gt;</phrase> <phrase role="special">{};</phrase>
2278 </programlisting>
2279 <para>
2280 <emphasis role="bold">Inherits:</emphasis> Class template extent inherits
2281 from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)&gt;</phrase></computeroutput>,
2282 where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)</phrase></computeroutput> is the number of elements in the N'th array
2283 dimention of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>.
2284 </para>
2285 <para>
2286 If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not an array type,
2287 or if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">N</phrase> <phrase role="special">&gt;</phrase>
2288 <link linkend="boost_typetraits.reference.rank">rank</link><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>, or if the N'th array bound is incomplete,
2289 then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">EXTENT</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase><phrase role="identifier">N</phrase><phrase role="special">)</phrase></computeroutput> is zero.
2290 </para>
2291 <para>
2292 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
2293 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">extent</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2294 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2295 </para>
2296 <para>
2297 <emphasis role="bold">Examples:</emphasis>
2298 </para>
2299 <blockquote>
2300 <para>
2301 <para>
2302 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">1</phrase><phrase role="special">]&gt;</phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">1</phrase><phrase role="special">&gt;</phrase></computeroutput>.
2303 </para>
2304 </para>
2305 </blockquote>
2306 <blockquote>
2307 <para>
2308 <para>
2309 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">double</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">],</phrase>
2310 <phrase role="number">1</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">3</phrase><phrase role="special">&gt;</phrase></computeroutput>.
2311 </para>
2312 </para>
2313 </blockquote>
2314 <blockquote>
2315 <para>
2316 <para>
2317 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
2318 is an integral constant expression that evaluates to <emphasis>4</emphasis>.
2319 </para>
2320 </para>
2321 </blockquote>
2322 <blockquote>
2323 <para>
2324 <para>
2325 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
2326 that evaluates to <emphasis>0</emphasis>.
2327 </para>
2328 </para>
2329 </blockquote>
2330 <blockquote>
2331 <para>
2332 <para>
2333 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">],</phrase> <phrase role="number">1</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
2334 is an integral constant expression that evaluates to <emphasis>2</emphasis>.
2335 </para>
2336 </para>
2337 </blockquote>
2338 <blockquote>
2339 <para>
2340 <para>
2341 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
2342 that evaluates to <emphasis>0</emphasis>.
2343 </para>
2344 </para>
2345 </blockquote>
2346 <blockquote>
2347 <para>
2348 <para>
2349 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">extent</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>.
2350 </para>
2351 </para>
2352 </blockquote>
2353 </section>
2354 <section id="boost_typetraits.reference.floating_point_promotion"><indexterm type="class_name"><primary>floating_point_promotion</primary><secondary>floating_point_promotion</secondary></indexterm>
2355 <title><link linkend="boost_typetraits.reference.floating_point_promotion">
2356 floating_point_promotion</link></title>
2357 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2358 <phrase role="keyword">struct</phrase> <phrase role="identifier">floating_point_promotion</phrase>
2359 <phrase role="special">{</phrase>
2360 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
2361 <phrase role="special">};</phrase>
2362 </programlisting>
2363 <para>
2364 <emphasis role="bold">type:</emphasis> If floating point promotion can be
2365 applied to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>,
2366 then applies floating point promotion to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
2367 and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>,
2368 otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged.
2369 </para>
2370 <para>
2371 <emphasis role="bold">C++ Standard Reference:</emphasis> 4.6.
2372 </para>
2373 <para>
2374 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
2375 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">floating_point_promotion</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2376 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2377 </para>
2378 <table frame="all"> <title>Examples</title>
2379 <tgroup cols="2">
2380 <thead>
2381 <row>
2382 <entry>
2383 <para>
2384 Expression
2385 </para>
2386 </entry><entry>
2387 <para>
2388 Result Type
2389 </para>
2390 </entry>
2391 </row>
2392 </thead>
2393 <tbody>
2394 <row>
2395 <entry>
2396 <para>
2397 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">float</phrase>
2398 <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
2399 </para>
2400 </entry><entry>
2401 <para>
2402 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase></computeroutput>
2403 </para>
2404 </entry>
2405 </row>
2406 <row>
2407 <entry>
2408 <para>
2409 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">float</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
2410 </para>
2411 </entry><entry>
2412 <para>
2413 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">float</phrase><phrase role="special">&amp;</phrase></computeroutput>
2414 </para>
2415 </entry>
2416 </row>
2417 <row>
2418 <entry>
2419 <para>
2420 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">floating_point_promotion</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">short</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
2421 </para>
2422 </entry><entry>
2423 <para>
2424 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase></computeroutput>
2425 </para>
2426 </entry>
2427 </row>
2428 </tbody>
2429 </tgroup>
2430 </table>
2431 </section>
2432 <section id="boost_typetraits.reference.function_traits"><indexterm type="typedef_name"><primary>result_type</primary><secondary>function_traits</secondary></indexterm><indexterm><primary>function_traits</primary><secondary>result_type</secondary></indexterm><indexterm type="class_name"><primary>function_traits</primary><secondary>function_traits</secondary></indexterm>
2433 <title><link linkend="boost_typetraits.reference.function_traits"> function_traits</link></title>
2434
2435 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">F</phrase><phrase role="special">&gt;</phrase>
2436 <phrase role="keyword">struct</phrase> <phrase role="identifier">function_traits</phrase>
2437 <phrase role="special">{</phrase>
2438 <phrase role="keyword">static</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">arity</phrase> <phrase role="special">=</phrase> <replaceable>see-below</replaceable><phrase role="special">;</phrase>
2439 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">result_type</phrase><phrase role="special">;</phrase>
2440 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> arg<replaceable>N</replaceable>_type<phrase role="special">;</phrase>
2441 <phrase role="special">};</phrase>
2442 </programlisting>
2443 <para>
2444 The class template function_traits will only compile if:
2445 </para>
2446 <itemizedlist>
2447 <listitem>
2448 The compiler supports partial specialization of class templates.
2449 </listitem>
2450 <listitem>
2451 The template argument <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>
2452 is a <emphasis>function type</emphasis>, note that this <emphasis><emphasis role="bold">is not</emphasis></emphasis> the same thing as a <emphasis>pointer
2453 to a function</emphasis>.
2454 </listitem>
2455 </itemizedlist>
2456 <tip>
2457 <para>
2458 function_traits is intended to introspect only C++ functions of the form
2459 R (), R( A1 ), R ( A1, ... etc. ) and not function pointers or class member
2460 functions. To convert a function pointer type to a suitable type use <link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link>.
2461 </para>
2462 </tip>
2463 <table frame="all"> <title>Function Traits Members</title>
2464 <tgroup cols="2">
2465 <thead>
2466 <row>
2467 <entry>
2468 <para>
2469 Member
2470 </para>
2471 </entry><entry>
2472 <para>
2473 Description
2474 </para>
2475 </entry>
2476 </row>
2477 </thead>
2478 <tbody>
2479 <row>
2480 <entry>
2481 <para>
2482 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">F</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">arity</phrase></computeroutput>
2483 </para>
2484 </entry><entry>
2485 <para>
2486 An integral constant expression that gives the number of arguments
2487 accepted by the function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>.
2488 </para>
2489 </entry>
2490 </row>
2491 <row>
2492 <entry>
2493 <para>
2494 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">F</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">result_type</phrase></computeroutput>
2495 </para>
2496 </entry><entry>
2497 <para>
2498 The type returned by function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>.
2499 </para>
2500 </entry>
2501 </row>
2502 <row>
2503 <entry>
2504 <para>
2505 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">F</phrase><phrase role="special">&gt;::</phrase>arg<replaceable>N</replaceable>_type</computeroutput>
2506 </para>
2507 </entry><entry>
2508 <para>
2509 The <replaceable>N</replaceable>th argument type of function type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>,
2510 where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="number">1</phrase> <phrase role="special">&lt;=</phrase>
2511 <phrase role="identifier">N</phrase> <phrase role="special">&lt;=</phrase>
2512 <phrase role="identifier">arity</phrase></computeroutput> of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">F</phrase></computeroutput>.
2513 </para>
2514 </entry>
2515 </row>
2516 </tbody>
2517 </tgroup>
2518 </table> <table frame="all"> <title>Examples</title>
2519 <tgroup cols="2">
2520 <thead>
2521 <row>
2522 <entry>
2523 <para>
2524 Expression
2525 </para>
2526 </entry><entry>
2527 <para>
2528 Result
2529 </para>
2530 </entry>
2531 </row>
2532 </thead>
2533 <tbody>
2534 <row>
2535 <entry>
2536 <para>
2537 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">void</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">arity</phrase></computeroutput>
2538 </para>
2539 </entry><entry>
2540 <para>
2541 An integral constant expression that has the value 0.
2542 </para>
2543 </entry>
2544 </row>
2545 <row>
2546 <entry>
2547 <para>
2548 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">arity</phrase></computeroutput>
2549 </para>
2550 </entry><entry>
2551 <para>
2552 An integral constant expression that has the value 1.
2553 </para>
2554 </entry>
2555 </row>
2556 <row>
2557 <entry>
2558 <para>
2559 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)&gt;::</phrase><phrase role="identifier">arity</phrase></computeroutput>
2560 </para>
2561 </entry><entry>
2562 <para>
2563 An integral constant expression that has the value 4.
2564 </para>
2565 </entry>
2566 </row>
2567 <row>
2568 <entry>
2569 <para>
2570 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">void</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">result_type</phrase></computeroutput>
2571 </para>
2572 </entry><entry>
2573 <para>
2574 The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase></computeroutput>.
2575 </para>
2576 </entry>
2577 </row>
2578 <row>
2579 <entry>
2580 <para>
2581 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">result_type</phrase></computeroutput>
2582 </para>
2583 </entry><entry>
2584 <para>
2585 The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">long</phrase></computeroutput>.
2586 </para>
2587 </entry>
2588 </row>
2589 <row>
2590 <entry>
2591 <para>
2592 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">arg1_type</phrase></computeroutput>
2593 </para>
2594 </entry><entry>
2595 <para>
2596 The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>.
2597 </para>
2598 </entry>
2599 </row>
2600 <row>
2601 <entry>
2602 <para>
2603 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)&gt;::</phrase><phrase role="identifier">arg4_type</phrase></computeroutput>
2604 </para>
2605 </entry><entry>
2606 <para>
2607 The type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">void</phrase><phrase role="special">*</phrase></computeroutput>.
2608 </para>
2609 </entry>
2610 </row>
2611 <row>
2612 <entry>
2613 <para>
2614 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">long</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">void</phrase><phrase role="special">*)&gt;::</phrase><phrase role="identifier">arg5_type</phrase></computeroutput>
2615 </para>
2616 </entry><entry>
2617 <para>
2618 A compiler error: there is no <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">arg5_type</phrase></computeroutput>
2619 since there are only four arguments.
2620 </para>
2621 </entry>
2622 </row>
2623 <row>
2624 <entry>
2625 <para>
2626 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">function_traits</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">arity</phrase></computeroutput>
2627 </para>
2628 </entry><entry>
2629 <para>
2630 A compiler error: argument type is a <emphasis>function pointer</emphasis>,
2631 and not a <emphasis>function type</emphasis>.
2632 </para>
2633 </entry>
2634 </row>
2635 </tbody>
2636 </tgroup>
2637 </table>
2638 </section>
2639 <section id="boost_typetraits.reference.has_nothrow_assign"><indexterm type="class_name"><primary>has_nothrow_assign</primary><secondary>has_nothrow_assign</secondary></indexterm>
2640 <title><link linkend="boost_typetraits.reference.has_nothrow_assign"> has_nothrow_assign</link></title>
2641
2642 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2643 <phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_assign</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
2644 </programlisting>
2645 <para>
2646 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
2647 type with a non-throwing assignment-operator then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
2648 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
2649 Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete
2650 type.
2651 </para>
2652 <para>
2653 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
2654 does not support partial-specialization of class templates, then this template
2655 can not be used with function types.
2656 </para>
2657 <para>
2658 Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_assign</phrase></computeroutput>
2659 will never report that a class or struct has a non-throwing assignment-operator;
2660 this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual
2661 C++ 8 has the necessary compiler support to ensure that this trait "just
2662 works".
2663 </para>
2664 <para>
2665 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
2666 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_assign</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2667 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2668 </para>
2669 </section>
2670 <section id="boost_typetraits.reference.has_nothrow_constructor"><indexterm type="class_name"><primary>has_nothrow_default_constructor</primary><secondary>has_nothrow_constructor</secondary></indexterm><indexterm><primary>has_nothrow_constructor</primary><secondary>has_nothrow_default_constructor</secondary></indexterm><indexterm type="class_name"><primary>has_nothrow_constructor</primary><secondary>has_nothrow_constructor</secondary></indexterm>
2671 <title><link linkend="boost_typetraits.reference.has_nothrow_constructor">
2672 has_nothrow_constructor</link></title>
2673 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2674 <phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
2675
2676 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2677 <phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_default_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
2678 </programlisting>
2679 <para>
2680 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
2681 type with a non-throwing default-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
2682 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
2683 Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete
2684 type.
2685 </para>
2686 <para>
2687 These two traits are synonyms for each other.
2688 </para>
2689 <para>
2690 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
2691 does not support partial-specialization of class templates, then this template
2692 can not be used with function types.
2693 </para>
2694 <para>
2695 Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_constructor</phrase></computeroutput>
2696 will never report that a class or struct has a non-throwing default-constructor;
2697 this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual
2698 C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link>
2699 to ensure that this trait "just works".
2700 </para>
2701 <para>
2702 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
2703 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_constructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2704 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2705 </para>
2706 </section>
2707 <section id="boost_typetraits.reference.has_nothrow_copy"><indexterm type="class_name"><primary>has_nothrow_copy_constructor</primary><secondary>has_nothrow_copy</secondary></indexterm><indexterm><primary>has_nothrow_copy</primary><secondary>has_nothrow_copy_constructor</secondary></indexterm><indexterm type="class_name"><primary>has_nothrow_copy</primary><secondary>has_nothrow_copy</secondary></indexterm>
2708 <title><link linkend="boost_typetraits.reference.has_nothrow_copy"> has_nothrow_copy</link></title>
2709
2710 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2711 <phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_copy</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
2712
2713 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2714 <phrase role="keyword">struct</phrase> <phrase role="identifier">has_nothrow_copy_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
2715 </programlisting>
2716 <para>
2717 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
2718 type with a non-throwing copy-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
2719 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
2720 Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete
2721 type.
2722 </para>
2723 <para>
2724 These two traits are synonyms for each other.
2725 </para>
2726 <para>
2727 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
2728 does not support partial-specialization of class templates, then this template
2729 can not be used with function types.
2730 </para>
2731 <para>
2732 Without some (as yet unspecified) help from the compiler, <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_nothrow_copy</phrase></computeroutput>
2733 will never report that a class or struct has a non-throwing copy-constructor;
2734 this is always safe, if possibly sub-optimal. Currently (May 2005) only Visual
2735 C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link>
2736 to ensure that this trait "just works".
2737 </para>
2738 <para>
2739 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
2740 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_nothrow_copy</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2741 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2742 </para>
2743 </section>
2744 <section id="boost_typetraits.reference.has_nothrow_cp_cons">
2745 <title><link linkend="boost_typetraits.reference.has_nothrow_cp_cons"> has_nothrow_copy_constructor</link></title>
2746 <para>
2747 See <link linkend="boost_typetraits.reference.has_nothrow_copy">has_nothrow_copy</link>.
2748 </para>
2749 </section>
2750 <section id="boost_typetraits.reference.has_no_throw_def_cons">
2751 <title><link linkend="boost_typetraits.reference.has_no_throw_def_cons"> has_nothrow_default_constructor</link></title>
2752 <para>
2753 See <link linkend="boost_typetraits.reference.has_nothrow_constructor">has_nothrow_constructor</link>.
2754 </para>
2755 </section>
2756 <section id="boost_typetraits.reference.has_trivial_assign"><indexterm type="class_name"><primary>has_trivial_assign</primary><secondary>has_trivial_assign</secondary></indexterm>
2757 <title><link linkend="boost_typetraits.reference.has_trivial_assign"> has_trivial_assign</link></title>
2758
2759 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2760 <phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_assign</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
2761 </programlisting>
2762 <para>
2763 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
2764 type with a trivial assignment-operator then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
2765 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
2766 </para>
2767 <para>
2768 If a type has a trivial assignment-operator then the operator has the same
2769 effect as copying the bits of one object to the other: calls to the operator
2770 can be safely replaced with a call to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>.
2771 </para>
2772 <para>
2773 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
2774 does not support partial-specialization of class templates, then this template
2775 can not be used with function types.
2776 </para>
2777 <para>
2778 Without some (as yet unspecified) help from the compiler, has_trivial_assign
2779 will never report that a user-defined class or struct has a trivial constructor;
2780 this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW
2781 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link>
2782 to detect user-defined classes with trivial constructors.
2783 </para>
2784 <para>
2785 <emphasis role="bold">C++ Standard Reference:</emphasis> 12.8p11.
2786 </para>
2787 <para>
2788 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
2789 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_assign</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2790 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2791 </para>
2792 <para>
2793 <emphasis role="bold">Examples:</emphasis>
2794 </para>
2795 <blockquote>
2796 <para>
2797 <para>
2798 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput>
2799 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
2800 </para>
2801 </para>
2802 </blockquote>
2803 <blockquote>
2804 <para>
2805 <para>
2806 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
2807 </para>
2808 </para>
2809 </blockquote>
2810 <blockquote>
2811 <para>
2812 <para>
2813 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
2814 that evaluates to <emphasis>true</emphasis>.
2815 </para>
2816 </para>
2817 </blockquote>
2818 <blockquote>
2819 <para>
2820 <para>
2821 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
2822 that evaluates to <emphasis>false</emphasis>.
2823 </para>
2824 </para>
2825 </blockquote>
2826 <blockquote>
2827 <para>
2828 <para>
2829 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_assign</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
2830 </para>
2831 </para>
2832 </blockquote>
2833 </section>
2834 <section id="boost_typetraits.reference.has_trivial_constructor"><indexterm type="class_name"><primary>has_trivial_default_constructor</primary><secondary>has_trivial_constructor</secondary></indexterm><indexterm><primary>has_trivial_constructor</primary><secondary>has_trivial_default_constructor</secondary></indexterm>
2835 <title><link linkend="boost_typetraits.reference.has_trivial_constructor">
2836 has_trivial_constructor</link></title>
2837 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2838 <phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
2839
2840 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2841 <phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_default_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
2842 </programlisting>
2843 <para>
2844 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
2845 type with a trivial default-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
2846 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
2847 </para>
2848 <para>
2849 These two traits are synonyms for each other.
2850 </para>
2851 <para>
2852 If a type has a trivial default-constructor then the constructor have no
2853 effect: calls to the constructor can be safely omitted. Note that using meta-programming
2854 to omit a call to a single trivial-constructor call is of no benefit whatsoever.
2855 However, if loops and/or exception handling code can also be omitted, then
2856 some benefit in terms of code size and speed can be obtained.
2857 </para>
2858 <para>
2859 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
2860 does not support partial-specialization of class templates, then this template
2861 can not be used with function types.
2862 </para>
2863 <para>
2864 Without some (as yet unspecified) help from the compiler, has_trivial_constructor
2865 will never report that a user-defined class or struct has a trivial constructor;
2866 this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW
2867 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link>
2868 to detect user-defined classes with trivial constructors.
2869 </para>
2870 <para>
2871 <emphasis role="bold">C++ Standard Reference:</emphasis> 12.1p6.
2872 </para>
2873 <para>
2874 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
2875 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2876 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2877 </para>
2878 <para>
2879 <emphasis role="bold">Examples:</emphasis>
2880 </para>
2881 <blockquote>
2882 <para>
2883 <para>
2884 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
2885 </para>
2886 </para>
2887 </blockquote>
2888 <blockquote>
2889 <para>
2890 <para>
2891 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
2892 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
2893 </para>
2894 </para>
2895 </blockquote>
2896 <blockquote>
2897 <para>
2898 <para>
2899 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
2900 is an integral constant expression that evaluates to <emphasis>true</emphasis>.
2901 </para>
2902 </para>
2903 </blockquote>
2904 <blockquote>
2905 <para>
2906 <para>
2907 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
2908 is an integral constant expression that evaluates to <emphasis>false</emphasis>.
2909 </para>
2910 </para>
2911 </blockquote>
2912 <blockquote>
2913 <para>
2914 <para>
2915 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput>
2916 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
2917 </para>
2918 </para>
2919 </blockquote>
2920 </section>
2921 <section id="boost_typetraits.reference.has_trivial_copy"><indexterm type="class_name"><primary>has_trivial_copy_constructor</primary><secondary>has_trivial_copy</secondary></indexterm><indexterm><primary>has_trivial_copy</primary><secondary>has_trivial_copy_constructor</secondary></indexterm><indexterm type="class_name"><primary>has_trivial_copy</primary><secondary>has_trivial_copy</secondary></indexterm>
2922 <title><link linkend="boost_typetraits.reference.has_trivial_copy"> has_trivial_copy</link></title>
2923
2924 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2925 <phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_copy</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
2926
2927 <phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
2928 <phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_copy_constructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
2929 </programlisting>
2930 <para>
2931 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
2932 type with a trivial copy-constructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
2933 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
2934 </para>
2935 <para>
2936 These two traits are synonyms for each other.
2937 </para>
2938 <para>
2939 If a type has a trivial copy-constructor then the constructor has the same
2940 effect as copying the bits of one object to the other: calls to the constructor
2941 can be safely replaced with a call to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">memcpy</phrase></computeroutput>.
2942 </para>
2943 <para>
2944 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
2945 does not support partial-specialization of class templates, then this template
2946 can not be used with function types.
2947 </para>
2948 <para>
2949 Without some (as yet unspecified) help from the compiler, has_trivial_copy
2950 will never report that a user-defined class or struct has a trivial constructor;
2951 this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW
2952 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link>
2953 to detect user-defined classes with trivial constructors.
2954 </para>
2955 <para>
2956 <emphasis role="bold">C++ Standard Reference:</emphasis> 12.8p6.
2957 </para>
2958 <para>
2959 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
2960 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_copy</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2961 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
2962 </para>
2963 <para>
2964 <emphasis role="bold">Examples:</emphasis>
2965 </para>
2966 <blockquote>
2967 <para>
2968 <para>
2969 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput>
2970 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
2971 </para>
2972 </para>
2973 </blockquote>
2974 <blockquote>
2975 <para>
2976 <para>
2977 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
2978 </para>
2979 </para>
2980 </blockquote>
2981 <blockquote>
2982 <para>
2983 <para>
2984 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
2985 that evaluates to <emphasis>true</emphasis>.
2986 </para>
2987 </para>
2988 </blockquote>
2989 <blockquote>
2990 <para>
2991 <para>
2992 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
2993 that evaluates to <emphasis>false</emphasis>.
2994 </para>
2995 </para>
2996 </blockquote>
2997 <blockquote>
2998 <para>
2999 <para>
3000 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_copy</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
3001 </para>
3002 </para>
3003 </blockquote>
3004 </section>
3005 <section id="boost_typetraits.reference.has_trivial_cp_cons">
3006 <title><link linkend="boost_typetraits.reference.has_trivial_cp_cons"> has_trivial_copy_constructor</link></title>
3007 <para>
3008 See <link linkend="boost_typetraits.reference.has_trivial_copy">has_trivial_copy</link>.
3009 </para>
3010 </section>
3011 <section id="boost_typetraits.reference.has_trivial_def_cons">
3012 <title><link linkend="boost_typetraits.reference.has_trivial_def_cons"> has_trivial_default_constructor</link></title>
3013 <para>
3014 See <link linkend="boost_typetraits.reference.has_trivial_constructor">has_trivial_constructor</link>.
3015 </para>
3016 </section>
3017 <section id="boost_typetraits.reference.has_trivial_destructor"><indexterm type="class_name"><primary>has_trivial_destructor</primary><secondary>has_trivial_destructor</secondary></indexterm>
3018 <title><link linkend="boost_typetraits.reference.has_trivial_destructor"> has_trivial_destructor</link></title>
3019
3020 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
3021 <phrase role="keyword">struct</phrase> <phrase role="identifier">has_trivial_destructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3022 </programlisting>
3023 <para>
3024 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
3025 type with a trivial destructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
3026 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
3027 </para>
3028 <para>
3029 If a type has a trivial destructor then the destructor has no effect: calls
3030 to the destructor can be safely omitted. Note that using meta-programming
3031 to omit a call to a single trivial-constructor call is of no benefit whatsoever.
3032 However, if loops and/or exception handling code can also be omitted, then
3033 some benefit in terms of code size and speed can be obtained.
3034 </para>
3035 <para>
3036 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
3037 does not support partial-specialization of class templates, then this template
3038 can not be used with function types.
3039 </para>
3040 <para>
3041 Without some (as yet unspecified) help from the compiler, has_trivial_destructor
3042 will never report that a user-defined class or struct has a trivial destructor;
3043 this is always safe, if possibly sub-optimal. Currently (May 2005) only MWCW
3044 9 and Visual C++ 8 have the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link>
3045 to detect user-defined classes with trivial constructors.
3046 </para>
3047 <para>
3048 <emphasis role="bold">C++ Standard Reference:</emphasis> 12.4p3.
3049 </para>
3050 <para>
3051 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3052 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3053 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3054 </para>
3055 <para>
3056 <emphasis role="bold">Examples:</emphasis>
3057 </para>
3058 <blockquote>
3059 <para>
3060 <para>
3061 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3062 </para>
3063 </para>
3064 </blockquote>
3065 <blockquote>
3066 <para>
3067 <para>
3068 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
3069 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3070 </para>
3071 </para>
3072 </blockquote>
3073 <blockquote>
3074 <para>
3075 <para>
3076 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
3077 is an integral constant expression that evaluates to <emphasis>true</emphasis>.
3078 </para>
3079 </para>
3080 </blockquote>
3081 <blockquote>
3082 <para>
3083 <para>
3084 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
3085 is an integral constant expression that evaluates to <emphasis>false</emphasis>.
3086 </para>
3087 </para>
3088 </blockquote>
3089 <blockquote>
3090 <para>
3091 <para>
3092 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput>
3093 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
3094 </para>
3095 </para>
3096 </blockquote>
3097 </section>
3098 <section id="boost_typetraits.reference.has_virtual_destructor"><indexterm type="class_name"><primary>has_virtual_destructor</primary><secondary>has_virtual_destructor</secondary></indexterm>
3099 <title><link linkend="boost_typetraits.reference.has_virtual_destructor"> has_virtual_destructor</link></title>
3100
3101 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
3102 <phrase role="keyword">struct</phrase> <phrase role="identifier">has_virtual_destructor</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3103 </programlisting>
3104 <para>
3105 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
3106 type with a virtual destructor then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
3107 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
3108 </para>
3109 <para>
3110 <emphasis role="bold">Compiler Compatibility:</emphasis> This trait is provided
3111 for completeness, since it's part of the Technical Report on C++ Library
3112 Extensions. However, there is currently no way to portably implement this
3113 trait. The default version provided always inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>,
3114 and has to be explicitly specialized for types with virtual destructors unless
3115 the compiler used has compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link>
3116 that enable the trait to do the right thing: currently (May 2005) only Visual
3117 C++ 8 and GCC-4.3 have the necessary <link linkend="boost_typetraits.intrinsics">intrinsics</link>.
3118 </para>
3119 <para>
3120 <emphasis role="bold">C++ Standard Reference:</emphasis> 12.4.
3121 </para>
3122 <para>
3123 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3124 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">has_virtual_destructor</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3125 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3126 </para>
3127 </section>
3128 <section id="boost_typetraits.reference.integral_constant"><indexterm type="typedef_name"><primary>value_type</primary><secondary>integral_constant</secondary></indexterm><indexterm><primary>integral_constant</primary><secondary>value_type</secondary></indexterm><indexterm type="typedef_name"><primary>true_type</primary><secondary>integral_constant</secondary></indexterm><indexterm><primary>integral_constant</primary><secondary>true_type</secondary></indexterm><indexterm type="class_name"><primary>integral_constant</primary><secondary>integral_constant</secondary></indexterm><indexterm type="typedef_name"><primary>false_type</primary><secondary>integral_constant</secondary></indexterm><indexterm><primary>integral_constant</primary><secondary>false_type</secondary></indexterm>
3129 <title><link linkend="boost_typetraits.reference.integral_constant"> integral_constant</link></title>
3130
3131 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">val</phrase><phrase role="special">&gt;</phrase>
3132 <phrase role="keyword">struct</phrase> <phrase role="identifier">integral_constant</phrase>
3133 <phrase role="special">{</phrase>
3134 <phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="identifier">val</phrase><phrase role="special">&gt;</phrase> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
3135 <phrase role="keyword">typedef</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">value_type</phrase><phrase role="special">;</phrase>
3136 <phrase role="keyword">static</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">T</phrase> <phrase role="identifier">value</phrase> <phrase role="special">=</phrase> <phrase role="identifier">val</phrase><phrase role="special">;</phrase>
3137 <phrase role="special">};</phrase>
3138
3139 <phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="keyword">true</phrase><phrase role="special">&gt;</phrase> <phrase role="identifier">true_type</phrase><phrase role="special">;</phrase>
3140 <phrase role="keyword">typedef</phrase> <phrase role="identifier">integral_constant</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">bool</phrase><phrase role="special">,</phrase> <phrase role="keyword">false</phrase><phrase role="special">&gt;</phrase> <phrase role="identifier">false_type</phrase><phrase role="special">;</phrase>
3141 </programlisting>
3142 <para>
3143 Class template <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_constant</phrase></computeroutput>
3144 is the common base class for all the value-based type traits. The two typedef's
3145 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">true_type</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">false_type</phrase></computeroutput> are provided for convenience:
3146 most of the value traits are Boolean properties and so will inherit from
3147 one of these.
3148 </para>
3149 </section>
3150 <section id="boost_typetraits.reference.integral_promotion"><indexterm type="class_name"><primary>integral_promotion</primary><secondary>integral_promotion</secondary></indexterm>
3151 <title><link linkend="boost_typetraits.reference.integral_promotion"> integral_promotion</link></title>
3152
3153 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
3154 <phrase role="keyword">struct</phrase> <phrase role="identifier">integral_promotion</phrase>
3155 <phrase role="special">{</phrase>
3156 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
3157 <phrase role="special">};</phrase>
3158 </programlisting>
3159 <para>
3160 <emphasis role="bold">type:</emphasis> If integral promotion can be applied
3161 to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>, then
3162 applies integral promotion to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
3163 and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>,
3164 otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged.
3165 </para>
3166 <para>
3167 <emphasis role="bold">C++ Standard Reference:</emphasis> 4.5 except 4.5/3
3168 (integral bit-field).
3169 </para>
3170 <para>
3171 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3172 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">integral_promotion</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3173 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3174 </para>
3175 <table frame="all"> <title>Examples</title>
3176 <tgroup cols="2">
3177 <thead>
3178 <row>
3179 <entry>
3180 <para>
3181 Expression
3182 </para>
3183 </entry><entry>
3184 <para>
3185 Result Type
3186 </para>
3187 </entry>
3188 </row>
3189 </thead>
3190 <tbody>
3191 <row>
3192 <entry>
3193 <para>
3194 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">short</phrase>
3195 <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
3196 </para>
3197 </entry><entry>
3198 <para>
3199 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput>
3200 </para>
3201 </entry>
3202 </row>
3203 <row>
3204 <entry>
3205 <para>
3206 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">short</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
3207 </para>
3208 </entry><entry>
3209 <para>
3210 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase><phrase role="special">&amp;</phrase></computeroutput>
3211 </para>
3212 </entry>
3213 </row>
3214 <row>
3215 <entry>
3216 <para>
3217 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">integral_promotion</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">enum</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">float_round_style</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
3218 </para>
3219 </entry><entry>
3220 <para>
3221 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
3222 </para>
3223 </entry>
3224 </row>
3225 </tbody>
3226 </tgroup>
3227 </table>
3228 </section>
3229 <section id="boost_typetraits.reference.is_abstract"><indexterm type="class_name"><primary>is_abstract</primary><secondary>is_abstract</secondary></indexterm>
3230 <title><link linkend="boost_typetraits.reference.is_abstract"> is_abstract</link></title>
3231
3232 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
3233 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_abstract</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3234 </programlisting>
3235 <para>
3236 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
3237 abstract type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
3238 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
3239 </para>
3240 <para>
3241 <emphasis role="bold">C++ Standard Reference:</emphasis> 10.3.
3242 </para>
3243 <para>
3244 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3245 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_abstract</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3246 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3247 </para>
3248 <para>
3249 <emphasis role="bold">Compiler Compatibility:</emphasis> The compiler must
3250 support DR337 (as of April 2005: GCC 3.4, VC++ 7.1 (and later), Intel C++
3251 7 (and later), and Comeau 4.3.2). Otherwise behaves the same as <link linkend="boost_typetraits.reference.is_polymorphic">is_polymorphic</link>;
3252 this is the "safe fallback position" for which polymorphic types
3253 are always regarded as potentially abstract. The macro BOOST_NO_IS_ABSTRACT
3254 is used to signify that the implementation is buggy, users should check for
3255 this in their own code if the "safe fallback" is not suitable for
3256 their particular use-case.
3257 </para>
3258 <para>
3259 <emphasis role="bold">Examples:</emphasis>
3260 </para>
3261 <blockquote>
3262 <para>
3263 <para>
3264 Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">abc</phrase><phrase role="special">{</phrase> <phrase role="keyword">virtual</phrase> <phrase role="special">~</phrase><phrase role="identifier">abc</phrase><phrase role="special">()</phrase> <phrase role="special">=</phrase> <phrase role="number">0</phrase><phrase role="special">;</phrase> <phrase role="special">};</phrase></computeroutput>
3265 </para>
3266 </para>
3267 </blockquote>
3268 <blockquote>
3269 <para>
3270 <para>
3271 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">abc</phrase><phrase role="special">&gt;</phrase></computeroutput>
3272 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3273 </para>
3274 </para>
3275 </blockquote>
3276 <blockquote>
3277 <para>
3278 <para>
3279 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">abc</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3280 </para>
3281 </para>
3282 </blockquote>
3283 <blockquote>
3284 <para>
3285 <para>
3286 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">abc</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
3287 is an integral constant expression that evaluates to <emphasis>true</emphasis>.
3288 </para>
3289 </para>
3290 </blockquote>
3291 <blockquote>
3292 <para>
3293 <para>
3294 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_abstract</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
3295 </para>
3296 </para>
3297 </blockquote>
3298 </section>
3299 <section id="boost_typetraits.reference.is_arithmetic"><indexterm type="class_name"><primary>is_arithmetic</primary><secondary>is_arithmetic</secondary></indexterm>
3300 <title><link linkend="boost_typetraits.reference.is_arithmetic"> is_arithmetic</link></title>
3301
3302 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
3303 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_arithmetic</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3304 </programlisting>
3305 <para>
3306 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
3307 arithmetic type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
3308 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
3309 Arithmetic types include integral and floating point types (see also <link linkend="boost_typetraits.reference.is_integral">is_integral</link> and
3310 <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link>).
3311 </para>
3312 <para>
3313 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p8.
3314 </para>
3315 <para>
3316 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3317 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_arithmetic</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3318 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3319 </para>
3320 <para>
3321 <emphasis role="bold">Examples:</emphasis>
3322 </para>
3323 <blockquote>
3324 <para>
3325 <para>
3326 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput>
3327 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3328 </para>
3329 </para>
3330 </blockquote>
3331 <blockquote>
3332 <para>
3333 <para>
3334 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3335 </para>
3336 </para>
3337 </blockquote>
3338 <blockquote>
3339 <para>
3340 <para>
3341 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">double</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3342 that evaluates to <emphasis>true</emphasis>.
3343 </para>
3344 </para>
3345 </blockquote>
3346 <blockquote>
3347 <para>
3348 <para>
3349 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_arithmetic</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
3350 </para>
3351 </para>
3352 </blockquote>
3353 </section>
3354 <section id="boost_typetraits.reference.is_array"><indexterm type="class_name"><primary>is_array</primary><secondary>is_array</secondary></indexterm>
3355 <title><link linkend="boost_typetraits.reference.is_array"> is_array</link></title>
3356
3357 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
3358 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_array</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3359 </programlisting>
3360 <para>
3361 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
3362 array type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
3363 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
3364 </para>
3365 <para>
3366 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.4.
3367 </para>
3368 <para>
3369 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3370 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_array</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3371 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3372 </para>
3373 <para>
3374 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
3375 does not support partial-specialization of class templates, then this template
3376 can give the wrong result with function types.
3377 </para>
3378 <para>
3379 <emphasis role="bold">Examples:</emphasis>
3380 </para>
3381 <blockquote>
3382 <para>
3383 <para>
3384 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]&gt;</phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3385 </para>
3386 </para>
3387 </blockquote>
3388 <blockquote>
3389 <para>
3390 <para>
3391 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
3392 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3393 </para>
3394 </para>
3395 </blockquote>
3396 <blockquote>
3397 <para>
3398 <para>
3399 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">double</phrase><phrase role="special">[]&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3400 that evaluates to <emphasis>true</emphasis>.
3401 </para>
3402 </para>
3403 </blockquote>
3404 <blockquote>
3405 <para>
3406 <para>
3407 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_array</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
3408 </para>
3409 </para>
3410 </blockquote>
3411 </section>
3412 <section id="boost_typetraits.reference.is_base_of"><indexterm type="class_name"><primary>is_base_of</primary><secondary>is_base_of</secondary></indexterm>
3413 <title><link linkend="boost_typetraits.reference.is_base_of"> is_base_of</link></title>
3414
3415 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">&gt;</phrase>
3416 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_base_of</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3417 </programlisting>
3418 <para>
3419 <emphasis role="bold">Inherits:</emphasis> If Base is base class of type
3420 Derived or if both types are the same then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
3421 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
3422 </para>
3423 <para>
3424 This template will detect non-public base classes, and ambiguous base classes.
3425 </para>
3426 <para>
3427 Note that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">X</phrase><phrase role="special">,</phrase><phrase role="identifier">X</phrase><phrase role="special">&gt;</phrase></computeroutput> will always inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>.
3428 <emphasis role="bold">This is the case even if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">X</phrase></computeroutput>
3429 is not a class type</emphasis>. This is a change in behaviour from Boost-1.33
3430 in order to track the Technical Report on C++ Library Extensions.
3431 </para>
3432 <para>
3433 Types <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> and <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput> must not be incomplete types.
3434 </para>
3435 <para>
3436 <emphasis role="bold">C++ Standard Reference:</emphasis> 10.
3437 </para>
3438 <para>
3439 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3440 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_base_of</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3441 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3442 </para>
3443 <para>
3444 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
3445 does not support partial-specialization of class templates, then this template
3446 can not be used with function types. There are some older compilers which
3447 will produce compiler errors if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput>
3448 is a private base class of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput>,
3449 or if <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Base</phrase></computeroutput> is an ambiguous
3450 base of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Derived</phrase></computeroutput>. These compilers
3451 include Borland C++, older versions of Sun Forte C++, Digital Mars C++, and
3452 older versions of EDG based compilers.
3453 </para>
3454 <para>
3455 <emphasis role="bold">Examples:</emphasis>
3456 </para>
3457 <blockquote>
3458 <para>
3459 <para>
3460 Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="keyword">class</phrase> <phrase role="identifier">Base</phrase><phrase role="special">{};</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">Derived</phrase> <phrase role="special">:</phrase>
3461 <phrase role="keyword">public</phrase> <phrase role="identifier">Base</phrase><phrase role="special">{};</phrase></computeroutput>
3462 </para>
3463 </para>
3464 </blockquote>
3465 <blockquote>
3466 <para>
3467 <para>
3468 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">&gt;</phrase></computeroutput>
3469 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3470 </para>
3471 </para>
3472 </blockquote>
3473 <blockquote>
3474 <para>
3475 <para>
3476 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3477 </para>
3478 </para>
3479 </blockquote>
3480 <blockquote>
3481 <para>
3482 <para>
3483 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3484 that evaluates to <emphasis>true</emphasis>.
3485 </para>
3486 </para>
3487 </blockquote>
3488 <blockquote>
3489 <para>
3490 <para>
3491 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Derived</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3492 that evaluates to <emphasis>true</emphasis>.
3493 </para>
3494 </para>
3495 </blockquote>
3496 <blockquote>
3497 <para>
3498 <para>
3499 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">Base</phrase><phrase role="special">,</phrase> <phrase role="identifier">Base</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3500 that evaluates to <emphasis>true</emphasis>: a class is regarded as it's
3501 own base.
3502 </para>
3503 </para>
3504 </blockquote>
3505 <blockquote>
3506 <para>
3507 <para>
3508 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_base_of</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
3509 </para>
3510 </para>
3511 </blockquote>
3512 </section>
3513 <section id="boost_typetraits.reference.is_class"><indexterm type="class_name"><primary>is_class</primary><secondary>is_class</secondary></indexterm>
3514 <title><link linkend="boost_typetraits.reference.is_class"> is_class</link></title>
3515
3516 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
3517 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_class</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3518 </programlisting>
3519 <para>
3520 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
3521 class type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
3522 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
3523 </para>
3524 <para>
3525 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 9.2.
3526 </para>
3527 <para>
3528 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3529 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_class</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3530 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3531 </para>
3532 <para>
3533 <emphasis role="bold">Compiler Compatibility:</emphasis> Without (some as
3534 yet unspecified) help from the compiler, we cannot distinguish between union
3535 and class types, as a result this type will erroneously inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link> for
3536 union types. See also <link linkend="boost_typetraits.reference.is_union">is_union</link>.
3537 Currently (May 2005) only Visual C++ 8 has the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link>
3538 to correctly identify union types, and therefore make is_class function correctly.
3539 </para>
3540 <para>
3541 <emphasis role="bold">Examples:</emphasis>
3542 </para>
3543 <blockquote>
3544 <para>
3545 <para>
3546 Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">MyClass</phrase><phrase role="special">;</phrase></computeroutput> then:
3547 </para>
3548 </para>
3549 </blockquote>
3550 <blockquote>
3551 <para>
3552 <para>
3553 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&gt;</phrase></computeroutput>
3554 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3555 </para>
3556 </para>
3557 </blockquote>
3558 <blockquote>
3559 <para>
3560 <para>
3561 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">MyClass</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
3562 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3563 </para>
3564 </para>
3565 </blockquote>
3566 <blockquote>
3567 <para>
3568 <para>
3569 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3570 that evaluates to <emphasis>true</emphasis>.
3571 </para>
3572 </para>
3573 </blockquote>
3574 <blockquote>
3575 <para>
3576 <para>
3577 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3578 that evaluates to <emphasis>false</emphasis>.
3579 </para>
3580 </para>
3581 </blockquote>
3582 <blockquote>
3583 <para>
3584 <para>
3585 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3586 that evaluates to <emphasis>false</emphasis>.
3587 </para>
3588 </para>
3589 </blockquote>
3590 <blockquote>
3591 <para>
3592 <para>
3593 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_class</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
3594 </para>
3595 </para>
3596 </blockquote>
3597 </section>
3598 <section id="boost_typetraits.reference.is_complex"><indexterm type="class_name"><primary>is_complex</primary><secondary>is_complex</secondary></indexterm>
3599 <title><link linkend="boost_typetraits.reference.is_complex"> is_complex</link></title>
3600
3601 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
3602 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_complex</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3603 </programlisting>
3604 <para>
3605 <emphasis role="bold">Inherits:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
3606 is a complex number type then true (of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">complex</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">U</phrase><phrase role="special">&gt;</phrase></computeroutput>
3607 for some type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">U</phrase></computeroutput>), otherwise
3608 false.
3609 </para>
3610 <para>
3611 <emphasis role="bold">C++ Standard Reference:</emphasis> 26.2.
3612 </para>
3613 <para>
3614 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3615 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_complex</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3616 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3617 </para>
3618 </section>
3619 <section id="boost_typetraits.reference.is_compound"><indexterm type="class_name"><primary>is_compound</primary><secondary>is_compound</secondary></indexterm>
3620 <title><link linkend="boost_typetraits.reference.is_compound"> is_compound</link></title>
3621
3622 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
3623 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_compound</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3624 </programlisting>
3625 <para>
3626 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
3627 compound type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
3628 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
3629 Any type that is not a fundamental type is a compound type (see also <link linkend="boost_typetraits.reference.is_fundamental">is_fundamental</link>).
3630 </para>
3631 <para>
3632 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2.
3633 </para>
3634 <para>
3635 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3636 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_compound</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3637 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3638 </para>
3639 <para>
3640 <emphasis role="bold">Examples:</emphasis>
3641 </para>
3642 <blockquote>
3643 <para>
3644 <para>
3645 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&gt;</phrase></computeroutput>
3646 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3647 </para>
3648 </para>
3649 </blockquote>
3650 <blockquote>
3651 <para>
3652 <para>
3653 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">MyEnum</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3654 </para>
3655 </para>
3656 </blockquote>
3657 <blockquote>
3658 <para>
3659 <para>
3660 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3661 that evaluates to <emphasis>true</emphasis>.
3662 </para>
3663 </para>
3664 </blockquote>
3665 <blockquote>
3666 <para>
3667 <para>
3668 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3669 that evaluates to <emphasis>true</emphasis>.
3670 </para>
3671 </para>
3672 </blockquote>
3673 <blockquote>
3674 <para>
3675 <para>
3676 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3677 that evaluates to <emphasis>false</emphasis>.
3678 </para>
3679 </para>
3680 </blockquote>
3681 <blockquote>
3682 <para>
3683 <para>
3684 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_compound</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
3685 </para>
3686 </para>
3687 </blockquote>
3688 </section>
3689 <section id="boost_typetraits.reference.is_const"><indexterm type="class_name"><primary>is_const</primary><secondary>is_const</secondary></indexterm>
3690 <title><link linkend="boost_typetraits.reference.is_const"> is_const</link></title>
3691
3692 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
3693 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_const</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3694 </programlisting>
3695 <para>
3696 <emphasis role="bold">Inherits:</emphasis> If T is a (top level) const-qualified
3697 type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
3698 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
3699 </para>
3700 <para>
3701 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3.
3702 </para>
3703 <para>
3704 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3705 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3706 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3707 </para>
3708 <para>
3709 <emphasis role="bold">Examples:</emphasis>
3710 </para>
3711 <blockquote>
3712 <para>
3713 <para>
3714 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;</phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3715 </para>
3716 </para>
3717 </blockquote>
3718 <blockquote>
3719 <para>
3720 <para>
3721 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3722 </para>
3723 </para>
3724 </blockquote>
3725 <blockquote>
3726 <para>
3727 <para>
3728 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3729 that evaluates to <emphasis>true</emphasis>.
3730 </para>
3731 </para>
3732 </blockquote>
3733 <blockquote>
3734 <para>
3735 <para>
3736 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
3737 is an integral constant expression that evaluates to <emphasis>false</emphasis>:
3738 the const-qualifier is not at the top level in this case.
3739 </para>
3740 </para>
3741 </blockquote>
3742 <blockquote>
3743 <para>
3744 <para>
3745 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
3746 is an integral constant expression that evaluates to <emphasis>false</emphasis>:
3747 the const-qualifier is not at the top level in this case.
3748 </para>
3749 </para>
3750 </blockquote>
3751 <blockquote>
3752 <para>
3753 <para>
3754 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3755 that evaluates to <emphasis>false</emphasis>.
3756 </para>
3757 </para>
3758 </blockquote>
3759 <blockquote>
3760 <para>
3761 <para>
3762 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_const</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
3763 </para>
3764 </para>
3765 </blockquote>
3766 </section>
3767 <section id="boost_typetraits.reference.is_convertible"><indexterm type="class_name"><primary>is_convertible</primary><secondary>is_convertible</secondary></indexterm>
3768 <title><link linkend="boost_typetraits.reference.is_convertible"> is_convertible</link></title>
3769
3770 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">To</phrase><phrase role="special">&gt;</phrase>
3771 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_convertible</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3772 </programlisting>
3773 <para>
3774 <emphasis role="bold">Inherits:</emphasis> If an imaginary lvalue of type
3775 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">From</phrase></computeroutput> is convertible to type
3776 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput> then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
3777 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
3778 </para>
3779 <para>
3780 Type From must not be an incomplete type.
3781 </para>
3782 <para>
3783 Type To must not be an incomplete, or function type.
3784 </para>
3785 <para>
3786 No types are considered to be convertible to array types or abstract-class
3787 types.
3788 </para>
3789 <para>
3790 This template can not detect whether a converting-constructor is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">public</phrase></computeroutput> or not: if type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput>
3791 has a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">private</phrase></computeroutput> converting constructor
3792 from type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">From</phrase></computeroutput> then instantiating
3793 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">From</phrase><phrase role="special">,</phrase> <phrase role="identifier">To</phrase><phrase role="special">&gt;</phrase></computeroutput>
3794 will produce a compiler error. For this reason <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase></computeroutput>
3795 can not be used to determine whether a type has a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">public</phrase></computeroutput>
3796 copy-constructor or not.
3797 </para>
3798 <para>
3799 This template will also produce compiler errors if the conversion is ambiguous,
3800 for example:
3801 </para>
3802
3803 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">struct</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase>
3804 <phrase role="keyword">struct</phrase> <phrase role="identifier">B</phrase> <phrase role="special">:</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase>
3805 <phrase role="keyword">struct</phrase> <phrase role="identifier">C</phrase> <phrase role="special">:</phrase> <phrase role="identifier">A</phrase> <phrase role="special">{};</phrase>
3806 <phrase role="keyword">struct</phrase> <phrase role="identifier">D</phrase> <phrase role="special">:</phrase> <phrase role="identifier">B</phrase><phrase role="special">,</phrase> <phrase role="identifier">C</phrase> <phrase role="special">{};</phrase>
3807 <phrase role="comment">// This produces a compiler error, the conversion is ambiguous:
3808 </phrase><phrase role="keyword">bool</phrase> <phrase role="keyword">const</phrase> <phrase role="identifier">y</phrase> <phrase role="special">=</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_convertible</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">D</phrase><phrase role="special">*,</phrase><phrase role="identifier">A</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">value</phrase><phrase role="special">;</phrase>
3809 </programlisting>
3810 <para>
3811 <emphasis role="bold">C++ Standard Reference:</emphasis> 4 and 8.5.
3812 </para>
3813 <para>
3814 <emphasis role="bold">Compiler Compatibility:</emphasis> This template is
3815 currently broken with Borland C++ Builder 5 (and earlier), for constructor-based
3816 conversions, and for the Metrowerks 7 (and earlier) compiler in all cases.
3817 If the compiler does not support <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_abstract">is_abstract</link></computeroutput>,
3818 then the template parameter <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">To</phrase></computeroutput>
3819 must not be an abstract type.
3820 </para>
3821 <para>
3822 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3823 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_convertible</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3824 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3825 </para>
3826 <para>
3827 <emphasis role="bold">Examples:</emphasis>
3828 </para>
3829 <blockquote>
3830 <para>
3831 <para>
3832 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">&gt;</phrase></computeroutput>
3833 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3834 </para>
3835 </para>
3836 </blockquote>
3837 <blockquote>
3838 <para>
3839 <para>
3840 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">double</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
3841 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3842 </para>
3843 </para>
3844 </blockquote>
3845 <blockquote>
3846 <para>
3847 <para>
3848 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3849 that evaluates to <emphasis>true</emphasis>.
3850 </para>
3851 </para>
3852 </blockquote>
3853 <blockquote>
3854 <para>
3855 <para>
3856 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*,</phrase> <phrase role="keyword">int</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
3857 is an integral constant expression that evaluates to <emphasis>false</emphasis>:
3858 the conversion would require a <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const_cast</phrase></computeroutput>.
3859 </para>
3860 </para>
3861 </blockquote>
3862 <blockquote>
3863 <para>
3864 <para>
3865 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;,</phrase> <phrase role="keyword">long</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
3866 is an integral constant expression that evaluates to <emphasis>true</emphasis>.
3867 </para>
3868 </para>
3869 </blockquote>
3870 <blockquote>
3871 <para>
3872 <para>
3873 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3874 that evaluates to <emphasis>false</emphasis>.
3875 </para>
3876 </para>
3877 </blockquote>
3878 <blockquote>
3879 <para>
3880 <para>
3881 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_convertible</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
3882 </para>
3883 </para>
3884 </blockquote>
3885 </section>
3886 <section id="boost_typetraits.reference.is_empty"><indexterm type="class_name"><primary>is_empty</primary><secondary>is_empty</secondary></indexterm>
3887 <title><link linkend="boost_typetraits.reference.is_empty"> is_empty</link></title>
3888
3889 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
3890 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_empty</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3891 </programlisting>
3892 <para>
3893 <emphasis role="bold">Inherits:</emphasis> If T is an empty class type then
3894 inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
3895 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
3896 </para>
3897 <para>
3898 <emphasis role="bold">C++ Standard Reference:</emphasis> 10p5.
3899 </para>
3900 <para>
3901 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3902 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_empty</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3903 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3904 </para>
3905 <para>
3906 <emphasis role="bold">Compiler Compatibility:</emphasis> In order to correctly
3907 detect empty classes this trait relies on either:
3908 </para>
3909 <itemizedlist>
3910 <listitem>
3911 the compiler implementing zero sized empty base classes, or
3912 </listitem>
3913 <listitem>
3914 the compiler providing <link linkend="boost_typetraits.intrinsics">intrinsics</link>
3915 to detect empty classes.
3916 </listitem>
3917 </itemizedlist>
3918 <para>
3919 Can not be used with incomplete types.
3920 </para>
3921 <para>
3922 Can not be used with union types, until is_union can be made to work.
3923 </para>
3924 <para>
3925 If the compiler does not support partial-specialization of class templates,
3926 then this template can not be used with abstract types.
3927 </para>
3928 <para>
3929 <emphasis role="bold">Examples:</emphasis>
3930 </para>
3931 <blockquote>
3932 <para>
3933 <para>
3934 Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">struct</phrase> <phrase role="identifier">empty_class</phrase>
3935 <phrase role="special">{};</phrase></computeroutput>
3936 </para>
3937 </para>
3938 </blockquote>
3939 <blockquote>
3940 <para>
3941 <para>
3942 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">empty_class</phrase><phrase role="special">&gt;</phrase></computeroutput>
3943 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3944 </para>
3945 </para>
3946 </blockquote>
3947 <blockquote>
3948 <para>
3949 <para>
3950 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">empty_class</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
3951 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
3952 </para>
3953 </para>
3954 </blockquote>
3955 <blockquote>
3956 <para>
3957 <para>
3958 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">empty_class</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
3959 that evaluates to <emphasis>true</emphasis>.
3960 </para>
3961 </para>
3962 </blockquote>
3963 <blockquote>
3964 <para>
3965 <para>
3966 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_empty</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
3967 </para>
3968 </para>
3969 </blockquote>
3970 </section>
3971 <section id="boost_typetraits.reference.is_enum"><indexterm type="class_name"><primary>is_enum</primary><secondary>is_enum</secondary></indexterm>
3972 <title><link linkend="boost_typetraits.reference.is_enum"> is_enum</link></title>
3973
3974 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
3975 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_enum</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
3976 </programlisting>
3977 <para>
3978 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
3979 enum type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
3980 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
3981 </para>
3982 <para>
3983 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 7.2.
3984 </para>
3985 <para>
3986 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
3987 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_enum</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3988 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
3989 </para>
3990 <para>
3991 <emphasis role="bold">Compiler Compatibility:</emphasis> Requires a correctly
3992 functioning <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link>
3993 template; this means that is_enum is currently broken under Borland C++ Builder
3994 5, and for the Metrowerks compiler prior to version 8, other compilers should
3995 handle this template just fine.
3996 </para>
3997 <para>
3998 <emphasis role="bold">Examples:</emphasis>
3999 </para>
4000 <blockquote>
4001 <para>
4002 <para>
4003 Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">enum</phrase> <phrase role="identifier">my_enum</phrase>
4004 <phrase role="special">{</phrase> <phrase role="identifier">one</phrase><phrase role="special">,</phrase> <phrase role="identifier">two</phrase> <phrase role="special">};</phrase></computeroutput>
4005 </para>
4006 </para>
4007 </blockquote>
4008 <blockquote>
4009 <para>
4010 <para>
4011 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">&gt;</phrase></computeroutput>
4012 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4013 </para>
4014 </para>
4015 </blockquote>
4016 <blockquote>
4017 <para>
4018 <para>
4019 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">my_enum</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
4020 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4021 </para>
4022 </para>
4023 </blockquote>
4024 <blockquote>
4025 <para>
4026 <para>
4027 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4028 that evaluates to <emphasis>true</emphasis>.
4029 </para>
4030 </para>
4031 </blockquote>
4032 <blockquote>
4033 <para>
4034 <para>
4035 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4036 that evaluates to <emphasis>false</emphasis>.
4037 </para>
4038 </para>
4039 </blockquote>
4040 <blockquote>
4041 <para>
4042 <para>
4043 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4044 that evaluates to <emphasis>false</emphasis>.
4045 </para>
4046 </para>
4047 </blockquote>
4048 <blockquote>
4049 <para>
4050 <para>
4051 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_enum</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4052 </para>
4053 </para>
4054 </blockquote>
4055 </section>
4056 <section id="boost_typetraits.reference.is_floating_point"><indexterm type="class_name"><primary>is_floating_point</primary><secondary>is_floating_point</secondary></indexterm>
4057 <title><link linkend="boost_typetraits.reference.is_floating_point"> is_floating_point</link></title>
4058
4059 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
4060 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_floating_point</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4061 </programlisting>
4062 <para>
4063 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
4064 floating point type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4065 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4066 </para>
4067 <para>
4068 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p8.
4069 </para>
4070 <para>
4071 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4072 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_floating_point</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4073 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4074 </para>
4075 <para>
4076 <emphasis role="bold">Examples:</emphasis>
4077 </para>
4078 <blockquote>
4079 <para>
4080 <para>
4081 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">float</phrase><phrase role="special">&gt;</phrase></computeroutput>
4082 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4083 </para>
4084 </para>
4085 </blockquote>
4086 <blockquote>
4087 <para>
4088 <para>
4089 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">double</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4090 </para>
4091 </para>
4092 </blockquote>
4093 <blockquote>
4094 <para>
4095 <para>
4096 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="keyword">double</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
4097 is an integral constant expression that evaluates to <emphasis>true</emphasis>.
4098 </para>
4099 </para>
4100 </blockquote>
4101 <blockquote>
4102 <para>
4103 <para>
4104 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_floating_point</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4105 </para>
4106 </para>
4107 </blockquote>
4108 </section>
4109 <section id="boost_typetraits.reference.is_function"><indexterm type="class_name"><primary>is_function</primary><secondary>is_function</secondary></indexterm>
4110 <title><link linkend="boost_typetraits.reference.is_function"> is_function</link></title>
4111
4112 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
4113 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_function</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4114 </programlisting>
4115 <para>
4116 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
4117 function type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4118 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4119 Note that this template does not detect <emphasis>pointers to functions</emphasis>,
4120 or <emphasis>references to functions</emphasis>, these are detected by <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link> and <link linkend="boost_typetraits.reference.is_reference">is_reference</link> respectively:
4121 </para>
4122
4123 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="identifier">f1</phrase><phrase role="special">();</phrase> <phrase role="comment">// f1 is of function type.
4124 </phrase><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">f2</phrase><phrase role="special">*)();</phrase> <phrase role="comment">// f2 is a pointer to a function.
4125 </phrase><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">f3</phrase><phrase role="special">&amp;)();</phrase> <phrase role="comment">// f3 is a reference to a function.
4126 </phrase></programlisting>
4127 <para>
4128 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2p1 and 8.3.5.
4129 </para>
4130 <para>
4131 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4132 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_function</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4133 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4134 </para>
4135 <para>
4136 <emphasis role="bold">Examples:</emphasis>
4137 </para>
4138 <blockquote>
4139 <para>
4140 <para>
4141 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="keyword">void</phrase><phrase role="special">)&gt;</phrase></computeroutput>
4142 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4143 </para>
4144 </para>
4145 </blockquote>
4146 <blockquote>
4147 <para>
4148 <para>
4149 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4150 </para>
4151 </para>
4152 </blockquote>
4153 <blockquote>
4154 <para>
4155 <para>
4156 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4157 that evaluates to <emphasis>true</emphasis>.
4158 </para>
4159 </para>
4160 </blockquote>
4161 <blockquote>
4162 <para>
4163 <para>
4164 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4165 that evaluates to <emphasis>false</emphasis>: the argument in this case
4166 is a pointer type, not a function type.
4167 </para>
4168 </para>
4169 </blockquote>
4170 <blockquote>
4171 <para>
4172 <para>
4173 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="special">(&amp;)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4174 that evaluates to <emphasis>false</emphasis>: the argument in this case
4175 is a reference to a function, not a function type.
4176 </para>
4177 </para>
4178 </blockquote>
4179 <blockquote>
4180 <para>
4181 <para>
4182 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">double</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4183 that evaluates to <emphasis>false</emphasis>: the argument in this case
4184 is a pointer to a member function.
4185 </para>
4186 </para>
4187 </blockquote>
4188 <blockquote>
4189 <para>
4190 <para>
4191 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_function</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4192 </para>
4193 </para>
4194 </blockquote>
4195 <tip>
4196 <para>
4197 Don't confuse function-types with pointers to functions:
4198 </para>
4199 <para>
4200 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">typedef</phrase> <phrase role="keyword">int</phrase>
4201 <phrase role="identifier">f</phrase><phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">);</phrase></computeroutput>
4202 </para>
4203 <para>
4204 defines a function type,
4205 </para>
4206 <para>
4207 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase> <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput>
4208 </para>
4209 <para>
4210 declares a prototype for a function of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase></computeroutput>,
4211 </para>
4212 <para>
4213 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase><phrase role="special">*</phrase>
4214 <phrase role="identifier">pf</phrase> <phrase role="special">=</phrase>
4215 <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput>
4216 </para>
4217 <para>
4218 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">f</phrase><phrase role="special">&amp;</phrase>
4219 <phrase role="identifier">fr</phrase> <phrase role="special">=</phrase>
4220 <phrase role="identifier">foo</phrase><phrase role="special">;</phrase></computeroutput>
4221 </para>
4222 <para>
4223 declares a pointer and a reference to the function <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">foo</phrase></computeroutput>.
4224 </para>
4225 <para>
4226 If you want to detect whether some type is a pointer-to-function then use:
4227 </para>
4228 <para>
4229 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.is_function">is_function</link><phrase role="special">&lt;</phrase><link linkend="boost_typetraits.reference.remove_pointer">remove_pointer</link><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase>
4230 <phrase role="special">&amp;&amp;</phrase> <link linkend="boost_typetraits.reference.is_pointer">is_pointer</link><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
4231 </para>
4232 <para>
4233 or for pointers to member functions you can just use <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link>
4234 directly.
4235 </para>
4236 </tip>
4237 </section>
4238 <section id="boost_typetraits.reference.is_fundamental"><indexterm type="class_name"><primary>is_fundamental</primary><secondary>is_fundamental</secondary></indexterm>
4239 <title><link linkend="boost_typetraits.reference.is_fundamental"> is_fundamental</link></title>
4240
4241 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
4242 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_fundamental</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4243 </programlisting>
4244 <para>
4245 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
4246 fundamental type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4247 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4248 Fundamental types include integral, floating point and void types (see also
4249 <link linkend="boost_typetraits.reference.is_integral">is_integral</link>,
4250 <link linkend="boost_typetraits.reference.is_floating_point">is_floating_point</link>
4251 and <link linkend="boost_typetraits.reference.is_void">is_void</link>)
4252 </para>
4253 <para>
4254 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1.
4255 </para>
4256 <para>
4257 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4258 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_fundamental</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4259 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4260 </para>
4261 <para>
4262 <emphasis role="bold">Examples:</emphasis>
4263 </para>
4264 <blockquote>
4265 <para>
4266 <para>
4267 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">)&gt;</phrase></computeroutput>
4268 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4269 </para>
4270 </para>
4271 </blockquote>
4272 <blockquote>
4273 <para>
4274 <para>
4275 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
4276 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4277 </para>
4278 </para>
4279 </blockquote>
4280 <blockquote>
4281 <para>
4282 <para>
4283 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">void</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4284 that evaluates to <emphasis>true</emphasis>.
4285 </para>
4286 </para>
4287 </blockquote>
4288 <blockquote>
4289 <para>
4290 <para>
4291 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_fundamental</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4292 </para>
4293 </para>
4294 </blockquote>
4295 </section>
4296 <section id="boost_typetraits.reference.is_integral"><indexterm type="class_name"><primary>is_integral</primary><secondary>is_integral</secondary></indexterm>
4297 <title><link linkend="boost_typetraits.reference.is_integral"> is_integral</link></title>
4298
4299 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
4300 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_integral</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4301 </programlisting>
4302 <para>
4303 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
4304 integral type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4305 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4306 </para>
4307 <para>
4308 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p7.
4309 </para>
4310 <para>
4311 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4312 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_integral</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4313 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4314 </para>
4315 <para>
4316 <emphasis role="bold">Examples:</emphasis>
4317 </para>
4318 <blockquote>
4319 <para>
4320 <para>
4321 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput>
4322 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4323 </para>
4324 </para>
4325 </blockquote>
4326 <blockquote>
4327 <para>
4328 <para>
4329 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">char</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
4330 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4331 </para>
4332 </para>
4333 </blockquote>
4334 <blockquote>
4335 <para>
4336 <para>
4337 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4338 that evaluates to <emphasis>true</emphasis>.
4339 </para>
4340 </para>
4341 </blockquote>
4342 <blockquote>
4343 <para>
4344 <para>
4345 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_integral</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4346 </para>
4347 </para>
4348 </blockquote>
4349 </section>
4350 <section id="boost_typetraits.reference.is_member_function_pointer"><indexterm type="class_name"><primary>is_member_function_pointer</primary><secondary>is_member_function_pointer</secondary></indexterm>
4351 <title><link linkend="boost_typetraits.reference.is_member_function_pointer">
4352 is_member_function_pointer</link></title>
4353 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
4354 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_function_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4355 </programlisting>
4356 <para>
4357 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
4358 pointer to a member function then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4359 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4360 </para>
4361 <para>
4362 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3.
4363 </para>
4364 <para>
4365 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4366 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4367 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4368 </para>
4369 <para>
4370 <emphasis role="bold">Examples:</emphasis>
4371 </para>
4372 <blockquote>
4373 <para>
4374 <para>
4375 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)&gt;</phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4376 </para>
4377 </para>
4378 </blockquote>
4379 <blockquote>
4380 <para>
4381 <para>
4382 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">char</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
4383 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4384 </para>
4385 </para>
4386 </blockquote>
4387 <blockquote>
4388 <para>
4389 <para>
4390 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
4391 is an integral constant expression that evaluates to <emphasis>true</emphasis>.
4392 </para>
4393 </para>
4394 </blockquote>
4395 <blockquote>
4396 <para>
4397 <para>
4398 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
4399 is an integral constant expression that evaluates to <emphasis>false</emphasis>:
4400 the argument in this case is a pointer to a data member and not a member
4401 function, see <link linkend="boost_typetraits.reference.is_member_object_pointer">is_member_object_pointer</link>
4402 and <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link>
4403 </para>
4404 </para>
4405 </blockquote>
4406 <blockquote>
4407 <para>
4408 <para>
4409 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_function_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput>
4410 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4411 </para>
4412 </para>
4413 </blockquote>
4414 </section>
4415 <section id="boost_typetraits.reference.is_member_object_pointer"><indexterm type="class_name"><primary>is_member_object_pointer</primary><secondary>is_member_object_pointer</secondary></indexterm>
4416 <title><link linkend="boost_typetraits.reference.is_member_object_pointer">
4417 is_member_object_pointer</link></title>
4418 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
4419 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_object_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4420 </programlisting>
4421 <para>
4422 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
4423 pointer to a member object (a data member) then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4424 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4425 </para>
4426 <para>
4427 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3.
4428 </para>
4429 <para>
4430 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4431 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4432 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4433 </para>
4434 <para>
4435 <emphasis role="bold">Examples:</emphasis>
4436 </para>
4437 <blockquote>
4438 <para>
4439 <para>
4440 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)&gt;</phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4441 </para>
4442 </para>
4443 </blockquote>
4444 <blockquote>
4445 <para>
4446 <para>
4447 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">double</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
4448 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4449 </para>
4450 </para>
4451 </blockquote>
4452 <blockquote>
4453 <para>
4454 <para>
4455 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4456 that evaluates to <emphasis>true</emphasis>.
4457 </para>
4458 </para>
4459 </blockquote>
4460 <blockquote>
4461 <para>
4462 <para>
4463 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
4464 is an integral constant expression that evaluates to <emphasis>false</emphasis>:
4465 the argument in this case is a pointer to a member function and not a
4466 member object, see <link linkend="boost_typetraits.reference.is_member_function_pointer">is_member_function_pointer</link>
4467 and <link linkend="boost_typetraits.reference.is_member_pointer">is_member_pointer</link>
4468 </para>
4469 </para>
4470 </blockquote>
4471 <blockquote>
4472 <para>
4473 <para>
4474 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_object_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput>
4475 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4476 </para>
4477 </para>
4478 </blockquote>
4479 </section>
4480 <section id="boost_typetraits.reference.is_member_pointer"><indexterm type="class_name"><primary>is_member_pointer</primary><secondary>is_member_pointer</secondary></indexterm>
4481 <title><link linkend="boost_typetraits.reference.is_member_pointer"> is_member_pointer</link></title>
4482
4483 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
4484 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_member_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4485 </programlisting>
4486 <para>
4487 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
4488 pointer to a member (either a function or a data member) then inherits from
4489 <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4490 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4491 </para>
4492 <para>
4493 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.3.
4494 </para>
4495 <para>
4496 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4497 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_member_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4498 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4499 </para>
4500 <para>
4501 <emphasis role="bold">Examples:</emphasis>
4502 </para>
4503 <blockquote>
4504 <para>
4505 <para>
4506 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)&gt;</phrase></computeroutput>
4507 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4508 </para>
4509 </para>
4510 </blockquote>
4511 <blockquote>
4512 <para>
4513 <para>
4514 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">char</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4515 </para>
4516 </para>
4517 </blockquote>
4518 <blockquote>
4519 <para>
4520 <para>
4521 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4522 that evaluates to <emphasis>true</emphasis>.
4523 </para>
4524 </para>
4525 </blockquote>
4526 <blockquote>
4527 <para>
4528 <para>
4529 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_member_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4530 </para>
4531 </para>
4532 </blockquote>
4533 </section>
4534 <section id="boost_typetraits.reference.is_object"><indexterm type="class_name"><primary>is_object</primary><secondary>is_object</secondary></indexterm>
4535 <title><link linkend="boost_typetraits.reference.is_object"> is_object</link></title>
4536
4537 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
4538 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_object</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4539 </programlisting>
4540 <para>
4541 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
4542 object type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4543 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4544 All types are object types except references, void, and function types.
4545 </para>
4546 <para>
4547 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p9.
4548 </para>
4549 <para>
4550 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4551 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_object</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4552 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4553 </para>
4554 <para>
4555 <emphasis role="bold">Examples:</emphasis>
4556 </para>
4557 <blockquote>
4558 <para>
4559 <para>
4560 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput>
4561 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4562 </para>
4563 </para>
4564 </blockquote>
4565 <blockquote>
4566 <para>
4567 <para>
4568 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4569 </para>
4570 </para>
4571 </blockquote>
4572 <blockquote>
4573 <para>
4574 <para>
4575 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4576 that evaluates to <emphasis>true</emphasis>.
4577 </para>
4578 </para>
4579 </blockquote>
4580 <blockquote>
4581 <para>
4582 <para>
4583 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">void</phrase><phrase role="special">)</phrase><phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4584 that evaluates to <emphasis>true</emphasis>.
4585 </para>
4586 </para>
4587 </blockquote>
4588 <blockquote>
4589 <para>
4590 <para>
4591 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4592 that evaluates to <emphasis>false</emphasis>: reference types are not
4593 objects
4594 </para>
4595 </para>
4596 </blockquote>
4597 <blockquote>
4598 <para>
4599 <para>
4600 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="keyword">double</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4601 that evaluates to <emphasis>false</emphasis>: function types are not
4602 objects
4603 </para>
4604 </para>
4605 </blockquote>
4606 <blockquote>
4607 <para>
4608 <para>
4609 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
4610 is an integral constant expression that evaluates to <emphasis>false</emphasis>:
4611 void is not an object type
4612 </para>
4613 </para>
4614 </blockquote>
4615 <blockquote>
4616 <para>
4617 <para>
4618 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_object</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4619 </para>
4620 </para>
4621 </blockquote>
4622 </section>
4623 <section id="boost_typetraits.reference.is_pod">
4624 <title><link linkend="boost_typetraits.reference.is_pod"> is_pod</link></title>
4625
4626 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
4627 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_pod</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4628 </programlisting>
4629 <para>
4630 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
4631 POD type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4632 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4633 </para>
4634 <para>
4635 POD stands for "Plain old data". Arithmetic types, and enumeration
4636 types, a pointers and pointer to members are all PODs. Classes and unions
4637 can also be POD's if they have no non-static data members that are of reference
4638 or non-POD type, no user defined constructors, no user defined assignment
4639 operators, no private or protected non-static data members, no virtual functions
4640 and no base classes. Finally, a cv-qualified POD is still a POD, as is an
4641 array of PODs.
4642 </para>
4643 <para>
4644 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10 and 9p4 (Note
4645 that POD's are also aggregates, see 8.5.1).
4646 </para>
4647 <para>
4648 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
4649 does not support partial-specialization of class templates, then this template
4650 can not be used with function types.
4651 </para>
4652 <para>
4653 Without some (as yet unspecified) help from the compiler, is<emphasis role="underline">pod
4654 will never report that a class or struct is a POD; this is always safe, if
4655 possibly sub-optimal. Currently (May 2005) only MWCW 9 and Visual C++ 8 have
4656 the necessary compiler-</emphasis>_intrinsics.
4657 </para>
4658 <para>
4659 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4660 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pod</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4661 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4662 </para>
4663 <para>
4664 <emphasis role="bold">Examples:</emphasis>
4665 </para>
4666 <blockquote>
4667 <para>
4668 <para>
4669 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput>
4670 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4671 </para>
4672 </para>
4673 </blockquote>
4674 <blockquote>
4675 <para>
4676 <para>
4677 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4678 </para>
4679 </para>
4680 </blockquote>
4681 <blockquote>
4682 <para>
4683 <para>
4684 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4685 that evaluates to <emphasis>true</emphasis>.
4686 </para>
4687 </para>
4688 </blockquote>
4689 <blockquote>
4690 <para>
4691 <para>
4692 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4693 that evaluates to <emphasis>false</emphasis>.
4694 </para>
4695 </para>
4696 </blockquote>
4697 <blockquote>
4698 <para>
4699 <para>
4700 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pod</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4701 </para>
4702 </para>
4703 </blockquote>
4704 </section>
4705 <section id="boost_typetraits.reference.is_pointer"><indexterm type="class_name"><primary>is_pointer</primary><secondary>is_pointer</secondary></indexterm>
4706 <title><link linkend="boost_typetraits.reference.is_pointer"> is_pointer</link></title>
4707
4708 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
4709 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_pointer</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4710 </programlisting>
4711 <para>
4712 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
4713 pointer type (includes function pointers, but excludes pointers to members)
4714 then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4715 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4716 </para>
4717 <para>
4718 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2p2 and 8.3.1.
4719 </para>
4720 <para>
4721 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4722 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4723 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4724 </para>
4725 <para>
4726 <emphasis role="bold">Examples:</emphasis>
4727 </para>
4728 <blockquote>
4729 <para>
4730 <para>
4731 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&gt;</phrase></computeroutput>
4732 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4733 </para>
4734 </para>
4735 </blockquote>
4736 <blockquote>
4737 <para>
4738 <para>
4739 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">*</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4740 </para>
4741 </para>
4742 </blockquote>
4743 <blockquote>
4744 <para>
4745 <para>
4746 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4747 that evaluates to <emphasis>true</emphasis>.
4748 </para>
4749 </para>
4750 </blockquote>
4751 <blockquote>
4752 <para>
4753 <para>
4754 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4755 that evaluates to <emphasis>false</emphasis>.
4756 </para>
4757 </para>
4758 </blockquote>
4759 <blockquote>
4760 <para>
4761 <para>
4762 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4763 that evaluates to <emphasis>false</emphasis>.
4764 </para>
4765 </para>
4766 </blockquote>
4767 <blockquote>
4768 <para>
4769 <para>
4770 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4771 </para>
4772 </para>
4773 </blockquote>
4774 <important>
4775 <para>
4776 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase></computeroutput> detects "real"
4777 pointer types only, and <emphasis>not</emphasis> smart pointers. Users
4778 should not specialise <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_pointer</phrase></computeroutput>
4779 for smart pointer types, as doing so may cause Boost (and other third party)
4780 code to fail to function correctly. Users wanting a trait to detect smart
4781 pointers should create their own. However, note that there is no way in
4782 general to auto-magically detect smart pointer types, so such a trait would
4783 have to be partially specialised for each supported smart pointer type.
4784 </para>
4785 </important>
4786 </section>
4787 <section id="boost_typetraits.reference.is_polymorphic"><indexterm type="class_name"><primary>is_polymorphic</primary><secondary>is_polymorphic</secondary></indexterm>
4788 <title><link linkend="boost_typetraits.reference.is_polymorphic"> is_polymorphic</link></title>
4789
4790 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
4791 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_polymorphic</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4792 </programlisting>
4793 <para>
4794 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
4795 polymorphic type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4796 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4797 Type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> must be a complete
4798 type.
4799 </para>
4800 <para>
4801 <emphasis role="bold">C++ Standard Reference:</emphasis> 10.3.
4802 </para>
4803 <para>
4804 <emphasis role="bold">Compiler Compatibility:</emphasis> The implementation
4805 requires some knowledge of the compilers ABI, it does actually seem to work
4806 with the majority of compilers though.
4807 </para>
4808 <para>
4809 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4810 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_polymorphic</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4811 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4812 </para>
4813 <para>
4814 <emphasis role="bold">Examples:</emphasis>
4815 </para>
4816 <blockquote>
4817 <para>
4818 <para>
4819 Given: <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">class</phrase> <phrase role="identifier">poly</phrase><phrase role="special">{</phrase> <phrase role="keyword">virtual</phrase> <phrase role="special">~</phrase><phrase role="identifier">poly</phrase><phrase role="special">();</phrase> <phrase role="special">};</phrase></computeroutput>
4820 </para>
4821 </para>
4822 </blockquote>
4823 <blockquote>
4824 <para>
4825 <para>
4826 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">poly</phrase><phrase role="special">&gt;</phrase></computeroutput>
4827 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4828 </para>
4829 </para>
4830 </blockquote>
4831 <blockquote>
4832 <para>
4833 <para>
4834 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">poly</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
4835 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4836 </para>
4837 </para>
4838 </blockquote>
4839 <blockquote>
4840 <para>
4841 <para>
4842 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">poly</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4843 that evaluates to <emphasis>true</emphasis>.
4844 </para>
4845 </para>
4846 </blockquote>
4847 <blockquote>
4848 <para>
4849 <para>
4850 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_polymorphic</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4851 </para>
4852 </para>
4853 </blockquote>
4854 </section>
4855 <section id="boost_typetraits.reference.is_same"><indexterm type="class_name"><primary>is_same</primary><secondary>is_same</secondary></indexterm>
4856 <title><link linkend="boost_typetraits.reference.is_same"> is_same</link></title>
4857
4858 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">,</phrase> <phrase role="keyword">class</phrase> <phrase role="identifier">U</phrase><phrase role="special">&gt;</phrase>
4859 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_same</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4860 </programlisting>
4861 <para>
4862 <emphasis role="bold">Inherits:</emphasis> If T and U are the same types
4863 then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4864 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4865 </para>
4866 <para>
4867 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4868 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_same</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4869 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4870 </para>
4871 <para>
4872 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
4873 does not support partial-specialization of class templates, then this template
4874 can not be used with abstract, incomplete or function types.
4875 </para>
4876 <para>
4877 <emphasis role="bold">Examples:</emphasis>
4878 </para>
4879 <blockquote>
4880 <para>
4881 <para>
4882 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput>
4883 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4884 </para>
4885 </para>
4886 </blockquote>
4887 <blockquote>
4888 <para>
4889 <para>
4890 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4891 </para>
4892 </para>
4893 </blockquote>
4894 <blockquote>
4895 <para>
4896 <para>
4897 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4898 that evaluates to <emphasis>true</emphasis>.
4899 </para>
4900 </para>
4901 </blockquote>
4902 <blockquote>
4903 <para>
4904 <para>
4905 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">,</phrase> <phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
4906 is an integral constant expression that evaluates to <emphasis>false</emphasis>.
4907 </para>
4908 </para>
4909 </blockquote>
4910 <blockquote>
4911 <para>
4912 <para>
4913 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&amp;,</phrase> <phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4914 that evaluates to <emphasis>false</emphasis>.
4915 </para>
4916 </para>
4917 </blockquote>
4918 <blockquote>
4919 <para>
4920 <para>
4921 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_same</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
4922 </para>
4923 </para>
4924 </blockquote>
4925 </section>
4926 <section id="boost_typetraits.reference.is_scalar"><indexterm type="class_name"><primary>is_scalar</primary><secondary>is_scalar</secondary></indexterm>
4927 <title><link linkend="boost_typetraits.reference.is_scalar"> is_scalar</link></title>
4928
4929 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
4930 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_scalar</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
4931 </programlisting>
4932 <para>
4933 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
4934 scalar type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
4935 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
4936 Scalar types include integral, floating point, enumeration, pointer, and
4937 pointer-to-member types.
4938 </para>
4939 <para>
4940 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10.
4941 </para>
4942 <para>
4943 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
4944 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_scalar</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4945 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
4946 </para>
4947 <para>
4948 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
4949 does not support partial-specialization of class templates, then this template
4950 can not be used with function types.
4951 </para>
4952 <para>
4953 <emphasis role="bold">Examples:</emphasis>
4954 </para>
4955 <blockquote>
4956 <para>
4957 <para>
4958 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&gt;</phrase></computeroutput>
4959 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4960 </para>
4961 </para>
4962 </blockquote>
4963 <blockquote>
4964 <para>
4965 <para>
4966 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
4967 </para>
4968 </para>
4969 </blockquote>
4970 <blockquote>
4971 <para>
4972 <para>
4973 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">double</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4974 that evaluates to <emphasis>true</emphasis>.
4975 </para>
4976 </para>
4977 </blockquote>
4978 <blockquote>
4979 <para>
4980 <para>
4981 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4982 that evaluates to <emphasis>true</emphasis>.
4983 </para>
4984 </para>
4985 </blockquote>
4986 <blockquote>
4987 <para>
4988 <para>
4989 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4990 that evaluates to <emphasis>true</emphasis>.
4991 </para>
4992 </para>
4993 </blockquote>
4994 <blockquote>
4995 <para>
4996 <para>
4997 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(</phrase><phrase role="identifier">MyClass</phrase><phrase role="special">::*)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
4998 that evaluates to <emphasis>true</emphasis>.
4999 </para>
5000 </para>
5001 </blockquote>
5002 <blockquote>
5003 <para>
5004 <para>
5005 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_scalar</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
5006 </para>
5007 </para>
5008 </blockquote>
5009 </section>
5010 <section id="boost_typetraits.reference.is_signed"><indexterm type="class_name"><primary>is_signed</primary><secondary>is_signed</secondary></indexterm>
5011 <title><link linkend="boost_typetraits.reference.is_signed"> is_signed</link></title>
5012
5013 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5014 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_signed</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
5015 </programlisting>
5016 <para>
5017 <emphasis role="bold">Inherits:</emphasis> If T is an signed integer type
5018 or an enumerated type with an underlying signed integer type, then inherits
5019 from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
5020 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
5021 </para>
5022 <para>
5023 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1, 7.2.
5024 </para>
5025 <para>
5026 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5027 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_signed</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5028 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5029 </para>
5030 <para>
5031 <emphasis role="bold">Examples:</emphasis>
5032 </para>
5033 <blockquote>
5034 <para>
5035 <para>
5036 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput>
5037 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
5038 </para>
5039 </para>
5040 </blockquote>
5041 <blockquote>
5042 <para>
5043 <para>
5044 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
5045 </para>
5046 </para>
5047 </blockquote>
5048 <blockquote>
5049 <para>
5050 <para>
5051 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
5052 is an integral constant expression that evaluates to <emphasis>false</emphasis>.
5053 </para>
5054 </para>
5055 </blockquote>
5056 <blockquote>
5057 <para>
5058 <para>
5059 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">myclass</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5060 that evaluates to <emphasis>false</emphasis>.
5061 </para>
5062 </para>
5063 </blockquote>
5064 <blockquote>
5065 <para>
5066 <para>
5067 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5068 whose value depends upon the signedness of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>.
5069 </para>
5070 </para>
5071 </blockquote>
5072 <blockquote>
5073 <para>
5074 <para>
5075 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
5076 is an integral constant expression that evaluates to <emphasis>true</emphasis>.
5077 </para>
5078 </para>
5079 </blockquote>
5080 <blockquote>
5081 <para>
5082 <para>
5083 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_signed</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
5084 </para>
5085 </para>
5086 </blockquote>
5087 </section>
5088 <section id="boost_typetraits.reference.is_stateless">
5089 <title><link linkend="boost_typetraits.reference.is_stateless"> is_stateless</link></title>
5090
5091 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5092 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_stateless</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
5093 </programlisting>
5094 <para>
5095 <emphasis role="bold">Inherits:</emphasis> Ff T is a stateless type then
5096 inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
5097 otherwise from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
5098 </para>
5099 <para>
5100 Type T must be a complete type.
5101 </para>
5102 <para>
5103 A stateless type is a type that has no storage and whose constructors and
5104 destructors are trivial. That means that <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_stateless</phrase></computeroutput>
5105 only inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>
5106 if the following expression is <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">true</phrase></computeroutput>:
5107 </para>
5108
5109 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_constructor</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase>
5110 <phrase role="special">&amp;&amp;</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_copy</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase>
5111 <phrase role="special">&amp;&amp;</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">has_trivial_destructor</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase>
5112 <phrase role="special">&amp;&amp;</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_class</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase>
5113 <phrase role="special">&amp;&amp;</phrase> <phrase role="special">::</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">is_empty</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase>
5114 </programlisting>
5115 <para>
5116 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9p10.
5117 </para>
5118 <para>
5119 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5120 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_stateless</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5121 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5122 </para>
5123 <para>
5124 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
5125 does not support partial-specialization of class templates, then this template
5126 can not be used with function types.
5127 </para>
5128 <para>
5129 Without some (as yet unspecified) help from the compiler, is_stateless will
5130 never report that a class or struct is stateless; this is always safe, if
5131 possibly sub-optimal. Currently (May 2005) only MWCW 9 and Visual C++ 8 have
5132 the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link>
5133 to make this template work automatically.
5134 </para>
5135 </section>
5136 <section id="boost_typetraits.reference.is_reference"><indexterm type="class_name"><primary>is_reference</primary><secondary>is_reference</secondary></indexterm>
5137 <title><link linkend="boost_typetraits.reference.is_reference"> is_reference</link></title>
5138
5139 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5140 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_reference</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
5141 </programlisting>
5142 <para>
5143 <emphasis role="bold">Inherits:</emphasis> If T is a reference pointer type
5144 then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
5145 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
5146 </para>
5147 <para>
5148 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 8.3.2.
5149 </para>
5150 <para>
5151 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
5152 does not support partial-specialization of class templates, then this template
5153 may report the wrong result for function types, and for types that are both
5154 const and volatile qualified.
5155 </para>
5156 <para>
5157 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5158 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5159 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5160 </para>
5161 <para>
5162 <emphasis role="bold">Examples:</emphasis>
5163 </para>
5164 <blockquote>
5165 <para>
5166 <para>
5167 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&amp;&gt;</phrase></computeroutput>
5168 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
5169 </para>
5170 </para>
5171 </blockquote>
5172 <blockquote>
5173 <para>
5174 <para>
5175 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5176 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
5177 </para>
5178 </para>
5179 </blockquote>
5180 <blockquote>
5181 <para>
5182 <para>
5183 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="special">(&amp;)(</phrase><phrase role="keyword">long</phrase><phrase role="special">)&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5184 that evaluates to <emphasis>true</emphasis> (the argument in this case
5185 is a reference to a function).
5186 </para>
5187 </para>
5188 </blockquote>
5189 <blockquote>
5190 <para>
5191 <para>
5192 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_reference</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
5193 </para>
5194 </para>
5195 </blockquote>
5196 </section>
5197 <section id="boost_typetraits.reference.is_union"><indexterm type="class_name"><primary>is_union</primary><secondary>is_union</secondary></indexterm>
5198 <title><link linkend="boost_typetraits.reference.is_union"> is_union</link></title>
5199
5200 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5201 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_union</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
5202 </programlisting>
5203 <para>
5204 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
5205 union type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
5206 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
5207 Currently requires some kind of compiler support, otherwise unions are identified
5208 as classes.
5209 </para>
5210 <para>
5211 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.2 and 9.5.
5212 </para>
5213 <para>
5214 <emphasis role="bold">Compiler Compatibility:</emphasis> Without (some as
5215 yet unspecified) help from the compiler, we cannot distinguish between union
5216 and class types using only standard C++, as a result this type will never
5217 inherit from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
5218 unless the user explicitly specializes the template for their user-defined
5219 union types, or unless the compiler supplies some unspecified intrinsic that
5220 implements this functionality. Currently (May 2005) only Visual C++ 8 has
5221 the necessary compiler <link linkend="boost_typetraits.intrinsics">intrinsics</link>
5222 to make this trait "just work" without user intervention.
5223 </para>
5224 <para>
5225 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5226 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_union</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5227 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5228 </para>
5229 <para>
5230 <emphasis role="bold">Examples:</emphasis>
5231 </para>
5232 <blockquote>
5233 <para>
5234 <para>
5235 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">void</phrase><phrase role="special">&gt;</phrase></computeroutput>
5236 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
5237 </para>
5238 </para>
5239 </blockquote>
5240 <blockquote>
5241 <para>
5242 <para>
5243 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5244 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
5245 </para>
5246 </para>
5247 </blockquote>
5248 <blockquote>
5249 <para>
5250 <para>
5251 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">void</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5252 that evaluates to <emphasis>true</emphasis>.
5253 </para>
5254 </para>
5255 </blockquote>
5256 <blockquote>
5257 <para>
5258 <para>
5259 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">void</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5260 that evaluates to <emphasis>false</emphasis>.
5261 </para>
5262 </para>
5263 </blockquote>
5264 <blockquote>
5265 <para>
5266 <para>
5267 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_union</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
5268 </para>
5269 </para>
5270 </blockquote>
5271 </section>
5272 <section id="boost_typetraits.reference.is_unsigned"><indexterm type="class_name"><primary>is_unsigned</primary><secondary>is_unsigned</secondary></indexterm>
5273 <title><link linkend="boost_typetraits.reference.is_unsigned"> is_unsigned</link></title>
5274
5275 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5276 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_unsigned</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
5277 </programlisting>
5278 <para>
5279 <emphasis role="bold">Inherits:</emphasis> If T is an unsigned integer type
5280 or an enumerated type with an underlying unsigned integer type, then inherits
5281 from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
5282 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
5283 </para>
5284 <para>
5285 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1, 7.2.
5286 </para>
5287 <para>
5288 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5289 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_unsigned</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5290 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5291 </para>
5292 <para>
5293 <emphasis role="bold">Examples:</emphasis>
5294 </para>
5295 <blockquote>
5296 <para>
5297 <para>
5298 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
5299 </para>
5300 </para>
5301 </blockquote>
5302 <blockquote>
5303 <para>
5304 <para>
5305 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase>
5306 <phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5307 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
5308 </para>
5309 </para>
5310 </blockquote>
5311 <blockquote>
5312 <para>
5313 <para>
5314 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5315 that evaluates to <emphasis>false</emphasis>.
5316 </para>
5317 </para>
5318 </blockquote>
5319 <blockquote>
5320 <para>
5321 <para>
5322 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">myclass</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5323 that evaluates to <emphasis>false</emphasis>.
5324 </para>
5325 </para>
5326 </blockquote>
5327 <blockquote>
5328 <para>
5329 <para>
5330 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">char</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5331 whose value depends upon the signedness of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">char</phrase></computeroutput>.
5332 </para>
5333 </para>
5334 </blockquote>
5335 <blockquote>
5336 <para>
5337 <para>
5338 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">long</phrase>
5339 <phrase role="keyword">long</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5340 that evaluates to <emphasis>true</emphasis>.
5341 </para>
5342 </para>
5343 </blockquote>
5344 <blockquote>
5345 <para>
5346 <para>
5347 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_unsigned</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
5348 </para>
5349 </para>
5350 </blockquote>
5351 </section>
5352 <section id="boost_typetraits.reference.is_void"><indexterm type="class_name"><primary>is_void</primary><secondary>is_void</secondary></indexterm>
5353 <title><link linkend="boost_typetraits.reference.is_void"> is_void</link></title>
5354
5355 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5356 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_void</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
5357 </programlisting>
5358 <para>
5359 <emphasis role="bold">Inherits:</emphasis> If T is a (possibly cv-qualified)
5360 void type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
5361 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
5362 </para>
5363 <para>
5364 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1p9.
5365 </para>
5366 <para>
5367 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5368 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_void</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5369 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5370 </para>
5371 <para>
5372 <emphasis role="bold">Examples:</emphasis>
5373 </para>
5374 <blockquote>
5375 <para>
5376 <para>
5377 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">void</phrase><phrase role="special">&gt;</phrase></computeroutput>
5378 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
5379 </para>
5380 </para>
5381 </blockquote>
5382 <blockquote>
5383 <para>
5384 <para>
5385 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">void</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5386 is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
5387 </para>
5388 </para>
5389 </blockquote>
5390 <blockquote>
5391 <para>
5392 <para>
5393 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">void</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5394 that evaluates to <emphasis>true</emphasis>.
5395 </para>
5396 </para>
5397 </blockquote>
5398 <blockquote>
5399 <para>
5400 <para>
5401 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">void</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5402 that evaluates to <emphasis>false</emphasis>.
5403 </para>
5404 </para>
5405 </blockquote>
5406 <blockquote>
5407 <para>
5408 <para>
5409 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_void</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
5410 </para>
5411 </para>
5412 </blockquote>
5413 </section>
5414 <section id="boost_typetraits.reference.is_volatile"><indexterm type="class_name"><primary>is_volatile</primary><secondary>is_volatile</secondary></indexterm>
5415 <title><link linkend="boost_typetraits.reference.is_volatile"> is_volatile</link></title>
5416
5417 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5418 <phrase role="keyword">struct</phrase> <phrase role="identifier">is_volatile</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <replaceable><link linkend="boost_typetraits.reference.integral_constant">true_type</link>-or-<link linkend="boost_typetraits.reference.integral_constant">false_type</link></replaceable> <phrase role="special">{};</phrase>
5419 </programlisting>
5420 <para>
5421 <emphasis role="bold">Inherits:</emphasis> If T is a (top level) volatile-qualified
5422 type then inherits from <link linkend="boost_typetraits.reference.integral_constant">true_type</link>,
5423 otherwise inherits from <link linkend="boost_typetraits.reference.integral_constant">false_type</link>.
5424 </para>
5425 <para>
5426 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3.
5427 </para>
5428 <para>
5429 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5430 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">is_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5431 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5432 </para>
5433 <para>
5434 <emphasis role="bold">Examples:</emphasis>
5435 </para>
5436 <blockquote>
5437 <para>
5438 <para>
5439 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">volatile</phrase> <phrase role="keyword">int</phrase><phrase role="special">&gt;</phrase></computeroutput> inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
5440 </para>
5441 </para>
5442 </blockquote>
5443 <blockquote>
5444 <para>
5445 <para>
5446 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">volatile</phrase>
5447 <phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">true_type</link></computeroutput>.
5448 </para>
5449 </para>
5450 </blockquote>
5451 <blockquote>
5452 <para>
5453 <para>
5454 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5455 that evaluates to <emphasis>true</emphasis>.
5456 </para>
5457 </para>
5458 </blockquote>
5459 <blockquote>
5460 <para>
5461 <para>
5462 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
5463 is an integral constant expression that evaluates to <emphasis>false</emphasis>:
5464 the volatile qualifier is not at the top level in this case.
5465 </para>
5466 </para>
5467 </blockquote>
5468 <blockquote>
5469 <para>
5470 <para>
5471 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">is_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">bool</phrase></computeroutput>.
5472 </para>
5473 </para>
5474 </blockquote>
5475 </section>
5476 <section id="boost_typetraits.reference.make_signed"><indexterm type="class_name"><primary>make_signed</primary><secondary>make_signed</secondary></indexterm>
5477 <title><link linkend="boost_typetraits.reference.make_signed"> make_signed</link></title>
5478
5479 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5480 <phrase role="keyword">struct</phrase> <phrase role="identifier">make_signed</phrase>
5481 <phrase role="special">{</phrase>
5482 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
5483 <phrase role="special">};</phrase>
5484 </programlisting>
5485 <para>
5486 <emphasis role="bold">type:</emphasis> If T is a signed integer type then
5487 the same type as T, if T is an unsigned integer type then the corresponding
5488 signed type. Otherwise if T is an enumerated or character type (char or wchar_t)
5489 then a signed integer type with the same width as T.
5490 </para>
5491 <para>
5492 If T has any cv-qualifiers then these are also present on the result type.
5493 </para>
5494 <para>
5495 <emphasis role="bold">Requires:</emphasis> T must be an integer or enumerated
5496 type, and must not be the type bool.
5497 </para>
5498 <para>
5499 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1.
5500 </para>
5501 <para>
5502 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5503 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">make_signed</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5504 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5505 </para>
5506 <table frame="all"> <title>Examples</title>
5507 <tgroup cols="2">
5508 <thead>
5509 <row>
5510 <entry>
5511 <para>
5512 Expression
5513 </para>
5514 </entry><entry>
5515 <para>
5516 Result Type
5517 </para>
5518 </entry>
5519 </row>
5520 </thead>
5521 <tbody>
5522 <row>
5523 <entry>
5524 <para>
5525 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5526 </para>
5527 </entry><entry>
5528 <para>
5529 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
5530 </para>
5531 </entry>
5532 </row>
5533 <row>
5534 <entry>
5535 <para>
5536 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase>
5537 <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5538 </para>
5539 </entry><entry>
5540 <para>
5541 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput>
5542 </para>
5543 </entry>
5544 </row>
5545 <row>
5546 <entry>
5547 <para>
5548 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase>
5549 <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5550 </para>
5551 </entry><entry>
5552 <para>
5553 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="keyword">long</phrase>
5554 <phrase role="keyword">long</phrase></computeroutput>
5555 </para>
5556 </entry>
5557 </row>
5558 <row>
5559 <entry>
5560 <para>
5561 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5562 </para>
5563 </entry><entry>
5564 <para>
5565 A signed integer type with the same width as the enum.
5566 </para>
5567 </entry>
5568 </row>
5569 <row>
5570 <entry>
5571 <para>
5572 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">wchar_t</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5573 </para>
5574 </entry><entry>
5575 <para>
5576 A signed integer type with the same width as wchar_t.
5577 </para>
5578 </entry>
5579 </row>
5580 </tbody>
5581 </tgroup>
5582 </table>
5583 </section>
5584 <section id="boost_typetraits.reference.make_unsigned"><indexterm type="class_name"><primary>make_unsigned</primary><secondary>make_unsigned</secondary></indexterm>
5585 <title><link linkend="boost_typetraits.reference.make_unsigned"> make_unsigned</link></title>
5586
5587 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5588 <phrase role="keyword">struct</phrase> <phrase role="identifier">make_unsigned</phrase>
5589 <phrase role="special">{</phrase>
5590 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
5591 <phrase role="special">};</phrase>
5592 </programlisting>
5593 <para>
5594 <emphasis role="bold">type:</emphasis> If T is a unsigned integer type then
5595 the same type as T, if T is an signed integer type then the corresponding
5596 unsigned type. Otherwise if T is an enumerated or character type (char or
5597 wchar_t) then an unsigned integer type with the same width as T.
5598 </para>
5599 <para>
5600 If T has any cv-qualifiers then these are also present on the result type.
5601 </para>
5602 <para>
5603 <emphasis role="bold">Requires:</emphasis> T must be an integer or enumerated
5604 type, and must not be the type bool.
5605 </para>
5606 <para>
5607 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.1.
5608 </para>
5609 <para>
5610 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5611 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">make_unsigned</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5612 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5613 </para>
5614 <table frame="all"> <title>Examples</title>
5615 <tgroup cols="2">
5616 <thead>
5617 <row>
5618 <entry>
5619 <para>
5620 Expression
5621 </para>
5622 </entry><entry>
5623 <para>
5624 Result Type
5625 </para>
5626 </entry>
5627 </row>
5628 </thead>
5629 <tbody>
5630 <row>
5631 <entry>
5632 <para>
5633 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5634 </para>
5635 </entry><entry>
5636 <para>
5637 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase></computeroutput>
5638 </para>
5639 </entry>
5640 </row>
5641 <row>
5642 <entry>
5643 <para>
5644 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase>
5645 <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5646 </para>
5647 </entry><entry>
5648 <para>
5649 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">unsigned</phrase> <phrase role="keyword">int</phrase>
5650 <phrase role="keyword">const</phrase></computeroutput>
5651 </para>
5652 </entry>
5653 </row>
5654 <row>
5655 <entry>
5656 <para>
5657 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase>
5658 <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5659 </para>
5660 </entry><entry>
5661 <para>
5662 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">const</phrase> <phrase role="keyword">unsigned</phrase>
5663 <phrase role="keyword">long</phrase> <phrase role="keyword">long</phrase></computeroutput>
5664 </para>
5665 </entry>
5666 </row>
5667 <row>
5668 <entry>
5669 <para>
5670 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">my_enum</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5671 </para>
5672 </entry><entry>
5673 <para>
5674 An unsigned integer type with the same width as the enum.
5675 </para>
5676 </entry>
5677 </row>
5678 <row>
5679 <entry>
5680 <para>
5681 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">make_signed</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">wchar_t</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5682 </para>
5683 </entry><entry>
5684 <para>
5685 An unsigned integer type with the same width as wchar_t.
5686 </para>
5687 </entry>
5688 </row>
5689 </tbody>
5690 </tgroup>
5691 </table>
5692 </section>
5693 <section id="boost_typetraits.reference.promote"><indexterm type="class_name"><primary>promote</primary><secondary>promote</secondary></indexterm>
5694 <title><link linkend="boost_typetraits.reference.promote"> promote</link></title>
5695
5696 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5697 <phrase role="keyword">struct</phrase> <phrase role="identifier">promote</phrase>
5698 <phrase role="special">{</phrase>
5699 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
5700 <phrase role="special">};</phrase>
5701 </programlisting>
5702 <para>
5703 <emphasis role="bold">type:</emphasis> If integral or floating point promotion
5704 can be applied to an rvalue of type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>,
5705 then applies integral and floating point promotions to <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
5706 and keeps cv-qualifiers of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>,
5707 otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged.
5708 See also <link linkend="boost_typetraits.reference.integral_promotion">integral_promotion</link>
5709 and <link linkend="boost_typetraits.reference.floating_point_promotion">floating_point_promotion</link>.
5710 </para>
5711 <para>
5712 <emphasis role="bold">C++ Standard Reference:</emphasis> 4.5 except 4.5/3
5713 (integral bit-field) and 4.6.
5714 </para>
5715 <para>
5716 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5717 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">promote</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5718 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5719 </para>
5720 <table frame="all"> <title>Examples</title>
5721 <tgroup cols="2">
5722 <thead>
5723 <row>
5724 <entry>
5725 <para>
5726 Expression
5727 </para>
5728 </entry><entry>
5729 <para>
5730 Result Type
5731 </para>
5732 </entry>
5733 </row>
5734 </thead>
5735 <tbody>
5736 <row>
5737 <entry>
5738 <para>
5739 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">short</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5740 </para>
5741 </entry><entry>
5742 <para>
5743 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput>
5744 </para>
5745 </entry>
5746 </row>
5747 <row>
5748 <entry>
5749 <para>
5750 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">float</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5751 </para>
5752 </entry><entry>
5753 <para>
5754 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">double</phrase> <phrase role="keyword">const</phrase></computeroutput>
5755 </para>
5756 </entry>
5757 </row>
5758 <row>
5759 <entry>
5760 <para>
5761 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">promote</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">short</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5762 </para>
5763 </entry><entry>
5764 <para>
5765 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">short</phrase><phrase role="special">&amp;</phrase></computeroutput>
5766 </para>
5767 </entry>
5768 </row>
5769 </tbody>
5770 </tgroup>
5771 </table>
5772 </section>
5773 <section id="boost_typetraits.reference.rank"><indexterm type="class_name"><primary>integral_constant</primary><secondary>rank</secondary></indexterm><indexterm><primary>rank</primary><secondary>integral_constant</secondary></indexterm>
5774 <title><link linkend="boost_typetraits.reference.rank"> rank</link></title>
5775
5776 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5777 <phrase role="keyword">struct</phrase> <phrase role="identifier">rank</phrase> <phrase role="special">:</phrase> <phrase role="keyword">public</phrase> <link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)&gt;</phrase> <phrase role="special">{};</phrase>
5778 </programlisting>
5779 <para>
5780 <emphasis role="bold">Inherits:</emphasis> Class template rank inherits from
5781 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)&gt;</phrase></computeroutput>,
5782 where <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> is the
5783 number of array dimensions in type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>.
5784 </para>
5785 <para>
5786 If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> is not an array type,
5787 then <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">RANK</phrase><phrase role="special">(</phrase><phrase role="identifier">T</phrase><phrase role="special">)</phrase></computeroutput> is zero.
5788 </para>
5789 <para>
5790 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5791 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">rank</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5792 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5793 </para>
5794 <para>
5795 <emphasis role="bold">Examples:</emphasis>
5796 </para>
5797 <blockquote>
5798 <para>
5799 <para>
5800 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[]&gt;</phrase></computeroutput>
5801 inherits from <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">1</phrase><phrase role="special">&gt;</phrase></computeroutput>.
5802 </para>
5803 </para>
5804 </blockquote>
5805 <blockquote>
5806 <para>
5807 <para>
5808 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">double</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><link linkend="boost_typetraits.reference.integral_constant">integral_constant</link><phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase><phrase role="special">,</phrase> <phrase role="number">3</phrase><phrase role="special">&gt;</phrase></computeroutput>.
5809 </para>
5810 </para>
5811 </blockquote>
5812 <blockquote>
5813 <para>
5814 <para>
5815 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">1</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput>
5816 is an integral constant expression that evaluates to <emphasis>1</emphasis>.
5817 </para>
5818 </para>
5819 </blockquote>
5820 <blockquote>
5821 <para>
5822 <para>
5823 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5824 that evaluates to <emphasis>2</emphasis>.
5825 </para>
5826 </para>
5827 </blockquote>
5828 <blockquote>
5829 <para>
5830 <para>
5831 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">value</phrase></computeroutput> is an integral constant expression
5832 that evaluates to <emphasis>0</emphasis>.
5833 </para>
5834 </para>
5835 </blockquote>
5836 <blockquote>
5837 <para>
5838 <para>
5839 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">rank</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">T</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">value_type</phrase></computeroutput> is the type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase></computeroutput>.
5840 </para>
5841 </para>
5842 </blockquote>
5843 </section>
5844 <section id="boost_typetraits.reference.remove_all_extents"><indexterm type="class_name"><primary>remove_all_extents</primary><secondary>remove_all_extents</secondary></indexterm>
5845 <title><link linkend="boost_typetraits.reference.remove_all_extents"> remove_all_extents</link></title>
5846
5847 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5848 <phrase role="keyword">struct</phrase> <phrase role="identifier">remove_all_extents</phrase>
5849 <phrase role="special">{</phrase>
5850 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
5851 <phrase role="special">};</phrase>
5852 </programlisting>
5853 <para>
5854 <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
5855 is an array type, then removes all of the array bounds on <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>,
5856 otherwise leaves <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged.
5857 </para>
5858 <para>
5859 <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.4.
5860 </para>
5861 <para>
5862 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
5863 does not support partial specialization of class-templates then this template
5864 will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
5865 will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
5866 except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
5867 workarounds</link> have been applied.
5868 </para>
5869 <para>
5870 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5871 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_all_extents</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5872 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5873 </para>
5874 <table frame="all"> <title>Examples</title>
5875 <tgroup cols="2">
5876 <thead>
5877 <row>
5878 <entry>
5879 <para>
5880 Expression
5881 </para>
5882 </entry><entry>
5883 <para>
5884 Result Type
5885 </para>
5886 </entry>
5887 </row>
5888 </thead>
5889 <tbody>
5890 <row>
5891 <entry>
5892 <para>
5893 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5894 </para>
5895 </entry><entry>
5896 <para>
5897 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
5898 </para>
5899 </entry>
5900 </row>
5901 <row>
5902 <entry>
5903 <para>
5904 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5905 </para>
5906 </entry><entry>
5907 <para>
5908 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput>
5909 </para>
5910 </entry>
5911 </row>
5912 <row>
5913 <entry>
5914 <para>
5915 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5916 </para>
5917 </entry><entry>
5918 <para>
5919 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
5920 </para>
5921 </entry>
5922 </row>
5923 <row>
5924 <entry>
5925 <para>
5926 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">3</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5927 </para>
5928 </entry><entry>
5929 <para>
5930 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
5931 </para>
5932 </entry>
5933 </row>
5934 <row>
5935 <entry>
5936 <para>
5937 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_all_extents</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5938 </para>
5939 </entry><entry>
5940 <para>
5941 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput>
5942 </para>
5943 </entry>
5944 </row>
5945 </tbody>
5946 </tgroup>
5947 </table>
5948 </section>
5949 <section id="boost_typetraits.reference.remove_const"><indexterm type="class_name"><primary>remove_const</primary><secondary>remove_const</secondary></indexterm>
5950 <title><link linkend="boost_typetraits.reference.remove_const"> remove_const</link></title>
5951
5952 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
5953 <phrase role="keyword">struct</phrase> <phrase role="identifier">remove_const</phrase>
5954 <phrase role="special">{</phrase>
5955 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
5956 <phrase role="special">};</phrase>
5957 </programlisting>
5958 <para>
5959 <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>,
5960 but with any <emphasis>top level</emphasis> const-qualifier removed.
5961 </para>
5962 <para>
5963 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3.
5964 </para>
5965 <para>
5966 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
5967 does not support partial specialization of class-templates then this template
5968 will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
5969 will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
5970 except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
5971 workarounds</link> have been applied.
5972 </para>
5973 <para>
5974 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
5975 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_const</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5976 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
5977 </para>
5978 <table frame="all"> <title>Examples</title>
5979 <tgroup cols="2">
5980 <thead>
5981 <row>
5982 <entry>
5983 <para>
5984 Expression
5985 </para>
5986 </entry><entry>
5987 <para>
5988 Result Type
5989 </para>
5990 </entry>
5991 </row>
5992 </thead>
5993 <tbody>
5994 <row>
5995 <entry>
5996 <para>
5997 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
5998 </para>
5999 </entry><entry>
6000 <para>
6001 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
6002 </para>
6003 </entry>
6004 </row>
6005 <row>
6006 <entry>
6007 <para>
6008 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6009 </para>
6010 </entry><entry>
6011 <para>
6012 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
6013 </para>
6014 </entry>
6015 </row>
6016 <row>
6017 <entry>
6018 <para>
6019 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase>
6020 <phrase role="keyword">volatile</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6021 </para>
6022 </entry><entry>
6023 <para>
6024 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase></computeroutput>
6025 </para>
6026 </entry>
6027 </row>
6028 <row>
6029 <entry>
6030 <para>
6031 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6032 </para>
6033 </entry><entry>
6034 <para>
6035 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;</phrase></computeroutput>
6036 </para>
6037 </entry>
6038 </row>
6039 <row>
6040 <entry>
6041 <para>
6042 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_const</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6043 </para>
6044 </entry><entry>
6045 <para>
6046 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput>
6047 </para>
6048 </entry>
6049 </row>
6050 </tbody>
6051 </tgroup>
6052 </table>
6053 </section>
6054 <section id="boost_typetraits.reference.remove_cv"><indexterm type="class_name"><primary>remove_cv</primary><secondary>remove_cv</secondary></indexterm>
6055 <title><link linkend="boost_typetraits.reference.remove_cv"> remove_cv</link></title>
6056
6057 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
6058 <phrase role="keyword">struct</phrase> <phrase role="identifier">remove_cv</phrase>
6059 <phrase role="special">{</phrase>
6060 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
6061 <phrase role="special">};</phrase>
6062 </programlisting>
6063 <para>
6064 <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>,
6065 but with any <emphasis>top level</emphasis> cv-qualifiers removed.
6066 </para>
6067 <para>
6068 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3.
6069 </para>
6070 <para>
6071 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
6072 does not support partial specialization of class-templates then this template
6073 will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
6074 will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
6075 except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
6076 workarounds</link> have been applied.
6077 </para>
6078 <para>
6079 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
6080 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_cv</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
6081 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
6082 </para>
6083 <table frame="all"> <title>Examples</title>
6084 <tgroup cols="2">
6085 <thead>
6086 <row>
6087 <entry>
6088 <para>
6089 Expression
6090 </para>
6091 </entry><entry>
6092 <para>
6093 Result Type
6094 </para>
6095 </entry>
6096 </row>
6097 </thead>
6098 <tbody>
6099 <row>
6100 <entry>
6101 <para>
6102 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6103 </para>
6104 </entry><entry>
6105 <para>
6106 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
6107 </para>
6108 </entry>
6109 </row>
6110 <row>
6111 <entry>
6112 <para>
6113 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6114 </para>
6115 </entry><entry>
6116 <para>
6117 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
6118 </para>
6119 </entry>
6120 </row>
6121 <row>
6122 <entry>
6123 <para>
6124 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase>
6125 <phrase role="keyword">volatile</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6126 </para>
6127 </entry><entry>
6128 <para>
6129 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
6130 </para>
6131 </entry>
6132 </row>
6133 <row>
6134 <entry>
6135 <para>
6136 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6137 </para>
6138 </entry><entry>
6139 <para>
6140 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;</phrase></computeroutput>
6141 </para>
6142 </entry>
6143 </row>
6144 <row>
6145 <entry>
6146 <para>
6147 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_cv</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6148 </para>
6149 </entry><entry>
6150 <para>
6151 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput>
6152 </para>
6153 </entry>
6154 </row>
6155 </tbody>
6156 </tgroup>
6157 </table>
6158 </section>
6159 <section id="boost_typetraits.reference.remove_extent"><indexterm type="class_name"><primary>remove_extent</primary><secondary>remove_extent</secondary></indexterm>
6160 <title><link linkend="boost_typetraits.reference.remove_extent"> remove_extent</link></title>
6161
6162 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
6163 <phrase role="keyword">struct</phrase> <phrase role="identifier">remove_extent</phrase>
6164 <phrase role="special">{</phrase>
6165 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
6166 <phrase role="special">};</phrase>
6167 </programlisting>
6168 <para>
6169 <emphasis role="bold">type:</emphasis> If <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
6170 is an array type, then removes the topmost array bound, otherwise leaves
6171 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput> unchanged.
6172 </para>
6173 <para>
6174 <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.4.
6175 </para>
6176 <para>
6177 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
6178 does not support partial specialization of class-templates then this template
6179 will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
6180 will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
6181 except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
6182 workarounds</link> have been applied.
6183 </para>
6184 <para>
6185 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
6186 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_extent</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
6187 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
6188 </para>
6189 <table frame="all"> <title>Examples</title>
6190 <tgroup cols="2">
6191 <thead>
6192 <row>
6193 <entry>
6194 <para>
6195 Expression
6196 </para>
6197 </entry><entry>
6198 <para>
6199 Result Type
6200 </para>
6201 </entry>
6202 </row>
6203 </thead>
6204 <tbody>
6205 <row>
6206 <entry>
6207 <para>
6208 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6209 </para>
6210 </entry><entry>
6211 <para>
6212 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
6213 </para>
6214 </entry>
6215 </row>
6216 <row>
6217 <entry>
6218 <para>
6219 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6220 </para>
6221 </entry><entry>
6222 <para>
6223 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput>
6224 </para>
6225 </entry>
6226 </row>
6227 <row>
6228 <entry>
6229 <para>
6230 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">][</phrase><phrase role="number">4</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6231 </para>
6232 </entry><entry>
6233 <para>
6234 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">4</phrase><phrase role="special">]</phrase></computeroutput>
6235 </para>
6236 </entry>
6237 </row>
6238 <row>
6239 <entry>
6240 <para>
6241 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">[][</phrase><phrase role="number">2</phrase><phrase role="special">]&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6242 </para>
6243 </entry><entry>
6244 <para>
6245 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">[</phrase><phrase role="number">2</phrase><phrase role="special">]</phrase></computeroutput>
6246 </para>
6247 </entry>
6248 </row>
6249 <row>
6250 <entry>
6251 <para>
6252 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_extent</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6253 </para>
6254 </entry><entry>
6255 <para>
6256 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput>
6257 </para>
6258 </entry>
6259 </row>
6260 </tbody>
6261 </tgroup>
6262 </table>
6263 </section>
6264 <section id="boost_typetraits.reference.remove_pointer"><indexterm type="class_name"><primary>remove_pointer</primary><secondary>remove_pointer</secondary></indexterm>
6265 <title><link linkend="boost_typetraits.reference.remove_pointer"> remove_pointer</link></title>
6266
6267 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
6268 <phrase role="keyword">struct</phrase> <phrase role="identifier">remove_pointer</phrase>
6269 <phrase role="special">{</phrase>
6270 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
6271 <phrase role="special">};</phrase>
6272 </programlisting>
6273 <para>
6274 <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>,
6275 but with any pointer modifier removed.
6276 </para>
6277 <para>
6278 <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.1.
6279 </para>
6280 <para>
6281 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
6282 does not support partial specialization of class-templates then this template
6283 will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
6284 will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
6285 except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
6286 workarounds</link> have been applied.
6287 </para>
6288 <para>
6289 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
6290 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_pointer</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
6291 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
6292 </para>
6293 <table frame="all"> <title>Examples</title>
6294 <tgroup cols="2">
6295 <thead>
6296 <row>
6297 <entry>
6298 <para>
6299 Expression
6300 </para>
6301 </entry><entry>
6302 <para>
6303 Result Type
6304 </para>
6305 </entry>
6306 </row>
6307 </thead>
6308 <tbody>
6309 <row>
6310 <entry>
6311 <para>
6312 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6313 </para>
6314 </entry><entry>
6315 <para>
6316 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
6317 </para>
6318 </entry>
6319 </row>
6320 <row>
6321 <entry>
6322 <para>
6323 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6324 </para>
6325 </entry><entry>
6326 <para>
6327 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput>
6328 </para>
6329 </entry>
6330 </row>
6331 <row>
6332 <entry>
6333 <para>
6334 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">**&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6335 </para>
6336 </entry><entry>
6337 <para>
6338 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput>
6339 </para>
6340 </entry>
6341 </row>
6342 <row>
6343 <entry>
6344 <para>
6345 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6346 </para>
6347 </entry><entry>
6348 <para>
6349 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">&amp;</phrase></computeroutput>
6350 </para>
6351 </entry>
6352 </row>
6353 <row>
6354 <entry>
6355 <para>
6356 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_pointer</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6357 </para>
6358 </entry><entry>
6359 <para>
6360 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*&amp;</phrase></computeroutput>
6361 </para>
6362 </entry>
6363 </row>
6364 </tbody>
6365 </tgroup>
6366 </table>
6367 </section>
6368 <section id="boost_typetraits.reference.remove_reference"><indexterm type="class_name"><primary>remove_reference</primary><secondary>remove_reference</secondary></indexterm>
6369 <title><link linkend="boost_typetraits.reference.remove_reference"> remove_reference</link></title>
6370
6371 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
6372 <phrase role="keyword">struct</phrase> <phrase role="identifier">remove_reference</phrase>
6373 <phrase role="special">{</phrase>
6374 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
6375 <phrase role="special">};</phrase>
6376 </programlisting>
6377 <para>
6378 <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>,
6379 but with any reference modifier removed.
6380 </para>
6381 <para>
6382 <emphasis role="bold">C++ Standard Reference:</emphasis> 8.3.2.
6383 </para>
6384 <para>
6385 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
6386 does not support partial specialization of class-templates then this template
6387 will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
6388 will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
6389 except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
6390 workarounds</link> have been applied.
6391 </para>
6392 <para>
6393 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
6394 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_reference</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
6395 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
6396 </para>
6397 <table frame="all"> <title>Examples</title>
6398 <tgroup cols="2">
6399 <thead>
6400 <row>
6401 <entry>
6402 <para>
6403 Expression
6404 </para>
6405 </entry><entry>
6406 <para>
6407 Result Type
6408 </para>
6409 </entry>
6410 </row>
6411 </thead>
6412 <tbody>
6413 <row>
6414 <entry>
6415 <para>
6416 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6417 </para>
6418 </entry><entry>
6419 <para>
6420 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
6421 </para>
6422 </entry>
6423 </row>
6424 <row>
6425 <entry>
6426 <para>
6427 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6428 </para>
6429 </entry><entry>
6430 <para>
6431 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput>
6432 </para>
6433 </entry>
6434 </row>
6435 <row>
6436 <entry>
6437 <para>
6438 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6439 </para>
6440 </entry><entry>
6441 <para>
6442 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput>
6443 </para>
6444 </entry>
6445 </row>
6446 <row>
6447 <entry>
6448 <para>
6449 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_reference</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">*&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6450 </para>
6451 </entry><entry>
6452 <para>
6453 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase><phrase role="special">*</phrase></computeroutput>
6454 </para>
6455 </entry>
6456 </row>
6457 </tbody>
6458 </tgroup>
6459 </table>
6460 </section>
6461 <section id="boost_typetraits.reference.remove_volatile"><indexterm type="class_name"><primary>remove_volatile</primary><secondary>remove_volatile</secondary></indexterm>
6462 <title><link linkend="boost_typetraits.reference.remove_volatile"> remove_volatile</link></title>
6463
6464 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
6465 <phrase role="keyword">struct</phrase> <phrase role="identifier">remove_volatile</phrase>
6466 <phrase role="special">{</phrase>
6467 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
6468 <phrase role="special">};</phrase>
6469 </programlisting>
6470 <para>
6471 <emphasis role="bold">type:</emphasis> The same type as <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>,
6472 but with any <emphasis>top level</emphasis> volatile-qualifier removed.
6473 </para>
6474 <para>
6475 <emphasis role="bold">C++ Standard Reference:</emphasis> 3.9.3.
6476 </para>
6477 <para>
6478 <emphasis role="bold">Compiler Compatibility:</emphasis> If the compiler
6479 does not support partial specialization of class-templates then this template
6480 will compile, but the member <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">type</phrase></computeroutput>
6481 will always be the same as type <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">T</phrase></computeroutput>
6482 except where <link linkend="boost_typetraits.category.transform.broken_compiler_workarounds_">compiler
6483 workarounds</link> have been applied.
6484 </para>
6485 <para>
6486 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
6487 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">remove_volatile</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
6488 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
6489 </para>
6490 <table frame="all"> <title>Examples</title>
6491 <tgroup cols="2">
6492 <thead>
6493 <row>
6494 <entry>
6495 <para>
6496 Expression
6497 </para>
6498 </entry><entry>
6499 <para>
6500 Result Type
6501 </para>
6502 </entry>
6503 </row>
6504 </thead>
6505 <tbody>
6506 <row>
6507 <entry>
6508 <para>
6509 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6510 </para>
6511 </entry><entry>
6512 <para>
6513 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
6514 </para>
6515 </entry>
6516 </row>
6517 <row>
6518 <entry>
6519 <para>
6520 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6521 </para>
6522 </entry><entry>
6523 <para>
6524 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase></computeroutput>
6525 </para>
6526 </entry>
6527 </row>
6528 <row>
6529 <entry>
6530 <para>
6531 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase>
6532 <phrase role="keyword">volatile</phrase><phrase role="special">&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6533 </para>
6534 </entry><entry>
6535 <para>
6536 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase></computeroutput>
6537 </para>
6538 </entry>
6539 </row>
6540 <row>
6541 <entry>
6542 <para>
6543 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">&amp;&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6544 </para>
6545 </entry><entry>
6546 <para>
6547 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">&amp;</phrase></computeroutput>
6548 </para>
6549 </entry>
6550 </row>
6551 <row>
6552 <entry>
6553 <para>
6554 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">remove_volatile</phrase><phrase role="special">&lt;</phrase><phrase role="keyword">int</phrase> <phrase role="keyword">volatile</phrase><phrase role="special">*&gt;::</phrase><phrase role="identifier">type</phrase></computeroutput>
6555 </para>
6556 </entry><entry>
6557 <para>
6558 <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">int</phrase> <phrase role="keyword">const</phrase><phrase role="special">*</phrase></computeroutput>
6559 </para>
6560 </entry>
6561 </row>
6562 </tbody>
6563 </tgroup>
6564 </table>
6565 </section>
6566 <section id="boost_typetraits.reference.type_with_alignment"><indexterm type="class_name"><primary>type_with_alignment</primary><secondary>type_with_alignment</secondary></indexterm>
6567 <title><link linkend="boost_typetraits.reference.type_with_alignment"> type_with_alignment</link></title>
6568
6569 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">size_t</phrase> <phrase role="identifier">Align</phrase><phrase role="special">&gt;</phrase>
6570 <phrase role="keyword">struct</phrase> <phrase role="identifier">type_with_alignment</phrase>
6571 <phrase role="special">{</phrase>
6572 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
6573 <phrase role="special">};</phrase>
6574 </programlisting>
6575 <para>
6576 <emphasis role="bold">type:</emphasis> a built-in or POD type with an alignment
6577 that is a multiple of <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="identifier">Align</phrase></computeroutput>.
6578 </para>
6579 <para>
6580 <emphasis role="bold">Header:</emphasis> <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase>
6581 <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">/</phrase><phrase role="identifier">type_with_alignment</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
6582 or <computeroutput xmlns:xi="http://www.w3.org/2001/XInclude"> <phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">type_traits</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">&gt;</phrase></computeroutput>
6583 </para>
6584 </section>
6585 </section>
6586 <section id="boost_typetraits.credits">
6587 <title><link linkend="boost_typetraits.credits"> Credits</link></title>
6588 <para>
6589 This documentation was pulled together by John Maddock, using <ulink url="../../../../doc/html/quickbook.html">Boost.Quickbook</ulink>
6590 and <ulink url="../../../../doc/html/boostbook.html">Boost.DocBook</ulink>.
6591 </para>
6592 <para>
6593 The original version of this library was created by Steve Cleary, Beman Dawes,
6594 Howard Hinnant, and John Maddock. John Maddock is the current maintainer of
6595 the library.
6596 </para>
6597 <para>
6598 This version of type traits library is based on contributions by Adobe Systems
6599 Inc, David Abrahams, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant,
6600 Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Thorsten Ottosen, Robert
6601 Ramey and Jeremy Siek.
6602 </para>
6603 <para>
6604 Mat Marcus and Jesse Jones invented, and <ulink url="http://opensource.adobe.com/project4/project.shtml">published
6605 a paper describing</ulink>, the partial specialization workarounds used in
6606 this library.
6607 </para>
6608 <para>
6609 Aleksey Gurtovoy added MPL integration to the library.
6610 </para>
6611 <para>
6612 The <link linkend="boost_typetraits.reference.is_convertible">is_convertible</link>
6613 template is based on code originally devised by Andrei Alexandrescu, see "<ulink url="http://www.cuj.com/experts/1810/alexandr.htm?topic=experts">Generic&lt;Programming&gt;:
6614 Mappings between Types and Values</ulink>".
6615 </para>
6616 <para>
6617 The latest version of this library and documentation can be found at <ulink url="http://www.boost.org">www.boost.org</ulink>. Bugs, suggestions and discussion
6618 should be directed to boost@lists.boost.org (see <ulink url="http://www.boost.org/more/mailing_lists.htm#main">www.boost.org/more/mailing_lists.htm#main</ulink>
6619 for subscription details).
6620 </para>
6621 </section>
6622
6623 <section id="boost_typetraits.ignored_section">
6624 <title>This section must not be indexed.</title>
6625 <?BoostAutoIndex IgnoreSection?>
6626 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
6627 <phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase>
6628 <phrase role="special">{</phrase>
6629 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
6630 <phrase role="special">};</phrase>
6631 </programlisting>
6632 </section>
6633
6634 <section id="boost_typetraits.ignored_block"><indexterm type="class_name"><primary>add_volatile</primary><secondary>This section contains one block that must not be indexed and one that should be.</secondary></indexterm><indexterm><primary>This section contains one block that must not be indexed and one that should be.</primary><secondary>add_volatile</secondary></indexterm>
6635 <title>This section contains one block that must not be indexed and one that should be.</title>
6636 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">
6637 <?BoostAutoIndex IgnoreBlock?>
6638 template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
6639 <phrase role="keyword">struct</phrase> <phrase role="identifier">add_const</phrase>
6640 <phrase role="special">{</phrase>
6641 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
6642 <phrase role="special">};</phrase>
6643 </programlisting>
6644 <programlisting xmlns:xi="http://www.w3.org/2001/XInclude"><phrase role="keyword">
6645 template</phrase> <phrase role="special">&lt;</phrase><phrase role="keyword">class</phrase> <phrase role="identifier">T</phrase><phrase role="special">&gt;</phrase>
6646 <phrase role="keyword">struct</phrase> <phrase role="identifier">add_volatile</phrase>
6647 <phrase role="special">{</phrase>
6648 <phrase role="keyword">typedef</phrase> <replaceable>see-below</replaceable> <phrase role="identifier">type</phrase><phrase role="special">;</phrase>
6649 <phrase role="special">};</phrase>
6650 </programlisting>
6651 </section>
6652
6653
6654 <index type="class_name">
6655 <title>Class Index</title>
6656 </index>
6657 <index type="typedef_name">
6658 <title>Typedef Index</title>
6659 </index>
6660 <index type="macro_name">
6661 <title>Macro Index</title>
6662 </index>
6663 <index type="test_index_1">
6664 <title>Index Test 1</title>
6665 </index>
6666 <index type="test_index_2">
6667 <title>Index Test 2</title>
6668 </index>
6669 <index/>
6670
6671 </chapter>