forked from boostorg/bind
account for new traits templates
[SVN r12468]
This commit is contained in:
58
ref.html
58
ref.html
@@ -35,8 +35,9 @@
|
||||
|
||||
<p>
|
||||
The header <a href="../../boost/ref.hpp">boost/ref.hpp</a> defines the class template
|
||||
<b>boost::reference_wrapper<T></b> and the two functions <b>boost::ref</b> and
|
||||
<b>boost::cref</b> that return instances of <b>boost::reference_wrapper<T></b>.
|
||||
<b>boost::reference_wrapper<T></b>, the two functions <b>boost::ref</b> and
|
||||
<b>boost::cref</b> that return instances of
|
||||
<b>boost::reference_wrapper<T></b>, and the two traits classes <b>boost::is_reference_wrapper<T></b> and <b>boost::unwrap_reference<T></b>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -62,6 +63,14 @@ where <b>X</b> is the type of <b>x</b>. Similarly, <b>boost::cref(x)</b>
|
||||
returns a <b>boost::reference_wrapper<X const>(x)</b>.
|
||||
</p>
|
||||
|
||||
<p>The expression <b>boost::is_reference_wrapper<T>::value</b> is
|
||||
<b>true</b> if <b>T</b> is a
|
||||
<b>reference_wrapper</b>, and <b>false</b> otherwise.
|
||||
|
||||
<p>The type-expression <b>boost::unwrap_reference<T>::type</b>
|
||||
is <b>T::type</b> if <b>T</b> is a
|
||||
<b>reference_wrapper</b>, <b>T</b> otherwise.
|
||||
|
||||
<h2>Interface</h2>
|
||||
|
||||
<h3>Synopsis</h3>
|
||||
@@ -72,6 +81,8 @@ namespace boost
|
||||
template<class T> class <a href="#reference_wrapper">reference_wrapper</a>;
|
||||
template<class T> reference_wrapper<T> <a href="#ref">ref</a>(T & t);
|
||||
template<class T> reference_wrapper<T const> <a href="#cref">cref</a>(T const & t);
|
||||
template<class T> class is_reference_wrapper<T const>;
|
||||
template<class T> class unwrap_reference<T const>;
|
||||
}
|
||||
</pre>
|
||||
|
||||
@@ -81,6 +92,7 @@ namespace boost
|
||||
template<class T> class reference_wrapper
|
||||
{
|
||||
public:
|
||||
typedef T type;
|
||||
|
||||
explicit <a href="#rt_construct">reference_wrapper</a>(T & t);
|
||||
|
||||
@@ -92,30 +104,36 @@ public:
|
||||
|
||||
<h4><a name="rt_construct">explicit reference_wrapper(T & 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 & () 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 & get() const</a></h4>
|
||||
|
||||
<blockquote>
|
||||
<p>
|
||||
<b>Returns:</b> the stored reference.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
</blockquote>
|
||||
|
||||
<h3><a name="ref">ref</a></h3>
|
||||
|
||||
@@ -123,12 +141,14 @@ public:
|
||||
template<class T> reference_wrapper<T> ref(T & t);
|
||||
</pre>
|
||||
|
||||
<blockquote>
|
||||
<p>
|
||||
<b>Returns:</b> <tt>reference_wrapper<T>(t)</tt>.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
</blockquote>
|
||||
|
||||
<h3><a name="cref">cref</a></h3>
|
||||
|
||||
@@ -136,19 +156,47 @@ template<class T> reference_wrapper<T> ref(T & t);
|
||||
template<class T> reference_wrapper<T const> cref(T const & t);
|
||||
</pre>
|
||||
|
||||
<blockquote>
|
||||
<p>
|
||||
<b>Returns:</b> <tt>reference_wrapper<T const>(t)</tt>.
|
||||
</p>
|
||||
<p>
|
||||
<b>Throws:</b> Nothing.
|
||||
</p>
|
||||
</blockquote>
|
||||
|
||||
<h3><a name="is_reference_wrapper">is_reference_wrapper</a></h3>
|
||||
|
||||
<pre>
|
||||
template<class T> class is_reference_wrapper<T const>
|
||||
{
|
||||
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<class T> class unwrap_reference<T const>
|
||||
{
|
||||
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.
|
||||
They were "promoted to <b>boost::</b> status" because they are generally
|
||||
useful.
|
||||
<b>ref</b> and <b>cref</b> were originally part of the Boost.Tuple
|
||||
library by <a href="../../people/jaakko_jarvi.htm"> Jaakko
|
||||
Jä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>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user