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">
5 Copyright 2003, Eric Friedman, Itay Maman.
6 Copyright 2016, Antony Polukhin.
8 Distributed under the Boost Software License, Version 1.0. (See accompanying
9 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 <header name=
"boost/variant/variant_fwd.hpp">
12 <using-namespace name=
"boost"/>
14 <para>Provides forward declarations of the
15 <code><classname>boost::variant
</classname></code>,
16 <code><classname>boost::make_variant_over
</classname></code>,
17 <code><classname>boost::make_recursive_variant
</classname></code>, and
18 <code><classname>boost::make_recursive_variant_over
</classname></code>
19 class templates and the
<code>boost::recursive_variant_
</code> tag type.
20 Also defines several preprocessor symbols, as described below.
</para>
22 <macro name=
"BOOST_VARIANT_LIMIT_TYPES">
24 <simpara>Expands to the length of the
25 template parameter list for
26 <code><classname>variant
</classname></code>. Not used if
27 <code><macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
</macroname></code>
33 <para><emphasis role=
"bold">Note
</emphasis>: Conforming
34 implementations of
<code>variant
</code> must allow at least ten
35 template arguments. That is, BOOST_VARIANT_LIMIT_TYPES must be greater
36 or equal to
<code>10</code>.
</para>
40 <macro name=
"BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES">
42 <simpara>If this macro is defined, then library won't use C++
11 variadic templates.
43 Users may define this macro to make
44 <code><macroname>BOOST_VARIANT_ENUM_PARAMS
</macroname></code>
45 and
<code><macroname>BOOST_VARIANT_ENUM_SHIFTED_PARAMS
</macroname></code> expand
46 to a comma-separated sequence instead of variadic templates. Define this macro if
47 your compiler has problems with compilation of variadic templates.
52 <macro name=
"BOOST_VARIANT_ENUM_PARAMS" kind=
"functionlike">
53 <macro-parameter name=
"param"/>
56 <simpara>Enumerate parameters for use with
57 <code><classname>variant
</classname></code>.
</simpara>
61 <para> When variadic templates are available and
62 <code><macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
</macroname></code>
63 is not defined, expands to variadic template list in the following manner:
64 <code><programlisting>
65 BOOST_VARIANT_ENUM_PARAMS(T) =
> T0, TN...
66 BOOST_VARIANT_ENUM_PARAMS(class T) =
> class T0, class... TN
67 BOOST_VARIANT_ENUM_PARAMS(class Something) =
> class Something0, class... SomethingN
68 BOOST_VARIANT_ENUM_PARAMS(typename Something) =
> typename Something0, typename... SomethingN
69 BOOST_VARIANT_ENUM_PARAMS(Something) =
> Something0, SomethingN...
70 BOOST_VARIANT_ENUM_PARAMS(Something) =
> Something0, SomethingN...
71 </programlisting></code>
75 Otherwise expands to a comma-separated sequence of length
76 <code><macroname>BOOST_VARIANT_LIMIT_TYPES
</macroname></code>, where
77 each element in the sequence consists of the concatenation of
78 <emphasis>param
</emphasis> with its zero-based index into the
80 <code>param ##
0, param ##
1, ..., param ## BOOST_VARIANT_LIMIT_TYPES -
1</code>.
</para>
82 <para><emphasis role=
"bold">Rationale
</emphasis>: This macro greatly
83 simplifies for the user the process of declaring
84 <code><classname>variant
</classname></code> types
85 in function templates or explicit partial specializations of class
86 templates, as shown in the
87 <link linkend=
"variant.tutorial.preprocessor">tutorial
</link>.
</para>
91 <macro name=
"BOOST_VARIANT_ENUM_SHIFTED_PARAMS" kind=
"functionlike">
92 <macro-parameter name=
"param"/>
95 <simpara>Enumerate all but the first parameter for use with
96 <code><classname>variant
</classname></code>.
</simpara>
100 <para> When variadic templates are available and
101 <code><macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
</macroname></code>
102 is not defined, expands to variadic template list in the following manner:
103 <code><programlisting>
104 BOOST_VARIANT_ENUM_SHIFTED_PARAMS(T) =
> TN...
105 BOOST_VARIANT_ENUM_SHIFTED_PARAMS(class T) =
> class... TN
106 BOOST_VARIANT_ENUM_SHIFTED_PARAMS(class Something) =
> class... SomethingN
107 BOOST_VARIANT_ENUM_SHIFTED_PARAMS(typename Something) =
> typename... SomethingN
108 BOOST_VARIANT_ENUM_SHIFTED_PARAMS(Something) =
> SomethingN...
109 BOOST_VARIANT_ENUM_SHIFTED_PARAMS(Something) =
> SomethingN...
110 </programlisting></code>
114 Otherwise expands to a comma-separated sequence of length
115 <code><macroname>BOOST_VARIANT_LIMIT_TYPES
</macroname> -
1</code>,
116 where each element in the sequence consists of the concatenation of
117 <emphasis>param
</emphasis> with its one-based index into the sequence.
119 <code>param ##
1, ..., param ## BOOST_VARIANT_LIMIT_TYPES -
1</code>.
</para>
121 <para><emphasis role=
"bold">Note
</emphasis>: This macro results in the
123 <code><macroname>BOOST_VARIANT_ENUM_PARAMS
</macroname></code> -- but
124 without the first term.
</para>
128 <macro name=
"BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT">
130 <simpara>Indicates absence of support for specifying the bounded types
131 of a
<code><classname>variant
</classname></code> by the elements of a
132 type sequence.
</simpara>
136 <para>Defined only if
137 <code><classname>make_variant_over
</classname></code> and
138 <code><classname>make_recursive_variant_over
</classname></code>
139 are not supported for some reason on the target compiler.
</para>
143 <macro name=
"BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT">
146 <code><classname>make_recursive_variant
</classname></code> operates in
147 an implementation-defined manner.
</simpara>
151 <para>Defined only if
152 <code><classname>make_recursive_variant
</classname></code> does not
153 operate as documented on the target compiler, but rather in an
154 implementation-defined manner.
</para>
156 <para><emphasis role=
"bold">Implementation Note
</emphasis>: If
157 <code>BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT
</code> is
158 defined for the target compiler, the current implementation uses the
159 <libraryname>MPL
</libraryname> lambda mechanism to approximate the
160 desired behavior. (In most cases, however, such compilers do not have
161 full lambda support either.)
</para>