• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Reference</title>
6<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9<link rel="up" href="../any.html" title="Chapter 4. Boost.Any">
10<link rel="prev" href="s02.html" title="Examples">
11<link rel="next" href="../boost/bad_any_cast.html" title="Class bad_any_cast">
12</head>
13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14<table cellpadding="2" width="100%"><tr>
15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
16<td align="center"><a href="../../../index.html">Home</a></td>
17<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20<td align="center"><a href="../../../more/index.htm">More</a></td>
21</tr></table>
22<hr>
23<div class="spirit-nav">
24<a accesskey="p" href="s02.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../any.html"><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="../boost/bad_any_cast.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="section">
27<div class="titlepage"><div><div><h2 class="title" style="clear: both">
28<a name="any.reference"></a>Reference</h2></div></div></div>
29<div class="toc"><dl class="toc">
30<dt><span class="section"><a href="reference.html#any.ValueType"><span class="emphasis"><em>ValueType</em></span> requirements</a></span></dt>
31<dt><span class="section"><a href="reference.html#header.boost.any_hpp">Header &lt;boost/any.hpp&gt;</a></span></dt>
32</dl></div>
33<div class="section">
34<div class="titlepage"><div><div><h3 class="title">
35<a name="any.ValueType"></a><span class="emphasis"><em>ValueType</em></span> requirements</h3></div></div></div>
36<p>Values are strongly informational objects for which
37      identity is not significant, i.e. the focus is principally on
38      their state content and any behavior organized around
39      that. Another distinguishing feature of values is their
40      granularity: normally fine-grained objects representing simple
41      concepts in the system such as quantities.</p>
42<p>As the emphasis of a value lies in its state not its
43      identity, values can be copied and typically assigned one to
44      another, requiring the explicit or implicit definition of a
45      public copy constructor and public assignment operator. Values
46      typically live within other scopes, i.e. within objects or
47      blocks, rather than on the heap. Values are therefore normally
48      passed around and manipulated directly as variables or through
49      references, but not as pointers that emphasize identity and
50      indirection.</p>
51<p>The specific requirements on value types to be used in an
52      <code class="computeroutput"><a class="link" href="../boost/any.html" title="Class any">any</a></code>
53      are:</p>
54<div class="itemizedlist"><ul class="itemizedlist compact" style="list-style-type: disc; ">
55<li class="listitem">A <span class="emphasis"><em>ValueType</em></span> is
56          <span class="emphasis"><em>CopyConstructible</em></span> [20.1.3].</li>
57<li class="listitem">The destructor for a
58        <span class="emphasis"><em>ValueType</em></span> upholds the no-throw
59        exception-safety guarantee.</li>
60</ul></div>
61</div>
62<div class="section">
63<div class="titlepage"><div><div><h3 class="title">
64<a name="header.boost.any_hpp"></a>Header &lt;<a href="../../../boost/any.hpp" target="_top">boost/any.hpp</a>&gt;</h3></div></div></div>
65<pre class="synopsis"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
66  <span class="keyword">class</span> <a class="link" href="../boost/bad_any_cast.html" title="Class bad_any_cast">bad_any_cast</a><span class="special">;</span>
67  <span class="keyword">class</span> <a class="link" href="../boost/any.html" title="Class any">any</a><span class="special">;</span>
68  <span class="keyword">void</span> <a class="link" href="../boost/swap_1_3_5_5_2_1_3.html" title="Function swap"><span class="identifier">swap</span></a><span class="special">(</span><a class="link" href="../boost/any.html" title="Class any">any</a> <span class="special">&amp;</span><span class="special">,</span> <a class="link" href="../boost/any.html" title="Class any">any</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
69  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="identifier">T</span> <a class="link" href="../boost/any_cast.html" title="Function any_cast"><span class="identifier">any_cast</span></a><span class="special">(</span><a class="link" href="../boost/any.html" title="Class any">any</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
70  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="identifier">T</span> <a class="link" href="../boost/any_cast.html" title="Function any_cast"><span class="identifier">any_cast</span></a><span class="special">(</span><a class="link" href="../boost/any.html" title="Class any">any</a> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span>
71  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> <span class="identifier">T</span> <a class="link" href="../boost/any_cast.html" title="Function any_cast"><span class="identifier">any_cast</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="../boost/any.html" title="Class any">any</a> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
72  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ValueType<span class="special">&gt;</span> <span class="keyword">const</span> <span class="identifier">ValueType</span> <span class="special">*</span> <a class="link" href="../boost/any_cast.html" title="Function any_cast"><span class="identifier">any_cast</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="../boost/any.html" title="Class any">any</a> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
73  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ValueType<span class="special">&gt;</span> <span class="identifier">ValueType</span> <span class="special">*</span> <a class="link" href="../boost/any_cast.html" title="Function any_cast"><span class="identifier">any_cast</span></a><span class="special">(</span><a class="link" href="../boost/any.html" title="Class any">any</a> <span class="special">*</span><span class="special">)</span><span class="special">;</span>
74<span class="special">}</span></pre>
75</div>
76</div>
77<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
78<td align="left"></td>
79<td align="right"><div class="copyright-footer">Copyright © 2001 Kevlin Henney<br>Copyright © 2013-2020 Antony Polukhin<p>Distributed under the Boost Software License, Version 1.0.
80      (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at
81      <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
82      </p>
83</div></td>
84</tr></table>
85<hr>
86<div class="spirit-nav">
87<a accesskey="p" href="s02.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../any.html"><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="../boost/bad_any_cast.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
88</div>
89</body>
90</html>
91