<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
-<link rel="up" href="../variant.html" title="Chapter 44. Boost.Variant">
-<link rel="prev" href="../variant.html" title="Chapter 44. Boost.Variant">
+<link rel="up" href="../variant.html" title="Chapter 45. Boost.Variant">
+<link rel="prev" href="../variant.html" title="Chapter 45. Boost.Variant">
<link rel="next" href="reference.html" title="Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
contained value. There are two ways to accomplish this:
<code class="computeroutput"><a class="link" href="../boost/apply_visitor.html" title="Function apply_visitor">apply_visitor</a></code>, which is safest
and very powerful, and
- <code class="computeroutput"><a class="link" href="../boost/get_idp1003723808.html" title="Function get">get</a><T></code>, which is
+ <code class="computeroutput"><a class="link" href="../boost/get_idp777944992.html" title="Function get">get</a><T></code>, which is
sometimes more convenient to use.</p>
<p>For instance, suppose we wanted to concatenate to the string contained
in <code class="computeroutput">v</code>. With <span class="bold"><strong>value retrieval</strong></span>
- by <code class="computeroutput"><a class="link" href="../boost/get_idp1003723808.html" title="Function get">get</a></code>, this may be accomplished
+ by <code class="computeroutput"><a class="link" href="../boost/get_idp777944992.html" title="Function get">get</a></code>, this may be accomplished
quite simply, as seen in the following:
</p>
-<pre class="programlisting">std::string& str = <code class="computeroutput"><a class="link" href="../boost/get_idp1003723808.html" title="Function get">boost::get</a></code><std::string>(v);
+<pre class="programlisting">std::string& str = <code class="computeroutput"><a class="link" href="../boost/get_idp777944992.html" title="Function get">boost::get</a></code><std::string>(v);
str += " world! ";</pre>
<p>
</p>
<pre class="programlisting">void times_two( boost::variant< int, std::string > & operand )
{
- if ( int* pi = <code class="computeroutput"><a class="link" href="../boost/get_idp1003723808.html" title="Function get">boost::get</a></code><int>( &operand ) )
+ if ( int* pi = <code class="computeroutput"><a class="link" href="../boost/get_idp777944992.html" title="Function get">boost::get</a></code><int>( &operand ) )
*pi *= 2;
- else if ( std::string* pstr = <code class="computeroutput"><a class="link" href="../boost/get_idp1003723808.html" title="Function get">boost::get</a></code><std::string>( &operand ) )
+ else if ( std::string* pstr = <code class="computeroutput"><a class="link" href="../boost/get_idp777944992.html" title="Function get">boost::get</a></code><std::string>( &operand ) )
*pstr += *pstr;
}</pre>
<p>
<code class="computeroutput">var</code> as <code class="computeroutput">( 1 ( 3 5 ) 7 )</code>.</p>
<p>Finally, note that a type sequence can be used to specify the bounded
types of a recursive <code class="computeroutput">variant</code> via the use of
- <code class="computeroutput"><a class="link" href="../boost/make_recursi_idp1003403200.html" title="Class template make_recursive_variant_over">boost::make_recursive_variant_over</a></code>,
+ <code class="computeroutput"><a class="link" href="../boost/make_recursiv_idp777624384.html" title="Class template make_recursive_variant_over">boost::make_recursive_variant_over</a></code>,
whose semantics are the same as <code class="computeroutput">make_variant_over</code> (which is
described in <a class="xref" href="tutorial.html#variant.tutorial.over-sequence" title="Using a type sequence to specify bounded types">the section called “Using a type sequence to specify bounded types”</a>).</p>
<p><span class="bold"><strong>Portability</strong></span>: Unfortunately, due to