1 | <?xml version="1.0" encoding="utf-8"?> |
---|
2 | <!DOCTYPE header PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" |
---|
3 | "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd"> |
---|
4 | <header name="boost/variant/recursive_wrapper.hpp"> |
---|
5 | <namespace name="boost"> |
---|
6 | |
---|
7 | <class name="recursive_wrapper"> |
---|
8 | <purpose>Solves circular dependencies, enabling recursive types.</purpose> |
---|
9 | |
---|
10 | <template> |
---|
11 | <template-type-parameter name="T"/> |
---|
12 | </template> |
---|
13 | |
---|
14 | <description> |
---|
15 | <simpara>The <code>recursive_wrapper</code> class template has an |
---|
16 | interface similar to a simple value container, but its content is |
---|
17 | allocated dynamically. This allows <code>recursive_wrapper</code> to |
---|
18 | hold types <code>T</code> whose member data leads to a circular |
---|
19 | dependency (e.g., a data member of <code>T</code> has a data member |
---|
20 | of type <code>T</code>).</simpara> |
---|
21 | |
---|
22 | <simpara>The application of <code>recursive_wrapper</code> is easiest |
---|
23 | understood in context. See |
---|
24 | <xref linkend="variant.tutorial.recursive.recursive-wrapper"/> for a |
---|
25 | demonstration of a common use of the class template.</simpara> |
---|
26 | |
---|
27 | <simpara><emphasis role="bold">Notes</emphasis>:</simpara> |
---|
28 | <itemizedlist> |
---|
29 | <listitem>Any type specified as the template argument to |
---|
30 | <code>recursive_wrapper</code> must be capable of construction via |
---|
31 | <code>operator new</code>. Thus, for instance, references are not |
---|
32 | supported.</listitem> |
---|
33 | </itemizedlist> |
---|
34 | </description> |
---|
35 | |
---|
36 | <typedef name="type"> |
---|
37 | <type>T</type> |
---|
38 | </typedef> |
---|
39 | |
---|
40 | <destructor> |
---|
41 | <purpose>Destructor.</purpose> |
---|
42 | <description> |
---|
43 | <simpara>Deletes the content of <code>*this</code>.</simpara> |
---|
44 | </description> |
---|
45 | |
---|
46 | <throws>Will not throw.</throws> |
---|
47 | </destructor> |
---|
48 | |
---|
49 | <constructor> |
---|
50 | <purpose>Default constructor.</purpose> |
---|
51 | <description> |
---|
52 | <simpara>Initializes <code>*this</code> by default construction of |
---|
53 | <code>T</code>.</simpara> |
---|
54 | </description> |
---|
55 | |
---|
56 | <requires> |
---|
57 | <simpara><code>T</code> must fulfill the requirements of the |
---|
58 | <emphasis>DefaultConstructible</emphasis> [20.1.4] |
---|
59 | concept.</simpara> |
---|
60 | </requires> |
---|
61 | |
---|
62 | <throws> |
---|
63 | <simpara>May fail with any exceptions arising from the default |
---|
64 | constructor of <code>T</code> or, in the event of |
---|
65 | insufficient memory, with <code>std::bad_alloc</code>.</simpara> |
---|
66 | </throws> |
---|
67 | </constructor> |
---|
68 | |
---|
69 | <constructor> |
---|
70 | <parameter name="other"> |
---|
71 | <paramtype>const recursive_wrapper &</paramtype> |
---|
72 | </parameter> |
---|
73 | |
---|
74 | <purpose>Copy constructor.</purpose> |
---|
75 | <description> |
---|
76 | <simpara>Copies the content of <code>other</code> into |
---|
77 | <code>*this</code>.</simpara> |
---|
78 | </description> |
---|
79 | |
---|
80 | <throws> |
---|
81 | <simpara>May fail with any exceptions arising from the |
---|
82 | copy constructor of <code>T</code> or, in the event of |
---|
83 | insufficient memory, with <code>std::bad_alloc</code>.</simpara> |
---|
84 | </throws> |
---|
85 | </constructor> |
---|
86 | |
---|
87 | <constructor> |
---|
88 | <parameter name="operand"> |
---|
89 | <paramtype>const T &</paramtype> |
---|
90 | </parameter> |
---|
91 | |
---|
92 | <purpose>Value constructor.</purpose> |
---|
93 | <description> |
---|
94 | <simpara>Copies <code>operand</code> into |
---|
95 | <code>*this</code>.</simpara> |
---|
96 | </description> |
---|
97 | |
---|
98 | <throws> |
---|
99 | <simpara>May fail with any exceptions arising from the |
---|
100 | copy constructor of <code>T</code> or, in the event of |
---|
101 | insufficient memory, with <code>std::bad_alloc</code>.</simpara> |
---|
102 | </throws> |
---|
103 | </constructor> |
---|
104 | |
---|
105 | <method-group name="modifiers"> |
---|
106 | |
---|
107 | <method name="swap"> |
---|
108 | <type>void</type> |
---|
109 | |
---|
110 | <parameter name="other"> |
---|
111 | <paramtype>recursive_wrapper &</paramtype> |
---|
112 | </parameter> |
---|
113 | |
---|
114 | <description> |
---|
115 | <simpara>Exchanges contents of <code>*this</code> and |
---|
116 | <code>other</code>.</simpara> |
---|
117 | </description> |
---|
118 | |
---|
119 | <throws>Will not throw.</throws> |
---|
120 | </method> |
---|
121 | |
---|
122 | <method name="operator="> |
---|
123 | <type>recursive_wrapper &</type> |
---|
124 | |
---|
125 | <parameter name="rhs"> |
---|
126 | <paramtype>const recursive_wrapper &</paramtype> |
---|
127 | </parameter> |
---|
128 | |
---|
129 | <purpose>Copy assignment operator.</purpose> |
---|
130 | <description> |
---|
131 | <simpara>Assigns the content of <code>rhs</code> to the content of |
---|
132 | <code>*this</code>.</simpara> |
---|
133 | </description> |
---|
134 | |
---|
135 | <requires> |
---|
136 | <simpara><code>T</code> must fulfill the requirements of |
---|
137 | the <conceptname>Assignable</conceptname> |
---|
138 | concept.</simpara> |
---|
139 | </requires> |
---|
140 | |
---|
141 | <throws> |
---|
142 | <simpara>May fail with any exceptions arising from the assignment |
---|
143 | operator of <code>T</code>.</simpara> |
---|
144 | </throws> |
---|
145 | </method> |
---|
146 | |
---|
147 | <method name="operator="> |
---|
148 | <type>recursive_wrapper &</type> |
---|
149 | |
---|
150 | <parameter name="rhs"> |
---|
151 | <paramtype>const T &</paramtype> |
---|
152 | </parameter> |
---|
153 | |
---|
154 | <purpose>Value assignment operator.</purpose> |
---|
155 | <description> |
---|
156 | <simpara>Assigns <code>rhs</code> into the content of |
---|
157 | <code>*this</code>.</simpara> |
---|
158 | </description> |
---|
159 | |
---|
160 | <requires> |
---|
161 | <simpara><code>T</code> must fulfill the requirements of the |
---|
162 | <conceptname>Assignable</conceptname> |
---|
163 | concept.</simpara> |
---|
164 | </requires> |
---|
165 | |
---|
166 | <throws> |
---|
167 | <simpara>May fail with any exceptions arising from the assignment |
---|
168 | operator of <code>T</code>.</simpara> |
---|
169 | </throws> |
---|
170 | </method> |
---|
171 | |
---|
172 | </method-group> |
---|
173 | |
---|
174 | <method-group name="queries"> |
---|
175 | |
---|
176 | <overloaded-method name="get"> |
---|
177 | <signature> |
---|
178 | <type>T &</type> |
---|
179 | </signature> |
---|
180 | <signature cv="const"> |
---|
181 | <type>const T &</type> |
---|
182 | </signature> |
---|
183 | |
---|
184 | <description> |
---|
185 | <simpara>Returns a reference to the content of |
---|
186 | <code>*this</code>.</simpara> |
---|
187 | </description> |
---|
188 | |
---|
189 | <throws>Will not throw.</throws> |
---|
190 | </overloaded-method> |
---|
191 | |
---|
192 | <overloaded-method name="get_pointer"> |
---|
193 | <signature> |
---|
194 | <type>T *</type> |
---|
195 | </signature> |
---|
196 | <signature cv="const"> |
---|
197 | <type>const T *</type> |
---|
198 | </signature> |
---|
199 | |
---|
200 | <description> |
---|
201 | <simpara>Returns a pointer to the content of |
---|
202 | <code>*this</code>.</simpara> |
---|
203 | </description> |
---|
204 | |
---|
205 | <throws>Will not throw.</throws> |
---|
206 | </overloaded-method> |
---|
207 | |
---|
208 | </method-group> |
---|
209 | |
---|
210 | </class> |
---|
211 | |
---|
212 | <class name="is_recursive_wrapper"> |
---|
213 | <purpose> |
---|
214 | <simpara>Determines whether the specified type is a specialization of |
---|
215 | <code>recursive_wrapper</code>.</simpara> |
---|
216 | </purpose> |
---|
217 | |
---|
218 | <template> |
---|
219 | <template-type-parameter name="T"/> |
---|
220 | </template> |
---|
221 | |
---|
222 | <description> |
---|
223 | <simpara>Value is true iff <code>T</code> is a specialization of |
---|
224 | <code><classname>recursive_wrapper</classname></code>.</simpara> |
---|
225 | <simpara><emphasis role="bold">Note</emphasis>: |
---|
226 | <code>is_recursive_wrapper</code> is a model of |
---|
227 | <libraryname>MPL</libraryname>'s |
---|
228 | <emphasis>IntegralConstant</emphasis> concept.</simpara> |
---|
229 | </description> |
---|
230 | |
---|
231 | <typedef name="type"> |
---|
232 | <type><emphasis>unspecified</emphasis></type> |
---|
233 | </typedef> |
---|
234 | |
---|
235 | <static-constant name="value"> |
---|
236 | <type>bool</type> |
---|
237 | <default><emphasis>unspecified</emphasis></default> |
---|
238 | </static-constant> |
---|
239 | </class> |
---|
240 | |
---|
241 | <class name="unwrap_recursive_wrapper"> |
---|
242 | <purpose> |
---|
243 | <simpara>Unwraps the specified argument if given a specialization of |
---|
244 | <code><classname>recursive_wrapper</classname></code>.</simpara> |
---|
245 | </purpose> |
---|
246 | |
---|
247 | <template> |
---|
248 | <template-type-parameter name="T"/> |
---|
249 | </template> |
---|
250 | |
---|
251 | <description> |
---|
252 | <simpara><code>type</code> is equivalent to <code>T::type</code> if |
---|
253 | <code>T</code> is a specialization of |
---|
254 | <code><classname>recursive_wrapper</classname></code>. Otherwise, |
---|
255 | <code>type</code> is equivalent to <code>T</code>.</simpara> |
---|
256 | </description> |
---|
257 | |
---|
258 | <typedef name="type"> |
---|
259 | <type><emphasis>unspecified</emphasis></type> |
---|
260 | </typedef> |
---|
261 | </class> |
---|
262 | |
---|
263 | </namespace> |
---|
264 | </header> |
---|