recursive_variant.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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_variant.hpp">
  10. <namespace name="boost">
  11. <typedef name="recursive_variant_">
  12. <type><emphasis>unspecified</emphasis></type>
  13. </typedef>
  14. <class name="make_recursive_variant">
  15. <purpose>Simplifies declaration of recursive <code>variant</code> types.</purpose>
  16. <template>
  17. <template-type-parameter name="T1"/>
  18. <template-type-parameter name="T2">
  19. <default><emphasis>unspecified</emphasis></default>
  20. </template-type-parameter>
  21. <template-varargs/>
  22. <template-type-parameter name="TN">
  23. <default><emphasis>unspecified</emphasis></default>
  24. </template-type-parameter>
  25. </template>
  26. <description>
  27. <para><code>type</code> has behavior equivalent in every respect to
  28. some <code>variant&lt; U1, U2, ..., UN &gt;</code>, where each type
  29. <code>U<emphasis>i</emphasis></code> is the result of the
  30. corresponding type <code>T<emphasis>i</emphasis></code> undergone a
  31. transformation function. The following pseudo-code specifies the
  32. behavior of this transformation (call it <code>substitute</code>):
  33. <itemizedlist>
  34. <listitem>If <code>T<emphasis>i</emphasis></code> is
  35. <code>boost::recursive_variant_</code> then:
  36. <code>variant&lt; U1, U2, ..., UN &gt;</code>;</listitem>
  37. <listitem>Else if <code>T<emphasis>i</emphasis></code> is of the
  38. form <code>X *</code> then:
  39. <code>substitute(X) *</code>;</listitem>
  40. <listitem>Else if <code>T<emphasis>i</emphasis></code> is of the
  41. form <code>X &amp;</code> then:
  42. <code>substitute(X) &amp;</code>;</listitem>
  43. <listitem>Else if <code>T<emphasis>i</emphasis></code> is of the
  44. form <code>R (*)( X1, X2, ..., XN )</code> then:
  45. <code>substitute(R) (*)( substitute(X1), substitute(X2), ..., substitute(XN) )</code>;</listitem>
  46. <listitem>Else if <code>T<emphasis>i</emphasis></code> is of the
  47. form <code>F &lt; X1, X2, ..., XN &gt;</code> then:
  48. <code>F&lt; substitute(X1), substitute(X2), ..., substitute(XN) &gt;</code>;</listitem>
  49. <listitem>Else: <code>T<emphasis>i</emphasis></code>.</listitem>
  50. </itemizedlist>
  51. </para>
  52. <para>Note that cv-qualifiers are preserved and that the actual
  53. process is generally a bit more complicated. However, the above does
  54. convey the essential idea as well as describe the extent of the
  55. substititions.</para>
  56. <para>Use of <code>make_recursive_variant</code> is demonstrated in
  57. <xref linkend="variant.tutorial.recursive.recursive-variant"/>.</para>
  58. <para><emphasis role="bold">Portability</emphasis>: Due to standard
  59. conformance issues in several compilers,
  60. <code>make_recursive_variant</code> is not universally supported. On
  61. these compilers the library indicates its lack of support via the
  62. definition of the preprocessor symbol
  63. <code><macroname>BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT</macroname></code>.</para>
  64. </description>
  65. <typedef name="type">
  66. <type><classname>boost::variant</classname>&lt; <emphasis>unspecified</emphasis> &gt;</type>
  67. </typedef>
  68. </class>
  69. <class name="make_recursive_variant_over">
  70. <purpose>
  71. <simpara>Exposes a recursive <code>variant</code> whose bounded types
  72. are the elements of the given type sequence.</simpara>
  73. </purpose>
  74. <template>
  75. <template-type-parameter name="Sequence"/>
  76. </template>
  77. <typedef name="type">
  78. <type>variant&lt; <emphasis>unspecified</emphasis> &gt;</type>
  79. </typedef>
  80. <description>
  81. <simpara><code>type</code> has behavior equivalent in every respect to
  82. <code><classname>make_recursive_variant</classname>&lt; Sequence[0], Sequence[1], ... &gt;::type</code>
  83. (where <code>Sequence[<emphasis>i</emphasis>]</code> denotes the
  84. <emphasis>i</emphasis>-th element of <code>Sequence</code>), except
  85. that no upper limit is imposed on the number of types.</simpara>
  86. <simpara><emphasis role="bold">Notes</emphasis>:</simpara>
  87. <itemizedlist>
  88. <listitem><code>Sequence</code> must meet the requirements of
  89. <libraryname>MPL</libraryname>'s <emphasis>Sequence</emphasis>
  90. concept.</listitem>
  91. <listitem>Due to standard conformance problems in several compilers,
  92. <code>make_recursive_variant_over</code> may not be supported on
  93. your compiler. See
  94. <code><macroname>BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT</macroname></code>
  95. for more information.</listitem>
  96. </itemizedlist>
  97. </description>
  98. </class>
  99. </namespace>
  100. </header>