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