Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/doc/html/ref.html @ 46

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

updated boost from 1_33_1 to 1_34_1

File size: 6.3 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>Chapter 11. Boost.Ref</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="libraries.html" title="Part I. The Boost C++ Libraries (BoostBook Subset)">
9<link rel="prev" href="BOOST_PROGRAM_OPTIONS_VERSION.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 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="BOOST_PROGRAM_OPTIONS_VERSION.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 11. 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="id1607122"></a><p>Subject to the Boost Software License, Version 1.0. See
46      accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at
47      <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>.
48      </p>
49</div></div>
50</div></div>
51<div class="toc">
52<p><b>Table of Contents</b></p>
53<dl>
54<dt><span class="section"><a href="ref.html#ref.intro">Introduction</a></span></dt>
55<dt><span class="section"><a href="ref/reference.html">Reference</a></span></dt>
56<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>
57<dt><span class="section"><a href="ref/ack.html">Acknowledgements</a></span></dt>
58</dl>
59</div>
60<div class="section" lang="en">
61<div class="titlepage"><div><div><h2 class="title" style="clear: both">
62<a name="ref.intro"></a>Introduction</h2></div></div></div>
63<p>The Ref library is a small library that is useful for passing
64  references to function templates (algorithms) that would usually
65  take copies of their arguments. It defines the class template
66  <code class="computeroutput"><a href="boost/reference_wrapper.html" title="Class template reference_wrapper">boost::reference_wrapper&lt;T&gt;</a></code>,
67  the two functions
68  <code class="computeroutput"><a href="boost/reference_wrapper.html#id1044490-bb">boost::ref</a></code> and
69  <code class="computeroutput"><a href="boost/reference_wrapper.html#boost.cref">boost::cref</a></code> that return
70  instances of <code class="computeroutput">boost::reference_wrapper&lt;T&gt;</code>, and the
71  two traits classes
72  <code class="computeroutput"><a href="boost/is_reference_wrapper.html" title="Class template is_reference_wrapper">boost::is_reference_wrapper&lt;T&gt;</a></code>
73  and
74  <code class="computeroutput"><a href="boost/unwrap_reference.html" title="Class template unwrap_reference">boost::unwrap_reference&lt;T&gt;</a></code>.</p>
75<p>The purpose of
76  <code class="computeroutput">boost::reference_wrapper&lt;T&gt;</code> is to
77  contain a reference to an object of type T. It is primarily used to
78  "feed" references to function templates (algorithms) that take their
79  parameter by value.</p>
80<p>To support this usage,
81  <code class="computeroutput">boost::reference_wrapper&lt;T&gt;</code> provides an implicit
82  conversion to <code class="computeroutput">T&amp;</code>. This usually allows the function
83  templates to work on references unmodified.</p>
84<p><code class="computeroutput">boost::reference_wrapper&lt;T&gt;</code> is
85  both CopyConstructible and Assignable (ordinary references are not
86  Assignable).</p>
87<p>The expression <code class="computeroutput">boost::ref(x)</code>
88  returns a
89  <code class="computeroutput">boost::reference_wrapper&lt;X&gt;(x)</code> where X
90  is the type of x. Similarly,
91  <code class="computeroutput">boost::cref(x)</code> returns a
92  <code class="computeroutput">boost::reference_wrapper&lt;X const&gt;(x)</code>.</p>
93<p>The expression
94  <code class="computeroutput">boost::is_reference_wrapper&lt;T&gt;::value</code>
95  is true if T is a <code class="computeroutput">reference_wrapper</code>, and
96  false otherwise.</p>
97<p>The type-expression
98  <code class="computeroutput">boost::unwrap_reference&lt;T&gt;::type</code> is T::type if T
99  is a <code class="computeroutput">reference_wrapper</code>, T otherwise.</p>
100</div>
101</div>
102<table width="100%"><tr>
103<td align="left"><small><p>Last revised: November 10, 2006 at 18:27:05 GMT</p></small></td>
104<td align="right"><small></small></td>
105</tr></table>
106<hr>
107<div class="spirit-nav">
108<a accesskey="p" href="BOOST_PROGRAM_OPTIONS_VERSION.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>
109</div>
110</body>
111</html>
Note: See TracBrowser for help on using the repository browser.