1
0
forked from boostorg/bind

Make this a forwarding header to the BoostBook-generated documentation

[SVN r17738]
This commit is contained in:
Douglas Gregor
2003-03-05 16:26:01 +00:00
parent 5454a5aac6
commit b32ebea99c

200
ref.html
View File

@@ -1,195 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Boost: ref.hpp documentation</title>
</head>
<body bgcolor="White">
<table border="0" width="100%">
<tr>
<td width="277">
<img src="../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86">
</td>
<td align="center">
<table border="0">
<tr>
<td nowrap><h1>ref.hpp</h1>
</td>
</tr>
<tr>
<td align="right" nowrap><small>&nbsp;1.00.0004 (2002-01-27)</small></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" height="64">&nbsp;</td>
</tr>
</table>
<h2>Files</h2>
<ul>
<li>
<a href="../../boost/ref.hpp">ref.hpp</a>
</ul>
<h2>Purpose</h2>
<p>
The header <a href="../../boost/ref.hpp">boost/ref.hpp</a> defines the class
template <b>boost::reference_wrapper&lt;T&gt;</b>, the two functions <b>boost::ref</b>
and <b>boost::cref</b> that return instances of <b>boost::reference_wrapper&lt;T&gt;</b>,
and the two traits classes <b>boost::is_reference_wrapper&lt;T&gt;</b> and <b>boost::unwrap_reference&lt;T&gt;</b>.
</p>
<p>
The purpose of <b>boost::reference_wrapper&lt;T&gt;</b> is to contain a
reference to an object of type <b>T</b>. It is primarily used to "feed"
references to function templates (algorithms) that take their parameter by
value.
</p>
<p>
To support this usage, <b>boost::reference_wrapper&lt;T&gt;</b> provides an
implicit conversion to <b>T &amp;</b>. This usually allows the function
templates to work on references unmodified.
</p>
<p>
<b>boost::reference_wrapper&lt;T&gt;</b> is both <b>CopyConstructible</b> and <b>Assignable</b>
(ordinary references are not <b>Assignable</b>).
</p>
<p>
The expression <b>boost::ref(x)</b> returns a <b>boost::reference_wrapper&lt;X&gt;(x)</b>
where <b>X</b> is the type of <b>x</b>. Similarly, <b>boost::cref(x)</b> returns
a <b>boost::reference_wrapper&lt;X const&gt;(x)</b>.
</p>
<p>
The expression <b>boost::is_reference_wrapper&lt;T&gt;::value</b> is <b>true</b>
if <b>T</b> is a <b>reference_wrapper</b>, and <b>false</b>
otherwise.
</p>
<p>
The type-expression <b>boost::unwrap_reference&lt;T&gt;::type</b> is <b>T::type</b>
if <b>T</b> is a <b>reference_wrapper</b>, <b>T</b> otherwise.
</p>
<h2>Interface</h2>
<h3>Synopsis</h3>
<pre>
namespace boost
{
template&lt;class T&gt; class <a href="#reference_wrapper">reference_wrapper</a>;
template&lt;class T&gt; reference_wrapper&lt;T&gt; <a href="#ref">ref</a>(T &amp; t);
template&lt;class T&gt; reference_wrapper&lt;T const&gt; <a href="#cref">cref</a>(T const &amp; t);
template&lt;class T&gt; class is_reference_wrapper&lt;T const&gt;;
template&lt;class T&gt; class unwrap_reference&lt;T const&gt;;
}
</pre>
<h3><a name="reference_wrapper">reference_wrapper</a></h3>
<pre>
template&lt;class T&gt; class reference_wrapper
{
public:
typedef T type;
explicit <a href="#rt_construct">reference_wrapper</a>(T &amp; t);
<a href="#rt_operator">operator T &amp;</a> () const;
T &amp; <a href="#rt_get">get</a>() const;
T* <a href="#rt_get_pointer">get_pointer</a>() const;
};
</pre>
<h4><a name="rt_construct">explicit reference_wrapper(T &amp; t)</a></h4>
<blockquote>
<p>
<b>Effects:</b> Constructs a <b>reference_wrapper</b> object that stores a
reference to <b>t</b>.
</p>
<p>
<b>Throws:</b> Nothing.
</p>
</blockquote>
<h4><a name="rt_operator">operator T &amp; () const</a></h4>
<blockquote>
<p>
<b>Returns:</b> the stored reference.
</p>
<p>
<b>Throws:</b> Nothing.
</p>
</blockquote>
<h4><a name="rt_get">T &amp; get() const</a></h4>
<blockquote>
<p>
<b>Returns:</b> the stored reference.
</p>
<p>
<b>Throws:</b> Nothing.
</p>
</blockquote>
<h4><a name="rt_get_pointer">T* get_pointer() const</a></h4>
<blockquote>
<p>
<b>Returns:</b> a pointer to the stored object.
</p>
<p>
<b>Throws:</b> Nothing.
</p>
</blockquote>
<h3><a name="ref">ref</a></h3>
<pre>
template&lt;class T&gt; reference_wrapper&lt;T&gt; ref(T &amp; t);
</pre>
<blockquote>
<p>
<b>Returns:</b> <tt>reference_wrapper&lt;T&gt;(t)</tt>.
</p>
<p>
<b>Throws:</b> Nothing.
</p>
</blockquote>
<h3><a name="cref">cref</a></h3>
<pre>
template&lt;class T&gt; reference_wrapper&lt;T const&gt; cref(T const &amp; t);
</pre>
<blockquote>
<p>
<b>Returns:</b> <tt>reference_wrapper&lt;T const&gt;(t)</tt>.
</p>
<p>
<b>Throws:</b> Nothing.
</p>
</blockquote>
<h3><a name="is_reference_wrapper">is_reference_wrapper</a></h3>
<pre>
template&lt;class T&gt; class is_reference_wrapper&lt;T const&gt;
{
public:
static bool value = <i>unspecified</i>;
};
</pre>
Value is <b>true</b> iff <tt>T</tt> is a specialization of <tt>reference_wrapper</tt>.
<h3><a name="unwrap_reference">unwrap_reference</a></h3>
<pre>
template&lt;class T&gt; class unwrap_reference&lt;T const&gt;
{
public:
typedef <i>unspecified</i> type;
};
</pre>
<tt>type</tt> is equivalent to <tt>T::type</tt> if <tt>T</tt> is a
specialization of <tt>reference_wrapper</tt>. Otherwise <tt>type</tt> is
equivalent to <tt>T</tt>.
<h2>Acknowledgements</h2>
<p>
<b>ref</b> and <b>cref</b> were originally part of the Boost.Tuple library by <a href="../../people/jaakko_jarvi.htm">
Jaakko J&auml;rvi</a>. They were "promoted to <b>boost::</b> status" by <a href="../../people/peter_dimov.htm">
Peter Dimov</a> because they are generally useful. <a href="../../people/doug_gregor.html">
Douglas Gregor</a> and <a href="../../people/dave_abrahams.htm">Dave Abrahams</a>
contributed <tt>is_reference_wrapper</tt> and <tt>unwrap_reference</tt>.
</p>
<p><br>
<br>
<br>
<small>Copyright &copy; 2001 by Peter Dimov and Multi Media Ltd. Permission to
copy, use, modify, sell and distribute this document is granted provided this
copyright notice appears in all copies. This document is provided &quot;as
is&quot; without express or implied warranty, and with no claim as to its
suitability for any purpose.</small></p>
</body>
<head>
<meta http-equiv="refresh" content="0; URL=../../doc/html/ref.html">
</head>
<body>
Automatic redirection failed, please go to
<a href="../../doc/html/ref.html">../../doc/html/ref.html</a>
</body>
</html>