1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Class template param</title>
<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="../../boost_typeerasure/reference.html#header.boost.type_erasure.placeholder_of_hpp" title="Header <boost/type_erasure/placeholder_of.hpp>">
<link rel="prev" href="_self.html" title="Struct _self">
<link rel="next" href="placeholder_of.html" title="Struct template placeholder_of">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="_self.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.placeholder_of_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="placeholder_of.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.type_erasure.param"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template param</span></h2>
<p>boost::type_erasure::param — A wrapper to help with overload resolution for functions operating on an <a class="link" href="any.html" title="Class template any">any</a>. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.placeholder_of_hpp" title="Header <boost/type_erasure/placeholder_of.hpp>">boost/type_erasure/placeholder_of.hpp</a>>
</span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> Concept<span class="special">,</span> <span class="keyword">typename</span> T<span class="special">></span>
<span class="keyword">class</span> <a class="link" href="param.html" title="Class template param">param</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="comment">// <a class="link" href="param.html#boost.type_erasure.paramconstruct-copy-destruct">construct/copy/destruct</a></span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> U<span class="special">></span> <a class="link" href="param.html#idp781861856-bb"><span class="identifier">param</span></a><span class="special">(</span><a class="link" href="../any.html" title="Class any">any</a><span class="special"><</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">></span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> U<span class="special">></span> <a class="link" href="param.html#idp781863968-bb"><span class="identifier">param</span></a><span class="special">(</span><span class="keyword">const</span> <a class="link" href="../any.html" title="Class any">any</a><span class="special"><</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">></span> <span class="special">&</span><span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> U<span class="special">></span> <a class="link" href="param.html#idp781866240-bb"><span class="identifier">param</span></a><span class="special">(</span><a class="link" href="../any.html" title="Class any">any</a><span class="special"><</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">></span> <span class="special">&&</span><span class="special">)</span><span class="special">;</span>
<span class="comment">// <a class="link" href="param.html#idp781858576-bb">public member functions</a></span>
<a class="link" href="../any.html" title="Class any">any</a><span class="special"><</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">T</span> <span class="special">></span> <a class="link" href="param.html#idp781859136-bb"><span class="identifier">get</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idp548426928"></a><h2>Description</h2>
<p>The template arguments are interpreted in the same way as <a class="link" href="any.html" title="Class template any">any</a>.</p>
<p>A parameter of type <a class="link" href="param.html" title="Class template param">param</a> can be initialized with an <a class="link" href="any.html" title="Class template any">any</a> that has the same <code class="computeroutput">Concept</code> and base placeholder when there exists a corresponding standard conversion for the placeholder. A conversion sequence from any<C, P> to param<C, P1> is a better conversion sequence than any<C, P> to param<C, P2> iff the corresponding placeholder standard conversion sequence from P to P1 is a better conversion sequence than P to P2.</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>Overloading based on cv-qualifiers and rvalue-ness is only supported in C++11. In C++03, all conversion sequences from <a class="link" href="any.html" title="Class template any">any</a> to <a class="link" href="param.html" title="Class template param">param</a> have the same rank.</p></td></tr>
</table></div>
<p>
Example:</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">param</span><span class="special"><</span><span class="identifier">C</span><span class="special">,</span> <span class="identifier">_a</span><span class="special">&</span><span class="special">></span><span class="special">)</span><span class="special">;</span>
<span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">param</span><span class="special"><</span><span class="identifier">C</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">_a</span><span class="special">&</span><span class="special">></span><span class="special">)</span><span class="special">;</span>
<span class="keyword">void</span> <span class="identifier">g</span><span class="special">(</span><span class="identifier">param</span><span class="special"><</span><span class="identifier">C</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">_a</span><span class="special">&</span><span class="special">></span><span class="special">)</span><span class="special">;</span>
<span class="keyword">void</span> <span class="identifier">g</span><span class="special">(</span><span class="identifier">param</span><span class="special"><</span><span class="identifier">C</span><span class="special">,</span> <span class="identifier">_a</span><span class="special">&&</span><span class="special">></span><span class="special">)</span><span class="special">;</span>
<span class="identifier">any</span><span class="special"><</span><span class="identifier">C</span><span class="special">,</span> <span class="identifier">_a</span><span class="special">></span> <span class="identifier">a</span><span class="special">;</span>
<span class="identifier">f</span><span class="special">(</span><span class="identifier">any</span><span class="special"><</span><span class="identifier">C</span><span class="special">,</span> <span class="identifier">_a</span><span class="special">></span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span> <span class="comment">// calls void f(param<C, const _a&>);</span>
<span class="identifier">f</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span><span class="special">;</span> <span class="comment">// calls void f(param<C, _a&>); (ambiguous in C++03)</span>
<span class="identifier">g</span><span class="special">(</span><span class="identifier">any</span><span class="special"><</span><span class="identifier">C</span><span class="special">,</span> <span class="identifier">_a</span><span class="special">></span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span> <span class="comment">// calls void g(param<C, _a&&>); (ambiguous in C++03)</span>
<span class="identifier">g</span><span class="special">(</span><span class="identifier">a</span><span class="special">)</span><span class="special">;</span> <span class="comment">// calls void g(param<C, const _a&>);</span>
</pre>
<p> </p>
<div class="refsect2">
<a name="idp548490496"></a><h3>
<a name="boost.type_erasure.paramconstruct-copy-destruct"></a><code class="computeroutput">param</code>
public
construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> U<span class="special">></span> <a name="idp781861856-bb"></a><span class="identifier">param</span><span class="special">(</span><a class="link" href="../any.html" title="Class any">any</a><span class="special"><</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">></span> <span class="special">&</span> a<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> U<span class="special">></span> <a name="idp781863968-bb"></a><span class="identifier">param</span><span class="special">(</span><span class="keyword">const</span> <a class="link" href="../any.html" title="Class any">any</a><span class="special"><</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">></span> <span class="special">&</span> a<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> U<span class="special">></span> <a name="idp781866240-bb"></a><span class="identifier">param</span><span class="special">(</span><a class="link" href="../any.html" title="Class any">any</a><span class="special"><</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">></span> <span class="special">&&</span> a<span class="special">)</span><span class="special">;</span></pre></li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp548525472"></a><h3>
<a name="idp781858576-bb"></a><code class="computeroutput">param</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><a class="link" href="../any.html" title="Class any">any</a><span class="special"><</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">T</span> <span class="special">></span> <a name="idp781859136-bb"></a><span class="identifier">get</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns the stored <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>. </p>
</li></ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2011-2013 Steven Watanabe<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="_self.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.placeholder_of_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="placeholder_of.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
|