Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/doc/html/reference_wrapper.html @ 12

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

added boost

File size: 8.6 KB
RevLine 
[12]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.69.1">
7<link rel="start" href="index.html" title="The Boost C++ Libraries">
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.png (6897 bytes)" 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="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#reference_wrapperconstruct-copy-destruct">construct/copy/destruct</a></em></span>
42  <span class="bold"><strong>explicit</strong></span> <a href="reference_wrapper.html#id2496965-bb">reference_wrapper</a>(T&amp;);
43
44  <span class="emphasis"><em>// <a href="reference_wrapper.html#id2365507-bb">access</a></em></span>
45  <a href="reference_wrapper.html#id2365512-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#id2357385-bb">get</a>() <span class="bold"><strong>const</strong></span>;
47  <span class="type">T*</span> <a href="reference_wrapper.html#id2490294-bb">get_pointer</a>() <span class="bold"><strong>const</strong></span>;
48};
49
50<span class="emphasis"><em>// <a href="reference_wrapper.html#id2366485-bb">constructors</a></em></span>
51<span class="type">reference_wrapper&lt;T&gt;</span> <a href="reference_wrapper.html#id2366489">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#cref">cref</a>(T <span class="bold"><strong>const</strong></span>&amp;);</pre></div>
53<div class="refsect1" lang="en">
54<a name="id2730530"></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="id2730555"></a><h3>
64<a name="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="id2496965-bb"></a>reference_wrapper(T&amp; t);</pre>
67<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>:
68
69    Constructs a
70        <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a></code>
71        object that stores a reference to
72        <code class="computeroutput">t</code>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
73
74    Does not throw.</p>
75</li></ol></div>
76</div>
77<div class="refsect2" lang="en">
78<a name="id2730629"></a><h3>
79<a name="id2365507-bb"></a><code class="computeroutput">reference_wrapper</code> access</h3>
80<div class="orderedlist"><ol type="1">
81<li>
82<pre class="literallayout"><a name="id2365512-bb"></a><span class="bold"><strong>operator</strong></span> T&amp;() <span class="bold"><strong>const</strong></span>;</pre>
83<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
84
85    The stored reference.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
86
87    Does not throw.</p>
88</li>
89<li>
90<pre class="literallayout"><span class="type">T&amp;</span> <a name="id2357385-bb"></a>get() <span class="bold"><strong>const</strong></span>;</pre>
91<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
92
93    The stored reference.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
94
95    Does not throw.</p>
96</li>
97<li>
98<pre class="literallayout"><span class="type">T*</span> <a name="id2490294-bb"></a>get_pointer() <span class="bold"><strong>const</strong></span>;</pre>
99<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
100
101    A pointer to the object referenced by the stored reference.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
102
103    Does not throw.</p>
104</li>
105</ol></div>
106</div>
107<div class="refsect2" lang="en">
108<a name="id2730771"></a><h3>
109<a name="id2366485-bb"></a><code class="computeroutput">reference_wrapper</code> constructors</h3>
110<div class="orderedlist"><ol type="1">
111<li>
112<pre class="literallayout"><span class="type">reference_wrapper&lt;T&gt;</span> <a name="id2366489"></a>ref(T&amp; t);</pre>
113<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
114
115    <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;T&gt;(t)</code><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
116
117    Does not throw.</p>
118</li>
119<li>
120<pre class="literallayout"><span class="type">reference_wrapper&lt;T <span class="bold"><strong>const</strong></span>&gt;</span> <a name="cref"></a>cref(T <span class="bold"><strong>const</strong></span>&amp; t);</pre>
121<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
122
123    <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a>&lt;T const&gt;(t)</code><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
124
125    Does not throw.</p>
126</li>
127</ol></div>
128</div>
129</div>
130</div>
131<table width="100%"><tr>
132<td align="left"></td>
133<td align="right"><small>Copyright © 1999, 2000 Jaakko Järvi<br>Copyright © 2001, 2002 Peter Dimov<br>Copyright © 2002 David Abrahams</small></td>
134</tr></table>
135<hr>
136<div class="spirit-nav">
137<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>
138</div>
139</body>
140</html>
Note: See TracBrowser for help on using the repository browser.