diff options
Diffstat (limited to 'doc/html/boost/polymorphic_get.html')
-rw-r--r-- | doc/html/boost/polymorphic_get.html | 78 |
1 files changed, 14 insertions, 64 deletions
diff --git a/doc/html/boost/polymorphic_get.html b/doc/html/boost/polymorphic_get.html index ade4a7a070..7ffbcbe134 100644 --- a/doc/html/boost/polymorphic_get.html +++ b/doc/html/boost/polymorphic_get.html @@ -6,7 +6,7 @@ <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> <link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> <link rel="up" href="../variant/reference.html#header.boost.variant.polymorphic_get_hpp" title="Header <boost/variant/polymorphic_get.hpp>"> -<link rel="prev" href="bad_polymorphic_get.html" title="Class bad_polymorphic_get"> +<link rel="prev" href="polymorphic_strict_get.html" title="Function polymorphic_strict_get"> <link rel="next" href="bad_visit.html" title="Class bad_visit"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> @@ -20,7 +20,7 @@ </tr></table> <hr> <div class="spirit-nav"> -<a accesskey="p" href="bad_polymorphic_get.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../variant/reference.html#header.boost.variant.polymorphic_get_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="bad_visit.html"><img src="../../../doc/src/images/next.png" alt="Next"></a> +<a accesskey="p" href="polymorphic_strict_get.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../variant/reference.html#header.boost.variant.polymorphic_get_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="bad_visit.html"><img src="../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="refentry"> <a name="boost.polymorphic_get"></a><div class="titlepage"></div> @@ -42,67 +42,17 @@ <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> U<span class="special">,</span> <span class="keyword">typename</span> T1<span class="special">,</span> <span class="keyword">typename</span> T2<span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="keyword">typename</span> TN<span class="special">></span> <span class="keyword">const</span> <span class="identifier">U</span> <span class="special">&</span> <span class="identifier">polymorphic_get</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="variant.html" title="Class template variant">variant</a><span class="special"><</span><span class="identifier">T1</span><span class="special">,</span> <span class="identifier">T2</span><span class="special">,</span> <span class="special">...</span><span class="special">,</span> <span class="identifier">TN</span><span class="special">></span> <span class="special">&</span> operand<span class="special">)</span><span class="special">;</span></pre></div> <div class="refsect1"> -<a name="idp525075792"></a><h2>Description</h2> -<p>The <code class="computeroutput">polymorphic_get</code> function allows run-time checked, - type-safe retrieval of the content of the given - <code class="computeroutput"><a class="link" href="variant.html" title="Class template variant">variant</a></code>. The function succeeds - only if the content is of the specified type <code class="computeroutput">U</code> or of type - derived from type <code class="computeroutput">U</code>, with - failure indicated as described below.</p> -<p><span class="bold"><strong>Warning</strong></span>: After either - <code class="computeroutput">operand</code> or its content is destroyed (e.g., when the - given <code class="computeroutput"><a class="link" href="variant.html" title="Class template variant">variant</a></code> is assigned a - value of different type), the returned reference is invalidated. - Thus, significant care and caution must be extended when handling - the returned reference.</p> -<div class="variablelist"><table border="0" class="variablelist compact"> -<colgroup> -<col align="left" valign="top"> -<col> -</colgroup> -<tbody> -<tr> -<td><p><span class="term">Notes:</span></p></td> -<td>As part of its guarantee of type-safety, <code class="computeroutput">polymorphic_get</code> - enforces <code class="computeroutput">const</code>-correctness. Thus, the specified type - <code class="computeroutput">U</code> must be <code class="computeroutput">const</code>-qualified whenever - <code class="computeroutput">operand</code> or its content is likewise - <code class="computeroutput">const</code>-qualified. The converse, however, is not required: - that is, the specified type <code class="computeroutput">U</code> may be - <code class="computeroutput">const</code>-qualified even when <code class="computeroutput">operand</code> and its - content are not.</td> -</tr> -<tr> -<td><p><span class="term">Returns:</span></p></td> -<td>If passed a pointer, <code class="computeroutput">polymorphic_get</code> returns a pointer to - the value content if it is of the specified type <code class="computeroutput">U</code> or of type - derived from type <code class="computeroutput">U</code>; - otherwise, a null pointer is returned. If passed a reference, - <code class="computeroutput">polymorphic_get</code> returns a reference to the value content if it is of - the specified type <code class="computeroutput">U</code> or of type - derived from type <code class="computeroutput">U</code>; otherwise, an exception is thrown - (see below).</td> -</tr> -<tr> -<td><p><span class="term">Throws:</span></p></td> -<td>Overloads taking a - <code class="computeroutput"><a class="link" href="variant.html" title="Class template variant">variant</a></code> pointer will not - throw; the overloads taking a - <code class="computeroutput"><a class="link" href="variant.html" title="Class template variant">variant</a></code> reference throw - <code class="computeroutput"><a class="link" href="bad_polymorphic_get.html" title="Class bad_polymorphic_get">bad_polymorphic_get</a></code> if the content is not of - the specified type <code class="computeroutput">U</code>or of type - derived from type <code class="computeroutput">U</code>.</td> -</tr> -<tr> -<td><p><span class="term">Rationale:</span></p></td> -<td>While visitation via - <code class="computeroutput"><a class="link" href="apply_visitor.html" title="Function apply_visitor">apply_visitor</a></code> - is generally preferred due to its greater safety, <code class="computeroutput">polymorphic_get</code> may - may be more convenient in some cases due to its straightforward - usage.</td> -</tr> -</tbody> -</table></div> +<a name="idp521372512"></a><h2>Description</h2> +<p>Evaluates to <code class="computeroutput"><a class="link" href="polymorphic_strict_get.html" title="Function polymorphic_strict_get">polymorphic_strict_get</a></code> + if <code class="computeroutput">BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code> + is not defined. If <code class="computeroutput">BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code> + is defined then evaluates to <code class="computeroutput"><a class="link" href="polymorphic_relaxed_get.html" title="Function polymorphic_relaxed_get">polymorphic_relaxed_get</a></code>. </p> +<p><span class="bold"><strong>Recomendation</strong></span>: Use + <code class="computeroutput"><a class="link" href="polymorphic_get.html" title="Function polymorphic_get">polymorphic_get</a></code> in new code without defining + <code class="computeroutput">BOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT</code>. In that way + <code class="computeroutput"><a class="link" href="polymorphic_get.html" title="Function polymorphic_get">polymorphic_get</a></code> + provides more compile time checks and it's behavior is closer to <code class="computeroutput">std::get</code> + from C++ Standard Library.</p> </div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> @@ -115,7 +65,7 @@ </tr></table> <hr> <div class="spirit-nav"> -<a accesskey="p" href="bad_polymorphic_get.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../variant/reference.html#header.boost.variant.polymorphic_get_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="bad_visit.html"><img src="../../../doc/src/images/next.png" alt="Next"></a> +<a accesskey="p" href="polymorphic_strict_get.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../variant/reference.html#header.boost.variant.polymorphic_get_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="bad_visit.html"><img src="../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html> |