Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/doc/html/make_recursive_variant.html @ 25

Last change on this file since 25 was 12, checked in by landauf, 17 years ago

added boost

File size: 6.6 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>Class template make_recursive_variant</title>
5<link rel="stylesheet" href="boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
7<link rel="start" href="index.html" title="The Boost C++ Libraries">
8<link rel="up" href="variant/reference.html#id2551122" title="Header &lt;boost/variant/recursive_variant.hpp&gt;">
9<link rel="prev" href="make_variant_over.html" title="Class template make_variant_over">
10<link rel="next" href="id2655704.html" title="Class template make_recursive_variant_over">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%">
14<td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../boost.png"></td>
15<td align="center"><a href="../../index.htm">Home</a></td>
16<td align="center"><a href="../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="../../people/people.htm">People</a></td>
18<td align="center"><a href="../../more/faq.htm">FAQ</a></td>
19<td align="center"><a href="../../more/index.htm">More</a></td>
20</table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="make_variant_over.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="variant/reference.html#id2551122"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="id2655704.html"><img src="images/next.png" alt="Next"></a>
24</div>
25<div class="refentry" lang="en">
26<a name="make_recursive_variant"></a><div class="titlepage"></div>
27<div class="refnamediv">
28<h2><span class="refentrytitle">Class template make_recursive_variant</span></h2>
29<p>boost::make_recursive_variant &#8212; Simplifies declaration of recursive <code class="computeroutput">variant</code> types.</p>
30</div>
31<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
32<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T1, <span class="bold"><strong>typename</strong></span> T2 = <span class="emphasis"><em>unspecified</em></span>, ...,
33         <span class="bold"><strong>typename</strong></span> TN = <span class="emphasis"><em>unspecified</em></span>&gt; 
34<span class="bold"><strong>class</strong></span> make_recursive_variant {
35<span class="bold"><strong>public</strong></span>:
36  <span class="emphasis"><em>// types</em></span>
37  <span class="bold"><strong>typedef</strong></span> <a href="boost/variant.html" title="Class template variant">boost::variant</a>&lt; <span class="emphasis"><em>unspecified</em></span> &gt; type;
38};</pre></div>
39<div class="refsect1" lang="en">
40<a name="id2836116"></a><h2>Description</h2>
41<p><code class="computeroutput">type</code> has behavior equivalent in every respect to
42          some <code class="computeroutput">variant&lt; U1, U2, ..., UN &gt;</code>, where each type
43          <code class="computeroutput">U<span class="emphasis"><em>i</em></span></code> is the result of the
44          corresponding type <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code> undergone a
45          transformation function. The following pseudo-code specifies the
46          behavior of this transformation (call it <code class="computeroutput">substitute</code>):
47
48          </p>
49<div class="itemizedlist"><ul type="disc">
50<li>If <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code> is
51              <code class="computeroutput">boost::recursive_variant_</code> then:
52              <code class="computeroutput">variant&lt; U1, U2, ..., UN &gt;</code>;</li>
53<li>Else if <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code> is of the
54              form <code class="computeroutput">X *</code> then:
55              <code class="computeroutput">substitute(X) *</code>;</li>
56<li>Else if <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code> is of the
57              form <code class="computeroutput">X &amp;</code> then:
58              <code class="computeroutput">substitute(X) &amp;</code>;</li>
59<li>Else if <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code> is of the
60              form <code class="computeroutput">R (*)( X1, X2, ..., XN )</code> then:
61              <code class="computeroutput">substitute(R) (*)( substitute(X1), substitute(X2), ..., substitute(XN) )</code>;</li>
62<li>Else if <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code> is of the
63              form <code class="computeroutput">F &lt; X1, X2, ..., XN &gt;</code> then:
64              <code class="computeroutput">F&lt; substitute(X1), substitute(X2), ..., substitute(XN) &gt;</code>;</li>
65<li>Else: <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code>.</li>
66</ul></div>
67<p>Note that cv-qualifiers are preserved and that the actual
68          process is generally a bit more complicated. However, the above does
69          convey the essential idea as well as describe the extent of the
70          substititions.</p>
71<p>Use of <code class="computeroutput">make_recursive_variant</code> is demonstrated in
72          <a href="variant/tutorial.html#variant.tutorial.recursive.recursive-variant" title="Recursive types with make_recursive_variant">the section called &#8220;Recursive types with <code class="computeroutput">make_recursive_variant</code>&#8221;</a>.</p>
73<p><span class="bold"><strong>Portability</strong></span>: Due to standard
74          conformance issues in several compilers,
75          <code class="computeroutput">make_recursive_variant</code> is not universally supported. On
76          these compilers the library indicates its lack of support via the
77          definition of the preprocessor symbol
78          <code class="computeroutput"><a href="id2404411.html" title="Macro BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT">BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT</a></code>.</p>
79</div>
80</div>
81<table width="100%"><tr>
82<td align="left"></td>
83<td align="right"><small>Copyright © 2002, 2003 Eric Friedman, Itay Maman</small></td>
84</tr></table>
85<hr>
86<div class="spirit-nav">
87<a accesskey="p" href="make_variant_over.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="variant/reference.html#id2551122"><img src="images/up.png" alt="Up"></a><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a><a accesskey="n" href="id2655704.html"><img src="images/next.png" alt="Next"></a>
88</div>
89</body>
90</html>
Note: See TracBrowser for help on using the repository browser.