2007-01-01 02:23:51 +00:00
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=ISO-8859-1" >
< title > boost::variant</ title >
< link rel = "stylesheet" href = "../../../boostbook.css" type = "text/css" >
2007-02-15 23:11:24 +00:00
< meta name = "generator" content = "DocBook XSL Stylesheets V1.68.1" >
2007-01-01 02:23:51 +00:00
< link rel = "start" href = "../../../index.html" title = "Chapter 1. Fusion 2.0" >
< link rel = "up" href = "../adapted.html" title = "Adapted" >
< link rel = "prev" href = "boost__tuple.html" title = "boost::tuple" >
< link rel = "next" href = "../intrinsics.html" title = "Intrinsics" >
</ head >
< body bgcolor = "white" text = "black" link = "#0000FF" vlink = "#840084" alink = "#0000FF" >
< table cellpadding = "2" width = "100%" >
< td valign = "top" >< img alt = "Boost C++ Libraries" width = "277" height = "86" src = "../../../../../../../boost.png" ></ td >
< td align = "center" >< a href = "../../../../../../../index.htm" > Home</ a ></ td >
< td align = "center" >< a href = "../../../../../../libraries.htm" > Libraries</ a ></ td >
< td align = "center" >< a href = "../../../../../../../people/people.htm" > People</ a ></ td >
< td align = "center" >< a href = "../../../../../../../more/faq.htm" > FAQ</ a ></ td >
< td align = "center" >< a href = "../../../../../../../more/index.htm" > More</ a ></ td >
</ table >
< hr >
< div class = "spirit-nav" >
< a accesskey = "p" href = "boost__tuple.html" >< img src = "../../../images/prev.png" alt = "Prev" ></ a >< a accesskey = "u" href = "../adapted.html" >< 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 = "../intrinsics.html" >< img src = "../../../images/next.png" alt = "Next" ></ a >
</ div >
< div class = "section" lang = "en" >
< div class = "titlepage" >< div >< div >< h4 class = "title" >
< a name = "fusion.sequences.adapted.boost__variant" ></ a >< a href = "boost__variant.html" title = "boost::variant" > boost::variant</ a ></ h4 ></ div ></ div ></ div >
< p >
2007-02-15 23:11:24 +00:00
This module provides adapters for < code class = "computeroutput" >< span class = "identifier" > boost</ span >< span class = "special" > ::</ span >< span class = "identifier" > variant</ span ></ code > .
Including the module header makes < code class = "computeroutput" >< span class = "identifier" > boost</ span >< span class = "special" > ::</ span >< span class = "identifier" > variant</ span ></ code >
2007-01-01 02:23:51 +00:00
a fully conforming < a href = "../concepts/forward_sequence.html" title = "Forward
Sequence" > Forward
Sequence</ a > . The variant acts as a sequence of the types that can be
contained in the variant. Accessing types not currently stored int the
variant will lead to the variant being populated with a default constructed
value of that type.
</ p >
< a name = "fusion.sequences.adapted.boost__variant.header" ></ a >< h5 >
2007-02-25 22:02:27 +00:00
< a name = "id1003136" ></ a >
2007-01-01 02:23:51 +00:00
< a href = "boost__variant.html#fusion.sequences.adapted.boost__variant.header" > Header</ a >
</ h5 >
< pre class = "programlisting" >
< span class = "preprocessor" > #include</ span > < span class = "special" > < </ span >< span class = "identifier" > boost</ span >< span class = "special" > /</ span >< span class = "identifier" > fusion</ span >< span class = "special" > /</ span >< span class = "identifier" > sequence</ span >< span class = "special" > /</ span >< span class = "identifier" > adapted</ span >< span class = "special" > /</ span >< span class = "identifier" > variant</ span >< span class = "special" > .</ span >< span class = "identifier" > hpp</ span >< span class = "special" > > </ span >
</ pre >
< a name = "fusion.sequences.adapted.boost__variant.model_of" ></ a >< h5 >
2007-02-25 22:02:27 +00:00
< a name = "id1003227" ></ a >
2007-01-01 02:23:51 +00:00
< a href = "boost__variant.html#fusion.sequences.adapted.boost__variant.model_of" > Model
of</ a >
</ h5 >
< div class = "itemizedlist" >< ul type = "disc" >< li >< a href = "../concepts/forward_sequence.html" title = "Forward
Sequence" > Forward Sequence</ a ></ li ></ ul ></ div >
< a name = "fusion.sequences.adapted.boost__variant.example" ></ a >< h5 >
2007-02-25 22:02:27 +00:00
< a name = "id1003265" ></ a >
2007-01-01 02:23:51 +00:00
< a href = "boost__variant.html#fusion.sequences.adapted.boost__variant.example" > Example</ a >
</ h5 >
< pre class = "programlisting" >
< span class = "identifier" > boost</ span >< span class = "special" > ::</ span >< span class = "identifier" > variant</ span >< span class = "special" > < </ span >< span class = "keyword" > int</ span >< span class = "special" > ,</ span >< span class = "identifier" > std</ span >< span class = "special" > ::</ span >< span class = "identifier" > string</ span >< span class = "special" > > </ span > < span class = "identifier" > example_variant</ span > < span class = "special" > =</ span > < span class = "number" > 101</ span >< span class = "special" > ;</ span >
< span class = "identifier" > std</ span >< span class = "special" > ::</ span >< span class = "identifier" > cout</ span > < span class = "special" > << </ span > < span class = "identifier" > example_variant</ span > < span class = "special" > << </ span > < span class = "char" > '\n'</ span >< span class = "special" > ;</ span >
< span class = "special" > *</ span >< span class = "identifier" > boost</ span >< span class = "special" > ::</ span >< span class = "identifier" > fusion</ span >< span class = "special" > ::</ span >< span class = "identifier" > find</ span >< span class = "special" > < </ span >< span class = "identifier" > std</ span >< span class = "special" > ::</ span >< span class = "identifier" > string</ span >< span class = "special" > > (</ span >< span class = "identifier" > example_variant</ span >< span class = "special" > )</ span > < span class = "special" > =</ span > < span class = "string" > "hello"</ span >< span class = "special" > ;</ span >
< span class = "identifier" > std</ span >< span class = "special" > ::</ span >< span class = "identifier" > cout</ span > < span class = "special" > << </ span > < span class = "identifier" > example_variant</ span > < span class = "special" > << </ span > < span class = "char" > '\n'</ span >< span class = "special" > ;</ span >
</ pre >
< a name = "fusion.sequences.adapted.boost__variant.see_also" ></ a >< h5 >
2007-02-25 22:02:27 +00:00
< a name = "id1003513" ></ a >
2007-01-01 02:23:51 +00:00
< a href = "boost__variant.html#fusion.sequences.adapted.boost__variant.see_also" > See also</ a >
</ h5 >
< p >
< a href = "http://www.boost.org/doc/html/variant.html" target = "_top" > Boost.Variant Library</ a >
</ p >
</ div >
< table xmlns:rev = "http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width = "100%" >< tr >
< td align = "left" ></ td >
2007-02-25 22:02:27 +00:00
< td align = "right" >< small > Copyright © 2001-2007 Joel de Guzman, Dan Marsden, Tobias
Schwinger</ small ></ td >
2007-01-01 02:23:51 +00:00
</ tr ></ table >
< hr >
< div class = "spirit-nav" >
< a accesskey = "p" href = "boost__tuple.html" >< img src = "../../../images/prev.png" alt = "Prev" ></ a >< a accesskey = "u" href = "../adapted.html" >< 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 = "../intrinsics.html" >< img src = "../../../images/next.png" alt = "Next" ></ a >
</ div >
</ body >
</ html >