• 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>Class template param</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="../../boost_typeerasure/reference.html#header.boost.type_erasure.param_hpp" title="Header &lt;boost/type_erasure/param.hpp&gt;">
10<link rel="prev" href="as_param.html" title="Struct template as_param">
11<link rel="next" href="_a.html" title="Struct _a">
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="as_param.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.param_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="_a.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="refentry">
27<a name="boost.type_erasure.param"></a><div class="titlepage"></div>
28<div class="refnamediv">
29<h2><span class="refentrytitle">Class template param</span></h2>
30<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>
31</div>
32<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
33<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.param_hpp" title="Header &lt;boost/type_erasure/param.hpp&gt;">boost/type_erasure/param.hpp</a>&gt;
34
35</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Concept<span class="special">,</span> <span class="keyword">typename</span> T<span class="special">&gt;</span>
36<span class="keyword">class</span> <a class="link" href="param.html" title="Class template param">param</a> <span class="special">{</span>
37<span class="keyword">public</span><span class="special">:</span>
38  <span class="comment">// <a class="link" href="param.html#boost.type_erasure.paramconstruct-copy-destruct">construct/copy/destruct</a></span>
39  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <a class="link" href="param.html#id-1_3_41_13_25_1_1_2_5-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">&lt;</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
40  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <a class="link" href="param.html#id-1_3_41_13_25_1_1_2_6-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">&lt;</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
41  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <a class="link" href="param.html#id-1_3_41_13_25_1_1_2_7-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">&lt;</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">&gt;</span> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span>
42
43  <span class="comment">// <a class="link" href="param.html#id-1_3_41_13_25_1_1_2_4-bb">public member functions</a></span>
44  <a class="link" href="../any.html" title="Class any">any</a><span class="special">&lt;</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">T</span> <span class="special">&gt;</span> <a class="link" href="param.html#id-1_3_41_13_25_1_1_2_4_1-bb"><span class="identifier">get</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
45<span class="special">}</span><span class="special">;</span></pre></div>
46<div class="refsect1">
47<a name="id-1.3.41.13.26.4.4"></a><h2>Description</h2>
48<p>The template arguments are interpreted in the same way as <a class="link" href="any.html" title="Class template any">any</a>.</p>
49<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 <a class="link" href="any.html" title="Class template any">any&lt;C, P&gt;</a> to <a class="link" href="param.html" title="Class template param">param&lt;C, P1&gt;</a> is a better conversion sequence than <a class="link" href="any.html" title="Class template any">any&lt;C, P&gt;</a> to <a class="link" href="param.html" title="Class template param">param&lt;C, P2&gt;</a> iff the corresponding placeholder standard conversion sequence from P to P1 is a better conversion sequence than P to P2.</p>
50<div class="note"><table border="0" summary="Note">
51<tr>
52<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
53<th align="left">Note</th>
54</tr>
55<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>
56</table></div>
57<p>
58Example:</p>
59<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">&lt;</span><span class="identifier">C</span><span class="special">,</span> <span class="identifier">_a</span><span class="special">&amp;</span><span class="special">&gt;</span><span class="special">)</span><span class="special">;</span>
60<span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">param</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">_a</span><span class="special">&amp;</span><span class="special">&gt;</span><span class="special">)</span><span class="special">;</span>
61<span class="keyword">void</span> <span class="identifier">g</span><span class="special">(</span><span class="identifier">param</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">_a</span><span class="special">&amp;</span><span class="special">&gt;</span><span class="special">)</span><span class="special">;</span>
62<span class="keyword">void</span> <span class="identifier">g</span><span class="special">(</span><span class="identifier">param</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,</span> <span class="identifier">_a</span><span class="special">&amp;&amp;</span><span class="special">&gt;</span><span class="special">)</span><span class="special">;</span>
63
64<span class="identifier">any</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,</span> <span class="identifier">_a</span><span class="special">&gt;</span> <span class="identifier">a</span><span class="special">;</span>
65<span class="identifier">f</span><span class="special">(</span><span class="identifier">any</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,</span> <span class="identifier">_a</span><span class="special">&gt;</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span> <span class="comment">// calls void f(param&lt;C, const _a&amp;&gt;);</span>
66<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&lt;C, _a&amp;&gt;); (ambiguous in C++03)</span>
67<span class="identifier">g</span><span class="special">(</span><span class="identifier">any</span><span class="special">&lt;</span><span class="identifier">C</span><span class="special">,</span> <span class="identifier">_a</span><span class="special">&gt;</span><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span> <span class="comment">// calls void g(param&lt;C, _a&amp;&amp;&gt;); (ambiguous in C++03)</span>
68<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&lt;C, const _a&amp;&gt;);</span>
69</pre>
70<p> </p>
71<div class="refsect2">
72<a name="id-1.3.41.13.26.4.4.6"></a><h3>
73<a name="boost.type_erasure.paramconstruct-copy-destruct"></a><code class="computeroutput">param</code>
74        public
75       construct/copy/destruct</h3>
76<div class="orderedlist"><ol class="orderedlist" type="1">
77<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <a name="id-1_3_41_13_25_1_1_2_5-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">&lt;</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">&gt;</span> <span class="special">&amp;</span> a<span class="special">)</span><span class="special">;</span></pre></li>
78<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <a name="id-1_3_41_13_25_1_1_2_6-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">&lt;</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">&gt;</span> <span class="special">&amp;</span> a<span class="special">)</span><span class="special">;</span></pre></li>
79<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <a name="id-1_3_41_13_25_1_1_2_7-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">&lt;</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">U</span> <span class="special">&gt;</span> <span class="special">&amp;&amp;</span> a<span class="special">)</span><span class="special">;</span></pre></li>
80</ol></div>
81</div>
82<div class="refsect2">
83<a name="id-1.3.41.13.26.4.4.7"></a><h3>
84<a name="id-1_3_41_13_25_1_1_2_4-bb"></a><code class="computeroutput">param</code> public member functions</h3>
85<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
86<pre class="literallayout"><a class="link" href="../any.html" title="Class any">any</a><span class="special">&lt;</span> <span class="identifier">Concept</span><span class="special">,</span> <span class="identifier">T</span> <span class="special">&gt;</span> <a name="id-1_3_41_13_25_1_1_2_4_1-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>
87<p>Returns the stored <code class="computeroutput"><a class="link" href="any.html" title="Class template any">any</a></code>. </p>
88</li></ol></div>
89</div>
90</div>
91</div>
92<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
93<td align="left"></td>
94<td align="right"><div class="copyright-footer">Copyright © 2011-2013 Steven Watanabe<p>
95        Distributed under the Boost Software License, Version 1.0. (See accompanying
96        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>)
97      </p>
98</div></td>
99</tr></table>
100<hr>
101<div class="spirit-nav">
102<a accesskey="p" href="as_param.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_typeerasure/reference.html#header.boost.type_erasure.param_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="_a.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
103</div>
104</body>
105</html>
106