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