recursive_wrapper.xml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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. <!--
  5. Copyright 2003, Eric Friedman, Itay Maman.
  6. Distributed under the Boost Software License, Version 1.0. (See accompanying
  7. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  8. -->
  9. <header name="boost/variant/recursive_wrapper.hpp">
  10. <namespace name="boost">
  11. <class name="recursive_wrapper">
  12. <purpose>Solves circular dependencies, enabling recursive types.</purpose>
  13. <template>
  14. <template-type-parameter name="T"/>
  15. </template>
  16. <description>
  17. <simpara>The <code>recursive_wrapper</code> class template has an
  18. interface similar to a simple value container, but its content is
  19. allocated dynamically. This allows <code>recursive_wrapper</code> to
  20. hold types <code>T</code> whose member data leads to a circular
  21. dependency (e.g., a data member of <code>T</code> has a data member
  22. of type <code>T</code>).</simpara>
  23. <simpara>The application of <code>recursive_wrapper</code> is easiest
  24. understood in context. See
  25. <xref linkend="variant.tutorial.recursive.recursive-wrapper"/> for a
  26. demonstration of a common use of the class template.</simpara>
  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. <typedef name="type">
  36. <type>T</type>
  37. </typedef>
  38. <destructor>
  39. <purpose>Destructor.</purpose>
  40. <description>
  41. <simpara>Deletes the content of <code>*this</code>.</simpara>
  42. </description>
  43. <throws>Will not throw.</throws>
  44. </destructor>
  45. <constructor>
  46. <purpose>Default constructor.</purpose>
  47. <description>
  48. <simpara>Initializes <code>*this</code> by default construction of
  49. <code>T</code>.</simpara>
  50. </description>
  51. <requires>
  52. <simpara><code>T</code> must fulfill the requirements of the
  53. <emphasis>DefaultConstructible</emphasis> [20.1.4]
  54. concept.</simpara>
  55. </requires>
  56. <throws>
  57. <simpara>May fail with any exceptions arising from the default
  58. constructor of <code>T</code> or, in the event of
  59. insufficient memory, with <code>std::bad_alloc</code>.</simpara>
  60. </throws>
  61. </constructor>
  62. <constructor>
  63. <parameter name="other">
  64. <paramtype>const recursive_wrapper &amp;</paramtype>
  65. </parameter>
  66. <purpose>Copy constructor.</purpose>
  67. <description>
  68. <simpara>Copies the content of <code>other</code> into
  69. <code>*this</code>.</simpara>
  70. </description>
  71. <throws>
  72. <simpara>May fail with any exceptions arising from the
  73. copy constructor of <code>T</code> or, in the event of
  74. insufficient memory, with <code>std::bad_alloc</code>.</simpara>
  75. </throws>
  76. </constructor>
  77. <constructor>
  78. <parameter name="operand">
  79. <paramtype>const T &amp;</paramtype>
  80. </parameter>
  81. <purpose>Value constructor.</purpose>
  82. <description>
  83. <simpara>Copies <code>operand</code> into
  84. <code>*this</code>.</simpara>
  85. </description>
  86. <throws>
  87. <simpara>May fail with any exceptions arising from the
  88. copy constructor of <code>T</code> or, in the event of
  89. insufficient memory, with <code>std::bad_alloc</code>.</simpara>
  90. </throws>
  91. </constructor>
  92. <method-group name="modifiers">
  93. <method name="swap">
  94. <type>void</type>
  95. <parameter name="other">
  96. <paramtype>recursive_wrapper &amp;</paramtype>
  97. </parameter>
  98. <description>
  99. <simpara>Exchanges contents of <code>*this</code> and
  100. <code>other</code>.</simpara>
  101. </description>
  102. <throws>Will not throw.</throws>
  103. </method>
  104. <method name="operator=">
  105. <type>recursive_wrapper &amp;</type>
  106. <parameter name="rhs">
  107. <paramtype>const recursive_wrapper &amp;</paramtype>
  108. </parameter>
  109. <purpose>Copy assignment operator.</purpose>
  110. <description>
  111. <simpara>Assigns the content of <code>rhs</code> to the content of
  112. <code>*this</code>.</simpara>
  113. </description>
  114. <requires>
  115. <simpara><code>T</code> must fulfill the requirements of
  116. the <conceptname>Assignable</conceptname>
  117. concept.</simpara>
  118. </requires>
  119. <throws>
  120. <simpara>May fail with any exceptions arising from the assignment
  121. operator of <code>T</code>.</simpara>
  122. </throws>
  123. </method>
  124. <method name="operator=">
  125. <type>recursive_wrapper &amp;</type>
  126. <parameter name="rhs">
  127. <paramtype>const T &amp;</paramtype>
  128. </parameter>
  129. <purpose>Value assignment operator.</purpose>
  130. <description>
  131. <simpara>Assigns <code>rhs</code> into the content of
  132. <code>*this</code>.</simpara>
  133. </description>
  134. <requires>
  135. <simpara><code>T</code> must fulfill the requirements of the
  136. <conceptname>Assignable</conceptname>
  137. concept.</simpara>
  138. </requires>
  139. <throws>
  140. <simpara>May fail with any exceptions arising from the assignment
  141. operator of <code>T</code>.</simpara>
  142. </throws>
  143. </method>
  144. </method-group>
  145. <method-group name="queries">
  146. <overloaded-method name="get">
  147. <signature>
  148. <type>T &amp;</type>
  149. </signature>
  150. <signature cv="const">
  151. <type>const T &amp;</type>
  152. </signature>
  153. <description>
  154. <simpara>Returns a reference to the content of
  155. <code>*this</code>.</simpara>
  156. </description>
  157. <throws>Will not throw.</throws>
  158. </overloaded-method>
  159. <overloaded-method name="get_pointer">
  160. <signature>
  161. <type>T *</type>
  162. </signature>
  163. <signature cv="const">
  164. <type>const T *</type>
  165. </signature>
  166. <description>
  167. <simpara>Returns a pointer to the content of
  168. <code>*this</code>.</simpara>
  169. </description>
  170. <throws>Will not throw.</throws>
  171. </overloaded-method>
  172. </method-group>
  173. </class>
  174. <class name="is_recursive_wrapper">
  175. <purpose>
  176. <simpara>Determines whether the specified type is a specialization of
  177. <code>recursive_wrapper</code>.</simpara>
  178. </purpose>
  179. <template>
  180. <template-type-parameter name="T"/>
  181. </template>
  182. <description>
  183. <simpara>Value is true iff <code>T</code> is a specialization of
  184. <code><classname>recursive_wrapper</classname></code>.</simpara>
  185. <simpara><emphasis role="bold">Note</emphasis>:
  186. <code>is_recursive_wrapper</code> is a model of
  187. <libraryname>MPL</libraryname>'s
  188. <emphasis>IntegralConstant</emphasis> concept.</simpara>
  189. </description>
  190. <typedef name="type">
  191. <type><emphasis>unspecified</emphasis></type>
  192. </typedef>
  193. <static-constant name="value">
  194. <type>bool</type>
  195. <default><emphasis>unspecified</emphasis></default>
  196. </static-constant>
  197. </class>
  198. <class name="unwrap_recursive_wrapper">
  199. <purpose>
  200. <simpara>Unwraps the specified argument if given a specialization of
  201. <code><classname>recursive_wrapper</classname></code>.</simpara>
  202. </purpose>
  203. <template>
  204. <template-type-parameter name="T"/>
  205. </template>
  206. <description>
  207. <simpara><code>type</code> is equivalent to <code>T::type</code> if
  208. <code>T</code> is a specialization of
  209. <code><classname>recursive_wrapper</classname></code>. Otherwise,
  210. <code>type</code> is equivalent to <code>T</code>.</simpara>
  211. </description>
  212. <typedef name="type">
  213. <type><emphasis>unspecified</emphasis></type>
  214. </typedef>
  215. </class>
  216. </namespace>
  217. </header>