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 Copyright 2016-2021 Antony Polukhin. 7 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) 10--> 11<header name="boost/variant/variant_fwd.hpp"> 12 <using-namespace name="boost"/> 13 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> 21 22 <macro name="BOOST_VARIANT_LIMIT_TYPES"> 23 <purpose> 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> 28 is not defined. 29 </simpara> 30 </purpose> 31 32 <description> 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> 37 </description> 38 </macro> 39 40 <macro name="BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES"> 41 <purpose> 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. 48 </simpara> 49 </purpose> 50 </macro> 51 52 <macro name="BOOST_VARIANT_ENUM_PARAMS" kind="functionlike"> 53 <macro-parameter name="param"/> 54 55 <purpose> 56 <simpara>Enumerate parameters for use with 57 <code><classname>variant</classname></code>.</simpara> 58 </purpose> 59 60 <description> 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> 72 </para> 73 74 <para> 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 79 sequence. That is, 80 <code>param ## 0, param ## 1, ..., param ## BOOST_VARIANT_LIMIT_TYPES - 1</code>.</para> 81 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> 88 </description> 89 </macro> 90 91 <macro name="BOOST_VARIANT_ENUM_SHIFTED_PARAMS" kind="functionlike"> 92 <macro-parameter name="param"/> 93 94 <purpose> 95 <simpara>Enumerate all but the first parameter for use with 96 <code><classname>variant</classname></code>.</simpara> 97 </purpose> 98 99 <description> 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> 111 </para> 112 113 <para> 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. 118 That is, 119 <code>param ## 1, ..., param ## BOOST_VARIANT_LIMIT_TYPES - 1</code>.</para> 120 121 <para><emphasis role="bold">Note</emphasis>: This macro results in the 122 same expansion as 123 <code><macroname>BOOST_VARIANT_ENUM_PARAMS</macroname></code> -- but 124 without the first term.</para> 125 </description> 126 </macro> 127 128 <macro name="BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT"> 129 <purpose> 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> 133 </purpose> 134 135 <description> 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> 140 </description> 141 </macro> 142 143 <macro name="BOOST_VARIANT_DO_NOT_SPECIALIZE_STD_HASH"> 144 <purpose> 145 <simpara>Define this macro if you do not wish to have a <code><classname>std::hash</classname></code> specialization for 146 <code><classname>boost::variant</classname></code>.</simpara> 147 </purpose> 148 </macro> 149 150 <macro name="BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT"> 151 <purpose> 152 <simpara>Indicates 153 <code><classname>make_recursive_variant</classname></code> operates in 154 an implementation-defined manner.</simpara> 155 </purpose> 156 157 <description> 158 <para>Defined only if 159 <code><classname>make_recursive_variant</classname></code> does not 160 operate as documented on the target compiler, but rather in an 161 implementation-defined manner.</para> 162 163 <para><emphasis role="bold">Implementation Note</emphasis>: If 164 <code>BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT</code> is 165 defined for the target compiler, the current implementation uses the 166 <libraryname>MPL</libraryname> lambda mechanism to approximate the 167 desired behavior. (In most cases, however, such compilers do not have 168 full lambda support either.)</para> 169 </description> 170 </macro> 171</header> 172