Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/variant/doc/reference/recursive_variant.xml @ 14

Last change on this file since 14 was 12, checked in by landauf, 17 years ago

added boost

File size: 5.0 KB
Line 
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&lt; U1, U2, ..., UN &gt;</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&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
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>&lt; <emphasis>unspecified</emphasis> &gt;</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&lt; <emphasis>unspecified</emphasis> &gt;</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>&lt; Sequence[0], Sequence[1], ... &gt;::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>
Note: See TracBrowser for help on using the repository browser.