Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/doc/html/boost/reference_wrapper.html @ 35

Last change on this file since 35 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 8.7 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>Class template reference_wrapper</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="../ref/reference.html#header.boost.ref.hpp" title="Header &lt;boost/ref.hpp&gt;">
9<link rel="prev" href="../ref/reference.html" title="Reference">
10<link rel="next" href="is_reference_wrapper.html" title="Class template is_reference_wrapper">
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="../ref/reference.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref/reference.html#header.boost.ref.hpp"><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="is_reference_wrapper.html"><img src="../images/next.png" alt="Next"></a>
24</div>
25<div class="refentry" lang="en">
26<a name="boost.reference_wrapper"></a><div class="titlepage"></div>
27<div class="refnamediv">
28<h2><span class="refentrytitle">Class template reference_wrapper</span></h2>
29<p>boost::reference_wrapper &#8212; 
30        Contains a reference to an object of type
31        <code class="computeroutput">T</code>.
32      </p>
33</div>
34<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
35<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="bold"><strong>template</strong></span>&lt;<span class="bold"><strong>typename</strong></span> T&gt; 
36<span class="bold"><strong>class</strong></span> reference_wrapper {
37<span class="bold"><strong>public</strong></span>:
38  <span class="emphasis"><em>// types</em></span>
39  <span class="bold"><strong>typedef</strong></span> T type;
40
41  <span class="emphasis"><em>// <a href="reference_wrapper.html#boost.reference_wrapperconstruct-copy-destruct">construct/copy/destruct</a></em></span>
42  <span class="bold"><strong>explicit</strong></span> <a href="reference_wrapper.html#id661560-bb">reference_wrapper</a>(T&amp;);
43
44  <span class="emphasis"><em>// <a href="reference_wrapper.html#id757326-bb">access</a></em></span>
45  <a href="reference_wrapper.html#id757330-bb"><span class="bold"><strong>operator</strong></span> T&amp;</a>() <span class="bold"><strong>const</strong></span>;
46  <span class="type">T&amp;</span> <a href="reference_wrapper.html#id801504-bb">get</a>() <span class="bold"><strong>const</strong></span>;
47  <span class="type">T*</span> <a href="reference_wrapper.html#id623846-bb">get_pointer</a>() <span class="bold"><strong>const</strong></span>;
48};
49
50<span class="emphasis"><em>// <a href="reference_wrapper.html#id1044486-bb">constructors</a></em></span>
51<span class="type">reference_wrapper&lt;T&gt;</span> <a href="reference_wrapper.html#id1044490-bb">ref</a>(T&amp;);
52<span class="type">reference_wrapper&lt;T <span class="bold"><strong>const</strong></span>&gt;</span> <a href="reference_wrapper.html#boost.cref">cref</a>(T <span class="bold"><strong>const</strong></span>&amp;);</pre></div>
53<div class="refsect1" lang="en">
54<a name="id1607666"></a><h2>Description</h2>
55<p><code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a></code>
56        is primarily used to "feed" references to function templates
57        (algorithms) that take their parameter by value.  It provides
58        an implicit conversion to
59        <code class="computeroutput">T&amp;</code>, which usually allows
60        the function templates to work on references
61        unmodified.</p>
62<div class="refsect2" lang="en">
63<a name="id1607693"></a><h3>
64<a name="boost.reference_wrapperconstruct-copy-destruct"></a><code class="computeroutput">reference_wrapper</code> construct/copy/destruct</h3>
65<div class="orderedlist"><ol type="1"><li>
66<pre class="literallayout"><span class="bold"><strong>explicit</strong></span> <a name="id661560-bb"></a>reference_wrapper(T&amp; t);</pre>
67<div class="variablelist"><table border="0">
68<col align="left" valign="top">
69<tbody>
70<tr>
71<td>
72<span class="term">Effects:</span></td>
73<td>Constructs a
74        <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a></code>
75        object that stores a reference to
76        <code class="computeroutput">t</code>.</td>
77</tr>
78<tr>
79<td>
80<span class="term">Throws:</span></td>
81<td>Does not throw.</td>
82</tr>
83</tbody>
84</table></div>
85</li></ol></div>
86</div>
87<div class="refsect2" lang="en">
88<a name="id1607769"></a><h3>
89<a name="id757326-bb"></a><code class="computeroutput">reference_wrapper</code> access</h3>
90<div class="orderedlist"><ol type="1">
91<li>
92<pre class="literallayout"><a name="id757330-bb"></a><span class="bold"><strong>operator</strong></span> T&amp;() <span class="bold"><strong>const</strong></span>;</pre>
93<div class="variablelist"><table border="0">
94<col align="left" valign="top">
95<tbody>
96<tr>
97<td>
98<span class="term">Returns:</span></td>
99<td>The stored reference.</td>
100</tr>
101<tr>
102<td>
103<span class="term">Throws:</span></td>
104<td>Does not throw.</td>
105</tr>
106</tbody>
107</table></div>
108</li>
109<li>
110<pre class="literallayout"><span class="type">T&amp;</span> <a name="id801504-bb"></a>get() <span class="bold"><strong>const</strong></span>;</pre>
111<div class="variablelist"><table border="0">
112<col align="left" valign="top">
113<tbody>
114<tr>
115<td>
116<span class="term">Returns:</span></td>
117<td>The stored reference.</td>
118</tr>
119<tr>
120<td>
121<span class="term">Throws:</span></td>
122<td>Does not throw.</td>
123</tr>
124</tbody>
125</table></div>
126</li>
127<li>
128<pre class="literallayout"><span class="type">T*</span> <a name="id623846-bb"></a>get_pointer() <span class="bold"><strong>const</strong></span>;</pre>
129<div class="variablelist"><table border="0">
130<col align="left" valign="top">
131<tbody>
132<tr>
133<td>
134<span class="term">Returns:</span></td>
135<td>A pointer to the object referenced by the stored reference.</td>
136</tr>
137<tr>
138<td>
139<span class="term">Throws:</span></td>
140<td>Does not throw.</td>
141</tr>
142</tbody>
143</table></div>
144</li>
145</ol></div>
146</div>
147<div class="refsect2" lang="en">
148<a name="id1625391"></a><h3>
149<a name="id1044486-bb"></a><code class="computeroutput">reference_wrapper</code> constructors</h3>
150<div class="orderedlist"><ol type="1">
151<li>
152<pre class="literallayout"><span class="type">reference_wrapper&lt;T&gt;</span> <a name="id1044490-bb"></a>ref(T&amp; t);</pre>
153<div class="variablelist"><table border="0">
154<col align="left" valign="top">
155<tbody>
156<tr>
157<td>
158<span class="term">Returns:</span></td>
159<td><code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;T&gt;(t)</code></td>
160</tr>
161<tr>
162<td>
163<span class="term">Throws:</span></td>
164<td>Does not throw.</td>
165</tr>
166</tbody>
167</table></div>
168</li>
169<li>
170<pre class="literallayout"><span class="type">reference_wrapper&lt;T <span class="bold"><strong>const</strong></span>&gt;</span> <a name="boost.cref"></a>cref(T <span class="bold"><strong>const</strong></span>&amp; t);</pre>
171<div class="variablelist"><table border="0">
172<col align="left" valign="top">
173<tbody>
174<tr>
175<td>
176<span class="term">Returns:</span></td>
177<td><code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;T const&gt;(t)</code></td>
178</tr>
179<tr>
180<td>
181<span class="term">Throws:</span></td>
182<td>Does not throw.</td>
183</tr>
184</tbody>
185</table></div>
186</li>
187</ol></div>
188</div>
189</div>
190</div>
191<table width="100%"><tr>
192<td align="left"></td>
193<td align="right"><small>Copyright © 1999, 2000 Jaakko Järvi<br>Copyright © 2001, 2002 Peter Dimov<br>Copyright © 2002 David Abrahams</small></td>
194</tr></table>
195<hr>
196<div class="spirit-nav">
197<a accesskey="p" href="../ref/reference.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref/reference.html#header.boost.ref.hpp"><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="is_reference_wrapper.html"><img src="../images/next.png" alt="Next"></a>
198</div>
199</body>
200</html>
Note: See TracBrowser for help on using the repository browser.