| 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.68.1"> |
|---|
| 7 | <link rel="start" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> |
|---|
| 8 | <link rel="up" href="../variant/reference.html#header.boost.variant.recursive_variant.hpp" title="Header <boost/variant/recursive_variant.hpp>"> |
|---|
| 9 | <link rel="prev" href="make_variant_over.html" title="Class template make_variant_over"> |
|---|
| 10 | <link rel="next" href="make_recursive_variant_over.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 C++ Libraries" 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#header.boost.variant.recursive_variant.hpp"><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="make_recursive_variant_over.html"><img src="../images/next.png" alt="Next"></a> |
|---|
| 24 | </div> |
|---|
| 25 | <div class="refentry" lang="en"> |
|---|
| 26 | <a name="boost.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 — 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><<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>> |
|---|
| 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="variant.html" title="Class template variant">boost::variant</a>< <span class="emphasis"><em>unspecified</em></span> > type; |
|---|
| 38 | };</pre></div> |
|---|
| 39 | <div class="refsect1" lang="en"> |
|---|
| 40 | <a name="id1947262"></a><h2>Description</h2> |
|---|
| 41 | <p><code class="computeroutput">type</code> has behavior equivalent in every respect to |
|---|
| 42 | some <code class="computeroutput">variant< U1, U2, ..., UN ></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< U1, U2, ..., UN ></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 &</code> then: |
|---|
| 58 | <code class="computeroutput">substitute(X) &</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 < X1, X2, ..., XN ></code> then: |
|---|
| 64 | <code class="computeroutput">F< substitute(X1), substitute(X2), ..., substitute(XN) ></code>;</li> |
|---|
| 65 | <li>Else: <code class="computeroutput">T<span class="emphasis"><em>i</em></span></code>.</li> |
|---|
| 66 | </ul></div> |
|---|
| 67 | <p> |
|---|
| 68 | </p> |
|---|
| 69 | <p>Note that cv-qualifiers are preserved and that the actual |
|---|
| 70 | process is generally a bit more complicated. However, the above does |
|---|
| 71 | convey the essential idea as well as describe the extent of the |
|---|
| 72 | substititions.</p> |
|---|
| 73 | <p>Use of <code class="computeroutput">make_recursive_variant</code> is demonstrated in |
|---|
| 74 | <a 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> |
|---|
| 75 | <p><span class="bold"><strong>Portability</strong></span>: Due to standard |
|---|
| 76 | conformance issues in several compilers, |
|---|
| 77 | <code class="computeroutput">make_recursive_variant</code> is not universally supported. On |
|---|
| 78 | these compilers the library indicates its lack of support via the |
|---|
| 79 | definition of the preprocessor symbol |
|---|
| 80 | <code class="computeroutput"><a href="../BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT.html" title="Macro BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT">BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT</a></code>.</p> |
|---|
| 81 | </div> |
|---|
| 82 | </div> |
|---|
| 83 | <table width="100%"><tr> |
|---|
| 84 | <td align="left"></td> |
|---|
| 85 | <td align="right"><small>Copyright © 2002, 2003 Eric Friedman, Itay Maman</small></td> |
|---|
| 86 | </tr></table> |
|---|
| 87 | <hr> |
|---|
| 88 | <div class="spirit-nav"> |
|---|
| 89 | <a accesskey="p" href="make_variant_over.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../variant/reference.html#header.boost.variant.recursive_variant.hpp"><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="make_recursive_variant_over.html"><img src="../images/next.png" alt="Next"></a> |
|---|
| 90 | </div> |
|---|
| 91 | </body> |
|---|
| 92 | </html> |
|---|