[29] | 1 | <html> |
---|
| 2 | <head> |
---|
| 3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
---|
| 4 | <title>Reference</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="../any.html" title="Chapter 1. Boost.Any"> |
---|
| 9 | <link rel="prev" href="s02.html" title="Examples"> |
---|
| 10 | <link rel="next" href="../boost/bad_any_cast.html" title="Class bad_any_cast"> |
---|
| 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="s02.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../any.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="../boost/bad_any_cast.html"><img src="../images/next.png" alt="Next"></a> |
---|
| 24 | </div> |
---|
| 25 | <div class="section" lang="en"> |
---|
| 26 | <div class="titlepage"><div><div><h2 class="title" style="clear: both"> |
---|
| 27 | <a name="any.reference"></a>Reference</h2></div></div></div> |
---|
| 28 | <div class="toc"><dl> |
---|
| 29 | <dt><span class="section"><a href="reference.html#any.ValueType"><span class="emphasis"><em>ValueType</em></span> requirements</a></span></dt> |
---|
| 30 | <dt><span class="section"><a href="reference.html#header.boost.any.hpp">Header <boost/any.hpp></a></span></dt> |
---|
| 31 | </dl></div> |
---|
| 32 | <div class="section" lang="en"> |
---|
| 33 | <div class="titlepage"><div><div><h3 class="title"> |
---|
| 34 | <a name="any.ValueType"></a><span class="emphasis"><em>ValueType</em></span> requirements</h3></div></div></div> |
---|
| 35 | <p>Values are strongly informational objects for which |
---|
| 36 | identity is not significant, i.e. the focus is principally on |
---|
| 37 | their state content and any behavior organized around |
---|
| 38 | that. Another distinguishing feature of values is their |
---|
| 39 | granularity: normally fine-grained objects representing simple |
---|
| 40 | concepts in the system such as quantities.</p> |
---|
| 41 | <p>As the emphasis of a value lies in its state not its |
---|
| 42 | identity, values can be copied and typically assigned one to |
---|
| 43 | another, requiring the explicit or implicit definition of a |
---|
| 44 | public copy constructor and public assignment operator. Values |
---|
| 45 | typically live within other scopes, i.e. within objects or |
---|
| 46 | blocks, rather than on the heap. Values are therefore normally |
---|
| 47 | passed around and manipulated directly as variables or through |
---|
| 48 | references, but not as pointers that emphasize identity and |
---|
| 49 | indirection.</p> |
---|
| 50 | <p>The specific requirements on value types to be used in an |
---|
| 51 | <code class="computeroutput"><a href="../boost/any.html" title="Class any">any</a></code> |
---|
| 52 | are:</p> |
---|
| 53 | <div class="itemizedlist"><ul type="disc" compact> |
---|
| 54 | <li>A <span class="emphasis"><em>ValueType</em></span> is |
---|
| 55 | <span class="emphasis"><em>CopyConstructible</em></span> [20.1.3].</li> |
---|
| 56 | <li>A <span class="emphasis"><em>ValueType</em></span> is |
---|
| 57 | optionally <span class="emphasis"><em>Assignable</em></span> [23.1]. The strong |
---|
| 58 | exception-safety guarantee is required for all forms of |
---|
| 59 | assignment.</li> |
---|
| 60 | <li>The destructor for a |
---|
| 61 | <span class="emphasis"><em>ValueType</em></span> upholds the no-throw |
---|
| 62 | exception-safety guarantee.</li> |
---|
| 63 | </ul></div> |
---|
| 64 | </div> |
---|
| 65 | <div class="section" lang="en"> |
---|
| 66 | <div class="titlepage"><div><div><h3 class="title"> |
---|
| 67 | <a name="header.boost.any.hpp"></a>Header <<a href="../../../boost/any.hpp" target="_top">boost/any.hpp</a>></h3></div></div></div> |
---|
| 68 | <pre class="synopsis"><span class="bold"><strong>namespace</strong></span> boost { |
---|
| 69 | <span class="bold"><strong>class</strong></span> <a href="../boost/bad_any_cast.html" title="Class bad_any_cast">bad_any_cast</a>; |
---|
| 70 | <span class="bold"><strong>class</strong></span> <a href="../boost/any.html" title="Class any">any</a>; |
---|
| 71 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T> <span class="type">T</span> <a href="../boost/any_cast.html" title="Function any_cast">any_cast</a>(<a href="../boost/any.html" title="Class any">any</a> &); |
---|
| 72 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T> <span class="type">T</span> <a href="../boost/any_cast.html" title="Function any_cast">any_cast</a>(<span class="bold"><strong>const</strong></span> <a href="../boost/any.html" title="Class any">any</a> &); |
---|
| 73 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> ValueType> <span class="type"><span class="bold"><strong>const</strong></span> ValueType *</span> <a href="../boost/any_cast.html" title="Function any_cast">any_cast</a>(<span class="bold"><strong>const</strong></span> <a href="../boost/any.html" title="Class any">any</a> *); |
---|
| 74 | <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> ValueType> <span class="type">ValueType *</span> <a href="../boost/any_cast.html" title="Function any_cast">any_cast</a>(<a href="../boost/any.html" title="Class any">any</a> *); |
---|
| 75 | }</pre> |
---|
| 76 | </div> |
---|
| 77 | </div> |
---|
| 78 | <table width="100%"><tr> |
---|
| 79 | <td align="left"></td> |
---|
| 80 | <td align="right"><small>Copyright © 2001 Kevlin Henney</small></td> |
---|
| 81 | </tr></table> |
---|
| 82 | <hr> |
---|
| 83 | <div class="spirit-nav"> |
---|
| 84 | <a accesskey="p" href="s02.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../any.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="../boost/bad_any_cast.html"><img src="../images/next.png" alt="Next"></a> |
---|
| 85 | </div> |
---|
| 86 | </body> |
---|
| 87 | </html> |
---|