Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added boost

File size: 6.2 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>Chapter 8. Boost.Ref</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="libraries.html" title="Part I. The Boost C++ Libraries">
9<link rel="prev" href="id2363468.html" title="Macro BOOST_PROGRAM_OPTIONS_VERSION">
10<link rel="next" href="ref/reference.html" title="Reference">
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="id2363468.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><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="ref/reference.html"><img src="images/next.png" alt="Next"></a>
24</div>
25<div class="chapter" lang="en">
26<div class="titlepage"><div>
27<div><h2 class="title">
28<a name="ref"></a>Chapter 8. Boost.Ref</h2></div>
29<div><div class="author"><h3 class="author">
30<span class="firstname">Jaakko</span> <span class="surname">Järvi</span>
31</h3></div></div>
32<div><div class="author"><h3 class="author">
33<span class="firstname">Peter</span> <span class="surname">Dimov</span>
34</h3></div></div>
35<div><div class="author"><h3 class="author">
36<span class="firstname">Douglas</span> <span class="surname">Gregor</span>
37</h3></div></div>
38<div><div class="author"><h3 class="author">
39<span class="firstname">Dave</span> <span class="surname">Abrahams</span>
40</h3></div></div>
41<div><p class="copyright">Copyright © 1999, 2000 Jaakko Järvi</p></div>
42<div><p class="copyright">Copyright © 2001, 2002 Peter Dimov</p></div>
43<div><p class="copyright">Copyright © 2002 David Abrahams</p></div>
44<div><div class="legalnotice">
45<a name="id2730005"></a><p>Permission to copy, use, modify, sell and distribute this
46      software is granted provided this copyright notice appears in
47      all copies.  This software is provided "as is" without express
48      or implied warranty, and with no claim as to its suitability for
49      any purpose.
50      </p>
51</div></div>
52</div></div>
53<div class="toc">
54<p><b>Table of Contents</b></p>
55<dl>
56<dt><span class="section"><a href="ref.html#ref.intro">Introduction</a></span></dt>
57<dt><span class="section"><a href="ref/reference.html">Reference</a></span></dt>
58<dd><dl><dt><span class="section"><a href="ref/reference.html#header.boost.ref.hpp">Header &lt;boost/ref.hpp&gt;</a></span></dt></dl></dd>
59<dt><span class="section"><a href="ref/ack.html">Acknowledgements</a></span></dt>
60</dl>
61</div>
62<div class="section" lang="en">
63<div class="titlepage"><div><div><h3 class="title">
64<a name="ref.intro"></a>Introduction</h3></div></div></div>
65<p>The Ref library is a small library that is useful for passing
66  references to function templates (algorithms) that would usually
67  take copies of their arguments. It defines the class template
68  <code class="computeroutput"><a href="reference_wrapper.html" title="Class template reference_wrapper">boost::reference_wrapper&lt;T&gt;</a></code>,
69  the two functions
70  <code class="computeroutput"><a href="reference_wrapper.html#id2366489">boost::ref</a></code> and
71  <code class="computeroutput"><a href="reference_wrapper.html#cref">boost::cref</a></code> that return
72  instances of <code class="computeroutput">boost::reference_wrapper&lt;T&gt;</code>, and the
73  two traits classes
74  <code class="computeroutput"><a href="is_reference_wrapper.html" title="Class template is_reference_wrapper">boost::is_reference_wrapper&lt;T&gt;</a></code>
75  and
76  <code class="computeroutput"><a href="unwrap_reference.html" title="Class template unwrap_reference">boost::unwrap_reference&lt;T&gt;</a></code>.</p>
77<p>The purpose of
78  <code class="computeroutput">boost::reference_wrapper&lt;T&gt;</code> is to
79  contain a reference to an object of type T. It is primarily used to
80  "feed" references to function templates (algorithms) that take their
81  parameter by value.</p>
82<p>To support this usage,
83  <code class="computeroutput">boost::reference_wrapper&lt;T&gt;</code> provides an implicit
84  conversion to <code class="computeroutput">T&amp;</code>. This usually allows the function
85  templates to work on references unmodified.</p>
86<p><code class="computeroutput">boost::reference_wrapper&lt;T&gt;</code> is
87  both CopyConstructible and Assignable (ordinary references are not
88  Assignable).</p>
89<p>The expression <code class="computeroutput">boost::ref(x)</code>
90  returns a
91  <code class="computeroutput">boost::reference_wrapper&lt;X&gt;(x)</code> where X
92  is the type of x. Similarly,
93  <code class="computeroutput">boost::cref(x)</code> returns a
94  <code class="computeroutput">boost::reference_wrapper&lt;X const&gt;(x)</code>.</p>
95<p>The expression
96  <code class="computeroutput">boost::is_reference_wrapper&lt;T&gt;::value</code>
97  is true if T is a <code class="computeroutput">reference_wrapper</code>, and
98  false otherwise.</p>
99<p>The type-expression
100  <code class="computeroutput">boost::unwrap_reference&lt;T&gt;::type</code> is T::type if T
101  is a <code class="computeroutput">reference_wrapper</code>, T otherwise.</p>
102</div>
103</div>
104<table width="100%"><tr>
105<td align="left"><small><p>Last revised: July 09, 2004 at 00:56:42 GMT</p></small></td>
106<td align="right"><small></small></td>
107</tr></table>
108<hr>
109<div class="spirit-nav">
110<a accesskey="p" href="id2363468.html"><img src="images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><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="ref/reference.html"><img src="images/next.png" alt="Next"></a>
111</div>
112</body>
113</html>
Note: See TracBrowser for help on using the repository browser.