• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Class template make_recursive_variant</title>
6<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9<link rel="up" href="../variant/reference.html#header.boost.variant.recursive_variant_hpp" title="Header &lt;boost/variant/recursive_variant.hpp&gt;">
10<link rel="prev" href="make_variant_over.html" title="Class template make_variant_over">
11<link rel="next" href="make_recurs_1_3_46_5_5_1_3.html" title="Class template make_recursive_variant_over">
12</head>
13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14<table cellpadding="2" width="100%"><tr>
15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
16<td align="center"><a href="../../../index.html">Home</a></td>
17<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20<td align="center"><a href="../../../more/index.htm">More</a></td>
21</tr></table>
22<hr>
23<div class="spirit-nav">
24<a accesskey="p" href="make_variant_over.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../variant/reference.html#header.boost.variant.recursive_variant_hpp"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="make_recurs_1_3_46_5_5_1_3.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="refentry">
27<a name="boost.make_recursive_variant"></a><div class="titlepage"></div>
28<div class="refnamediv">
29<h2><span class="refentrytitle">Class template make_recursive_variant</span></h2>
30<p>boost::make_recursive_variant — Simplifies declaration of recursive <code class="computeroutput">variant</code> types.</p>
31</div>
32<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
33<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../variant/reference.html#header.boost.variant.recursive_variant_hpp" title="Header &lt;boost/variant/recursive_variant.hpp&gt;">boost/variant/recursive_variant.hpp</a>&gt;
34
35</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T1<span class="special">,</span> <span class="keyword">typename</span> T2 <span class="special">=</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span><span class="special">,</span> <span class="special">...</span><span class="special">,</span>
36         <span class="keyword">typename</span> TN <span class="special">=</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span><span class="special">&gt;</span>
37<span class="keyword">class</span> <a class="link" href="make_recursive_variant.html" title="Class template make_recursive_variant">make_recursive_variant</a> <span class="special">{</span>
38<span class="keyword">public</span><span class="special">:</span>
39  <span class="comment">// types</span>
40  <span class="keyword">typedef</span> <a class="link" href="variant.html" title="Class template variant">boost::variant</a><span class="special">&lt;</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <span class="special">&gt;</span> <a name="boost.make_recursive_variant.type"></a><span class="identifier">type</span><span class="special">;</span>
41<span class="special">}</span><span class="special">;</span></pre></div>
42<div class="refsect1">
43<a name="id-1.3.46.5.6.3.4"></a><h2>Description</h2>
44<p><code class="computeroutput">type</code> has behavior equivalent in every respect to
45          some <code class="computeroutput">variant&lt; U1, U2, ..., UN &gt;</code>, where each type
46          <code class="computeroutput">U<span class="emphasis"><em>i</em></span></code> is the result of the
47          corresponding type <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code> undergone a
48          transformation function. The following pseudo-code specifies the
49          behavior of this transformation (call it <code class="computeroutput">substitute</code>):
50
51          </p>
52<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
53<li class="listitem">If <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code> is
54              <code class="computeroutput">boost::recursive_variant_</code> then:
55              <code class="computeroutput">variant&lt; U1, U2, ..., UN &gt;</code>;</li>
56<li class="listitem">Else if <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code> is of the
57              form <code class="computeroutput">X *</code> then:
58              <code class="computeroutput">substitute(X) *</code>;</li>
59<li class="listitem">Else if <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code> is of the
60              form <code class="computeroutput">X &amp;</code> then:
61              <code class="computeroutput">substitute(X) &amp;</code>;</li>
62<li class="listitem">Else if <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code> is of the
63              form <code class="computeroutput">R (*)( X1, X2, ..., XN )</code> then:
64              <code class="computeroutput">substitute(R) (*)( substitute(X1), substitute(X2), ..., substitute(XN) )</code>;</li>
65<li class="listitem">Else if <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code> is of the
66              form <code class="computeroutput">F &lt; X1, X2, ..., XN &gt;</code> then:
67              <code class="computeroutput">F&lt; substitute(X1), substitute(X2), ..., substitute(XN) &gt;</code>;</li>
68<li class="listitem">Else: <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code>.</li>
69</ul></div>
70<p>
71        </p>
72<p>Note that cv-qualifiers are preserved and that the actual
73          process is generally a bit more complicated. However, the above does
74          convey the essential idea as well as describe the extent of the
75          substititions.</p>
76<p>Use of <code class="computeroutput">make_recursive_variant</code> is demonstrated in
77          <a class="xref" href="../variant/tutorial.html#variant.tutorial.recursive.recursive-variant" title="Recursive types with make_recursive_variant">the section called “Recursive types with <code class="computeroutput">make_recursive_variant</code>”</a>.</p>
78<p><span class="bold"><strong>Portability</strong></span>: Due to standard
79          conformance issues in several compilers,
80          <code class="computeroutput">make_recursive_variant</code> is not universally supported. On
81          these compilers the library indicates its lack of support via the
82          definition of the preprocessor symbol
83          <code class="computeroutput"><a class="link" href="../BOOST_VARIANT_1_3_46_5_3_9.html" title="Macro BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT">BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT</a></code>.</p>
84</div>
85</div>
86<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
87<td align="left"></td>
88<td align="right"><div class="copyright-footer">Copyright © 2002, 2003 Eric Friedman, Itay Maman<br>Copyright © 2014-2020 Antony Polukhin<p>Distributed under the Boost Software License, Version 1.0.
89    (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at
90    <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
91    </p>
92</div></td>
93</tr></table>
94<hr>
95<div class="spirit-nav">
96<a accesskey="p" href="make_variant_over.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../variant/reference.html#header.boost.variant.recursive_variant_hpp"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="make_recurs_1_3_46_5_5_1_3.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
97</div>
98</body>
99</html>
100