variant_fwd.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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-2019 Antony Polukhin.
  7. Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. -->
  10. <header name="boost/variant/variant_fwd.hpp">
  11. <using-namespace name="boost"/>
  12. <para>Provides forward declarations of the
  13. <code><classname>boost::variant</classname></code>,
  14. <code><classname>boost::make_variant_over</classname></code>,
  15. <code><classname>boost::make_recursive_variant</classname></code>, and
  16. <code><classname>boost::make_recursive_variant_over</classname></code>
  17. class templates and the <code>boost::recursive_variant_</code> tag type.
  18. Also defines several preprocessor symbols, as described below.</para>
  19. <macro name="BOOST_VARIANT_LIMIT_TYPES">
  20. <purpose>
  21. <simpara>Expands to the length of the
  22. template parameter list for
  23. <code><classname>variant</classname></code>. Not used if
  24. <code><macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname></code>
  25. is not defined.
  26. </simpara>
  27. </purpose>
  28. <description>
  29. <para><emphasis role="bold">Note</emphasis>: Conforming
  30. implementations of <code>variant</code> must allow at least ten
  31. template arguments. That is, BOOST_VARIANT_LIMIT_TYPES must be greater
  32. or equal to <code>10</code>.</para>
  33. </description>
  34. </macro>
  35. <macro name="BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES">
  36. <purpose>
  37. <simpara>If this macro is defined, then library won't use C++11 variadic templates.
  38. Users may define this macro to make
  39. <code><macroname>BOOST_VARIANT_ENUM_PARAMS</macroname></code>
  40. and <code><macroname>BOOST_VARIANT_ENUM_SHIFTED_PARAMS</macroname></code> expand
  41. to a comma-separated sequence instead of variadic templates. Define this macro if
  42. your compiler has problems with compilation of variadic templates.
  43. </simpara>
  44. </purpose>
  45. </macro>
  46. <macro name="BOOST_VARIANT_ENUM_PARAMS" kind="functionlike">
  47. <macro-parameter name="param"/>
  48. <purpose>
  49. <simpara>Enumerate parameters for use with
  50. <code><classname>variant</classname></code>.</simpara>
  51. </purpose>
  52. <description>
  53. <para> When variadic templates are available and
  54. <code><macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname></code>
  55. is not defined, expands to variadic template list in the following manner:
  56. <code><programlisting>
  57. BOOST_VARIANT_ENUM_PARAMS(T) => T0, TN...
  58. BOOST_VARIANT_ENUM_PARAMS(class T) => class T0, class... TN
  59. BOOST_VARIANT_ENUM_PARAMS(class Something) => class Something0, class... SomethingN
  60. BOOST_VARIANT_ENUM_PARAMS(typename Something) => typename Something0, typename... SomethingN
  61. BOOST_VARIANT_ENUM_PARAMS(Something) => Something0, SomethingN...
  62. BOOST_VARIANT_ENUM_PARAMS(Something) => Something0, SomethingN...
  63. </programlisting></code>
  64. </para>
  65. <para>
  66. Otherwise expands to a comma-separated sequence of length
  67. <code><macroname>BOOST_VARIANT_LIMIT_TYPES</macroname></code>, where
  68. each element in the sequence consists of the concatenation of
  69. <emphasis>param</emphasis> with its zero-based index into the
  70. sequence. That is,
  71. <code>param ## 0, param ## 1, ..., param ## BOOST_VARIANT_LIMIT_TYPES - 1</code>.</para>
  72. <para><emphasis role="bold">Rationale</emphasis>: This macro greatly
  73. simplifies for the user the process of declaring
  74. <code><classname>variant</classname></code> types
  75. in function templates or explicit partial specializations of class
  76. templates, as shown in the
  77. <link linkend="variant.tutorial.preprocessor">tutorial</link>.</para>
  78. </description>
  79. </macro>
  80. <macro name="BOOST_VARIANT_ENUM_SHIFTED_PARAMS" kind="functionlike">
  81. <macro-parameter name="param"/>
  82. <purpose>
  83. <simpara>Enumerate all but the first parameter for use with
  84. <code><classname>variant</classname></code>.</simpara>
  85. </purpose>
  86. <description>
  87. <para> When variadic templates are available and
  88. <code><macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname></code>
  89. is not defined, expands to variadic template list in the following manner:
  90. <code><programlisting>
  91. BOOST_VARIANT_ENUM_SHIFTED_PARAMS(T) => TN...
  92. BOOST_VARIANT_ENUM_SHIFTED_PARAMS(class T) => class... TN
  93. BOOST_VARIANT_ENUM_SHIFTED_PARAMS(class Something) => class... SomethingN
  94. BOOST_VARIANT_ENUM_SHIFTED_PARAMS(typename Something) => typename... SomethingN
  95. BOOST_VARIANT_ENUM_SHIFTED_PARAMS(Something) => SomethingN...
  96. BOOST_VARIANT_ENUM_SHIFTED_PARAMS(Something) => SomethingN...
  97. </programlisting></code>
  98. </para>
  99. <para>
  100. Otherwise expands to a comma-separated sequence of length
  101. <code><macroname>BOOST_VARIANT_LIMIT_TYPES</macroname> - 1</code>,
  102. where each element in the sequence consists of the concatenation of
  103. <emphasis>param</emphasis> with its one-based index into the sequence.
  104. That is,
  105. <code>param ## 1, ..., param ## BOOST_VARIANT_LIMIT_TYPES - 1</code>.</para>
  106. <para><emphasis role="bold">Note</emphasis>: This macro results in the
  107. same expansion as
  108. <code><macroname>BOOST_VARIANT_ENUM_PARAMS</macroname></code> -- but
  109. without the first term.</para>
  110. </description>
  111. </macro>
  112. <macro name="BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT">
  113. <purpose>
  114. <simpara>Indicates absence of support for specifying the bounded types
  115. of a <code><classname>variant</classname></code> by the elements of a
  116. type sequence.</simpara>
  117. </purpose>
  118. <description>
  119. <para>Defined only if
  120. <code><classname>make_variant_over</classname></code> and
  121. <code><classname>make_recursive_variant_over</classname></code>
  122. are not supported for some reason on the target compiler.</para>
  123. </description>
  124. </macro>
  125. <macro name="BOOST_VARIANT_DO_NOT_SPECIALIZE_STD_HASH">
  126. <purpose>
  127. <simpara>Define this macro if you do not with to have a <code><classname>std::hash</classname></code> specialization for
  128. <code><classname>boost::variant</classname></code>.</simpara>
  129. </purpose>
  130. </macro>
  131. <macro name="BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT">
  132. <purpose>
  133. <simpara>Indicates
  134. <code><classname>make_recursive_variant</classname></code> operates in
  135. an implementation-defined manner.</simpara>
  136. </purpose>
  137. <description>
  138. <para>Defined only if
  139. <code><classname>make_recursive_variant</classname></code> does not
  140. operate as documented on the target compiler, but rather in an
  141. implementation-defined manner.</para>
  142. <para><emphasis role="bold">Implementation Note</emphasis>: If
  143. <code>BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT</code> is
  144. defined for the target compiler, the current implementation uses the
  145. <libraryname>MPL</libraryname> lambda mechanism to approximate the
  146. desired behavior. (In most cases, however, such compilers do not have
  147. full lambda support either.)</para>
  148. </description>
  149. </macro>
  150. </header>