|
|
@@ -1,402 +0,0 @@
|
|
|
-<html>
|
|
|
-<head>
|
|
|
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
|
-<title>Class template function</title>
|
|
|
-<link rel="stylesheet" href="../boostbook.css" type="text/css">
|
|
|
-<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
|
|
|
-<link rel="start" href="../index.html" title="The Boost C++ Libraries">
|
|
|
-<link rel="up" href="../function/reference.html#header.boost.function.hpp" title="Header <boost/function.hpp>">
|
|
|
-<link rel="prev" href="../functionN.html" title="Class template functionN">
|
|
|
-<link rel="next" href="../function_equal.html" title="Function template function_equal">
|
|
|
-</head>
|
|
|
-<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
|
|
-<table cellpadding="2" width="100%">
|
|
|
-<td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../../boost.png"></td>
|
|
|
-<td align="center"><a href="../../../index.htm">Home</a></td>
|
|
|
-<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
|
|
|
-<td align="center"><a href="../../../people/people.htm">People</a></td>
|
|
|
-<td align="center"><a href="../../../more/faq.htm">FAQ</a></td>
|
|
|
-<td align="center"><a href="../../../more/index.htm">More</a></td>
|
|
|
-</table>
|
|
|
-<hr>
|
|
|
-<div class="spirit-nav">
|
|
|
-<a accesskey="p" href="../functionN.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../function/reference.html#header.boost.function.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="../function_equal.html"><img src="../images/next.png" alt="Next"></a>
|
|
|
-</div>
|
|
|
-<div class="refentry" lang="en">
|
|
|
-<a name="boost.function"></a><div class="titlepage"></div>
|
|
|
-<div class="refnamediv">
|
|
|
-<h2><span class="refentrytitle">Class template function</span></h2>
|
|
|
-<p>boost::function — A generalized function pointer that can be used for
|
|
|
- callbacks or wrapping function objects.</p>
|
|
|
-</div>
|
|
|
-<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
|
|
|
-<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><<span class="bold"><strong>typename</strong></span> Signature, <span class="emphasis"><em> // Function type R (T1, T2, ..., TN)</em></span>
|
|
|
- <span class="bold"><strong>typename</strong></span> Allocator = std::allocator<<span class="bold"><strong>void</strong></span>> >
|
|
|
-<span class="bold"><strong>class</strong></span> function : <span class="bold"><strong>public</strong></span> <a href="../functionN.html" title="Class template functionN">functionN</a><R, T1, T2, ..., TN, Allocator> {
|
|
|
-<span class="bold"><strong>public</strong></span>:
|
|
|
- <span class="emphasis"><em>// types</em></span>
|
|
|
- <span class="bold"><strong>typedef</strong></span> R result_type;
|
|
|
- <span class="bold"><strong>typedef</strong></span> Allocator allocator_type;
|
|
|
- <span class="bold"><strong>typedef</strong></span> T1 argument_type; <span class="emphasis"><em>// If N == 1</em></span>
|
|
|
- <span class="bold"><strong>typedef</strong></span> T1 first_argument_type; <span class="emphasis"><em>// If N == 2</em></span>
|
|
|
- <span class="bold"><strong>typedef</strong></span> T2 second_argument_type; <span class="emphasis"><em>// If N == 2</em></span>
|
|
|
- <span class="bold"><strong>typedef</strong></span> T1 arg1_type;
|
|
|
- <span class="bold"><strong>typedef</strong></span> T2 arg2_type;
|
|
|
- .
|
|
|
- .
|
|
|
- .
|
|
|
- <span class="bold"><strong>typedef</strong></span> TN argN_type;
|
|
|
-
|
|
|
- <span class="emphasis"><em>// static constants</em></span>
|
|
|
- <span class="bold"><strong>static</strong></span> <span class="bold"><strong>const</strong></span> <span class="bold"><strong>int</strong></span> arity = N;
|
|
|
-
|
|
|
- <span class="emphasis"><em>// <a href="../lambda.html" title="Chapter 6. Boost.Lambda">Lambda</a> library support</em></span>
|
|
|
- <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Args>
|
|
|
- <span class="bold"><strong>struct</strong></span> sig {
|
|
|
- <span class="emphasis"><em>// types</em></span>
|
|
|
- <span class="bold"><strong>typedef</strong></span> result_type type;
|
|
|
- };
|
|
|
-
|
|
|
- <span class="emphasis"><em>// <a href="function.html#boost.functionconstruct-copy-destruct">construct/copy/destruct</a></em></span>
|
|
|
- <a href="function.html#id1031759-bb">function</a>();
|
|
|
- <a href="function.html#id1046556-bb">function</a>(<span class="bold"><strong>const</strong></span> <a href="../functionN.html" title="Class template functionN">functionN</a>&);
|
|
|
- <a href="function.html#id1070102-bb">function</a>(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a>&);
|
|
|
- <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> F> <a href="function.html#id835586-bb">function</a>(F);
|
|
|
- function& <a href="function.html#id800435-bb"><span class="bold"><strong>operator</strong></span>=</a>(<span class="bold"><strong>const</strong></span> <a href="../functionN.html" title="Class template functionN">functionN</a>&);
|
|
|
- function& <a href="function.html#id1077825-bb"><span class="bold"><strong>operator</strong></span>=</a>(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a>&);
|
|
|
- <a href="function.html#id870390-bb">~function</a>();
|
|
|
-
|
|
|
- <span class="emphasis"><em>// <a href="function.html#id1073652-bb">modifiers</a></em></span>
|
|
|
- <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="function.html#id801534-bb">swap</a>(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a>&);
|
|
|
- <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="function.html#id903961-bb">clear</a>();
|
|
|
-
|
|
|
- <span class="emphasis"><em>// <a href="function.html#id1112252-bb">capacity</a></em></span>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="function.html#id972567-bb">empty</a>() <span class="bold"><strong>const</strong></span>;
|
|
|
- <a href="function.html#id1106579-bb"><span class="bold"><strong>operator</strong></span> safe_bool</a>() <span class="bold"><strong>const</strong></span>;
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="function.html#id1106977-bb"><span class="bold"><strong>operator</strong></span>!</a>() <span class="bold"><strong>const</strong></span>;
|
|
|
-
|
|
|
- <span class="emphasis"><em>// <a href="function.html#id970210-bb">target access</a></em></span>
|
|
|
- <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Functor> <span class="type">Functor*</span> <a href="function.html#id1037337-bb">target</a>();
|
|
|
- <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Functor> <span class="type"><span class="bold"><strong>const</strong></span> Functor*</span> <a href="function.html#id1003205-bb">target</a>() <span class="bold"><strong>const</strong></span>;
|
|
|
- <span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Functor> <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="function.html#id899187-bb">contains</a>(<span class="bold"><strong>const</strong></span> Functor&) <span class="bold"><strong>const</strong></span>;
|
|
|
-
|
|
|
- <span class="emphasis"><em>// <a href="function.html#id1000460-bb">invocation</a></em></span>
|
|
|
- <span class="type">result_type</span> <a href="function.html#id966548-bb"><span class="bold"><strong>operator</strong></span>()</a>(arg1_type, arg2_type, ..., argN_type) <span class="bold"><strong>const</strong></span>;
|
|
|
-};
|
|
|
-
|
|
|
-<span class="emphasis"><em>// <a href="function.html#id996764-bb">specialized algorithms</a></em></span>
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator>
|
|
|
- <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="function.html#id999224">swap</a>(<a href="function.html" title="Class template function">function</a><Signature, Allocator>&, <a href="function.html" title="Class template function">function</a><Signature, Allocator>&);
|
|
|
-
|
|
|
-<span class="emphasis"><em>// <a href="function.html#id894643-bb">comparison operators</a></em></span>
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="function.html#id1012910-bb"><span class="bold"><strong>operator</strong></span>==</a>(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>&, Functor);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="function.html#id827744-bb"><span class="bold"><strong>operator</strong></span>==</a>(Functor, <span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>&);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="function.html#id937738-bb"><span class="bold"><strong>operator</strong></span>==</a>(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>&,
|
|
|
- <a href="../reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor>);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="function.html#id1107517-bb"><span class="bold"><strong>operator</strong></span>==</a>(<a href="../reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor>,
|
|
|
- <span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>&);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature1, <span class="bold"><strong>typename</strong></span> Allocator1, <span class="bold"><strong>typename</strong></span> Signature2,
|
|
|
- <span class="bold"><strong>typename</strong></span> Allocator2>
|
|
|
- <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="function.html#id835486-bb"><span class="bold"><strong>operator</strong></span>==</a>(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature1, Allocator1>&,
|
|
|
- <span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature2, Allocator2>&);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="function.html#id834162-bb"><span class="bold"><strong>operator</strong></span>!=</a>(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>&, Functor);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="function.html#id961954-bb"><span class="bold"><strong>operator</strong></span>!=</a>(Functor, <span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>&);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="function.html#id867993-bb"><span class="bold"><strong>operator</strong></span>!=</a>(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>&,
|
|
|
- <a href="../reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor>);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a href="function.html#id1066866-bb"><span class="bold"><strong>operator</strong></span>!=</a>(<a href="../reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor>,
|
|
|
- <span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>&);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature1, <span class="bold"><strong>typename</strong></span> Allocator1, <span class="bold"><strong>typename</strong></span> Signature2,
|
|
|
- <span class="bold"><strong>typename</strong></span> Allocator2>
|
|
|
- <span class="type"><span class="bold"><strong>void</strong></span></span> <a href="function.html#id966586-bb"><span class="bold"><strong>operator</strong></span>!=</a>(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature1, Allocator1>&,
|
|
|
- <span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature2, Allocator2>&);</pre></div>
|
|
|
-<div class="refsect1" lang="en">
|
|
|
-<a name="id1212219"></a><h2>Description</h2>
|
|
|
-<p>Class template <a href="function.html" title="Class template function">function</a> is a thin
|
|
|
- wrapper around the numbered class templates <a href="../functionN.html" title="Class template functionN">function0</a>, <a href="../functionN.html" title="Class template functionN">function1</a>, etc. It accepts a
|
|
|
- function type with N arguments and will will derive from
|
|
|
- <a href="../functionN.html" title="Class template functionN">functionN</a> instantiated with the arguments
|
|
|
- it receives.</p>
|
|
|
-<p>The semantics of all operations in class template
|
|
|
- <a href="function.html" title="Class template function">function</a> are equivalent to that of the
|
|
|
- underlying <a href="../functionN.html" title="Class template functionN">functionN</a> object, although
|
|
|
- additional member functions are required to allow proper copy
|
|
|
- construction and copy assignment of function objects.</p>
|
|
|
-<div class="refsect2" lang="en">
|
|
|
-<a name="id1212276"></a><h3>
|
|
|
-<a name="boost.functionconstruct-copy-destruct"></a><code class="computeroutput">function</code> construct/copy/destruct</h3>
|
|
|
-<div class="orderedlist"><ol type="1">
|
|
|
-<li>
|
|
|
-<pre class="literallayout"><a name="id1031759-bb"></a>function();</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput">this-><a href="function.html#id972567-bb">empty</a>()</code><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw.</p>
|
|
|
-</li>
|
|
|
-<li>
|
|
|
-<pre class="literallayout"><a name="id1046556-bb"></a>function(<span class="bold"><strong>const</strong></span> <a href="../functionN.html" title="Class template functionN">functionN</a>& f);</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>:
|
|
|
-
|
|
|
- Contains a copy of the <code class="computeroutput">f</code>'s target, if it has one, or is empty if <code class="computeroutput">f.<a href="function.html#id972567-bb">empty</a>()</code>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw unless copying the target of <code class="computeroutput">f</code> throws.</p>
|
|
|
-</li>
|
|
|
-<li>
|
|
|
-<pre class="literallayout"><a name="id1070102-bb"></a>function(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a>& f);</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>:
|
|
|
-
|
|
|
- Contains a copy of the <code class="computeroutput">f</code>'s target, if it has one, or is empty if <code class="computeroutput">f.<a href="function.html#id972567-bb">empty</a>()</code>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw unless copying the target of <code class="computeroutput">f</code> throws.</p>
|
|
|
-</li>
|
|
|
-<li>
|
|
|
-<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> F> <a name="id835586-bb"></a>function(F f);</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Requires</span></b>:
|
|
|
-
|
|
|
- F is a function object Callable from <code class="computeroutput">this</code>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput">*this</code> targets a copy of <code class="computeroutput">f</code> if <code class="computeroutput">f</code> is nonempty, or <code class="computeroutput">this-><a href="function.html#id972567-bb">empty</a>()</code> if <code class="computeroutput">f</code> is empty.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw when <code class="computeroutput">f</code> is a stateless function object.</p>
|
|
|
-</li>
|
|
|
-<li>
|
|
|
-<pre class="literallayout">function& <a name="id800435-bb"></a><span class="bold"><strong>operator</strong></span>=(<span class="bold"><strong>const</strong></span> <a href="../functionN.html" title="Class template functionN">functionN</a>& f);</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput">*this</code> targets a copy of <code class="computeroutput">f</code>'s target, if it has one, or is empty if <code class="computeroutput">f.<a href="function.html#id972567-bb">empty</a>()</code><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw when the target of <code class="computeroutput">f</code> is a stateless function object or a reference to the function object.</p>
|
|
|
-</li>
|
|
|
-<li>
|
|
|
-<pre class="literallayout">function& <a name="id1077825-bb"></a><span class="bold"><strong>operator</strong></span>=(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a>& f);</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput">*this</code> targets a copy of <code class="computeroutput">f</code>'s target, if it has one, or is empty if <code class="computeroutput">f.<a href="function.html#id972567-bb">empty</a>()</code><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw when the target of <code class="computeroutput">f</code> is a stateless function object or a reference to the function object.</p>
|
|
|
-</li>
|
|
|
-<li>
|
|
|
-<pre class="literallayout"><a name="id870390-bb"></a>~function();</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>:
|
|
|
-
|
|
|
- If <code class="computeroutput">!this-><a href="function.html#id972567-bb">empty</a>()</code>, destroys the target of <code class="computeroutput">this</code>.</p>
|
|
|
-</li>
|
|
|
-</ol></div>
|
|
|
-</div>
|
|
|
-<div class="refsect2" lang="en">
|
|
|
-<a name="id1212765"></a><h3>
|
|
|
-<a name="id1073652-bb"></a><code class="computeroutput">function</code> modifiers</h3>
|
|
|
-<div class="orderedlist"><ol type="1">
|
|
|
-<li>
|
|
|
-<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id801534-bb"></a>swap(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a>& f);</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>:
|
|
|
-
|
|
|
- Interchanges the targets of <code class="computeroutput">*this</code> and <code class="computeroutput">f</code>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw.</p>
|
|
|
-</li>
|
|
|
-<li>
|
|
|
-<pre class="literallayout"><span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id903961-bb"></a>clear();</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Postconditions</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput">this-><a href="function.html#id972567-bb">empty</a>()</code><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw.</p>
|
|
|
-</li>
|
|
|
-</ol></div>
|
|
|
-</div>
|
|
|
-<div class="refsect2" lang="en">
|
|
|
-<a name="id1212892"></a><h3>
|
|
|
-<a name="id1112252-bb"></a><code class="computeroutput">function</code> capacity</h3>
|
|
|
-<div class="orderedlist"><ol type="1">
|
|
|
-<li>
|
|
|
-<pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id972567-bb"></a>empty() <span class="bold"><strong>const</strong></span>;</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput">false</code> if <code class="computeroutput">this</code> has a target, and <code class="computeroutput">true</code> otherwise.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw.</p>
|
|
|
-</li>
|
|
|
-<li>
|
|
|
-<pre class="literallayout"><a name="id1106579-bb"></a><span class="bold"><strong>operator</strong></span> safe_bool() <span class="bold"><strong>const</strong></span>;</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
|
|
|
-
|
|
|
- A <code class="computeroutput">safe_bool</code> that evaluates <code class="computeroutput">false</code> in a boolean context when <code class="computeroutput">this-><a href="function.html#id972567-bb">empty</a>()</code>, and <code class="computeroutput">true</code> otherwise.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw.</p>
|
|
|
-</li>
|
|
|
-<li>
|
|
|
-<pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id1106977-bb"></a><span class="bold"><strong>operator</strong></span>!() <span class="bold"><strong>const</strong></span>;</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput">this-><a href="function.html#id972567-bb">empty</a>()</code><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw.</p>
|
|
|
-</li>
|
|
|
-</ol></div>
|
|
|
-</div>
|
|
|
-<div class="refsect2" lang="en">
|
|
|
-<a name="id1213098"></a><h3>
|
|
|
-<a name="id970210-bb"></a><code class="computeroutput">function</code> target access</h3>
|
|
|
-<div class="orderedlist"><ol type="1">
|
|
|
-<li>
|
|
|
-<p><a name="id692435-bb"></a></p>
|
|
|
-<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Functor> <span class="type">Functor*</span> <a name="id1037337-bb"></a>target();
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Functor> <span class="type"><span class="bold"><strong>const</strong></span> Functor*</span> <a name="id1003205-bb"></a>target() <span class="bold"><strong>const</strong></span>;</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
|
|
|
-
|
|
|
- If <code class="computeroutput">this</code> stores a target of type
|
|
|
- <code class="computeroutput">Functor</code>, returns the address of the
|
|
|
- target. Otherwise, returns the NULL
|
|
|
- pointer.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw.</p>
|
|
|
-</li>
|
|
|
-<li>
|
|
|
-<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Functor> <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id899187-bb"></a>contains(<span class="bold"><strong>const</strong></span> Functor& f) <span class="bold"><strong>const</strong></span>;</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput">true</code> if <code class="computeroutput">this-><a href="function.html#id692435-bb">target</a><Functor>()</code> is non-NULL and <code class="computeroutput"><a href="../function_equal.html" title="Function template function_equal">function_equal</a>(*(this->target<Functor>()), f)</code></p>
|
|
|
-</li>
|
|
|
-</ol></div>
|
|
|
-</div>
|
|
|
-<div class="refsect2" lang="en">
|
|
|
-<a name="id1213293"></a><h3>
|
|
|
-<a name="id1000460-bb"></a><code class="computeroutput">function</code> invocation</h3>
|
|
|
-<div class="orderedlist"><ol type="1"><li>
|
|
|
-<pre class="literallayout"><span class="type">result_type</span> <a name="id966548-bb"></a><span class="bold"><strong>operator</strong></span>()(arg1_type a1, arg2_type a2, ... , argN_type aN) <span class="bold"><strong>const</strong></span>;</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput">f(a1, a2, ..., aN)</code>, where <code class="computeroutput">f</code> is the target of <code class="computeroutput">*this</code>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
|
|
|
-
|
|
|
- if <code class="computeroutput">R</code> is <code class="computeroutput">void</code>, nothing is returned; otherwise, the return value of the call to <code class="computeroutput">f</code> is returned.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput"><a href="../bad_function_call.html" title="Class bad_function_call">bad_function_call</a></code> if <code class="computeroutput">!this-><a href="function.html#id972567-bb">empty</a>()</code>. Otherwise, may through any exception thrown by the target function <code class="computeroutput">f</code>.</p>
|
|
|
-</li></ol></div>
|
|
|
-</div>
|
|
|
-<div class="refsect2" lang="en">
|
|
|
-<a name="id1213425"></a><h3>
|
|
|
-<a name="id996764-bb"></a><code class="computeroutput">function</code> specialized algorithms</h3>
|
|
|
-<div class="orderedlist"><ol type="1"><li>
|
|
|
-<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator>
|
|
|
- <span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id999224"></a>swap(<a href="function.html" title="Class template function">function</a><Signature, Allocator>& f1,
|
|
|
- <a href="function.html" title="Class template function">function</a><Signature, Allocator>& f2);</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Effects</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput">f1.<a href="function.html#id801534-bb">swap</a>(f2)</code><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Throws</span></b>:
|
|
|
-
|
|
|
- Will not throw.</p>
|
|
|
-</li></ol></div>
|
|
|
-</div>
|
|
|
-<div class="refsect2" lang="en">
|
|
|
-<a name="id1213524"></a><h3>
|
|
|
-<a name="id894643-bb"></a><code class="computeroutput">function</code> comparison operators</h3>
|
|
|
-<div class="orderedlist"><ol type="1">
|
|
|
-<li>
|
|
|
-<p><a name="id1075930"></a></p>
|
|
|
-<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id1012910-bb"></a><span class="bold"><strong>operator</strong></span>==(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>& f, Functor g);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id827744-bb"></a><span class="bold"><strong>operator</strong></span>==(Functor g, <span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>& f);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id937738-bb"></a><span class="bold"><strong>operator</strong></span>==(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>& f,
|
|
|
- <a href="../reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor> g);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id1107517-bb"></a><span class="bold"><strong>operator</strong></span>==(<a href="../reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor> g,
|
|
|
- <span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>& f);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature1, <span class="bold"><strong>typename</strong></span> Allocator1, <span class="bold"><strong>typename</strong></span> Signature2,
|
|
|
- <span class="bold"><strong>typename</strong></span> Allocator2>
|
|
|
- <span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id835486-bb"></a><span class="bold"><strong>operator</strong></span>==(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature1, Allocator1>& f1,
|
|
|
- <span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature2, Allocator2>& f2);</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
|
|
|
-
|
|
|
- True when <code class="computeroutput">f</code> stores an object of
|
|
|
- type <code class="computeroutput">Functor</code> and one of the following conditions applies:
|
|
|
- <div class="itemizedlist"><ul type="disc">
|
|
|
-<li>
|
|
|
-<code class="computeroutput">g</code> is of type
|
|
|
- <code class="computeroutput"><a href="../reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor></code>
|
|
|
- and <code class="computeroutput">f.target<Functor>() == g.<a href="../reference_wrapper.html#id656887-bb">get_pointer</a>()</code>.</li>
|
|
|
-<li>
|
|
|
-<code class="computeroutput">g</code> is not of type
|
|
|
- <code class="computeroutput"><a href="../reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor></code>
|
|
|
- and <code class="computeroutput">function_equals(*(f.target<Functor>()), g)</code>.</li>
|
|
|
-</ul></div><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Notes</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput"><a href="function.html" title="Class template function">function</a></code>
|
|
|
- objects are not
|
|
|
- <a href="../EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Rationale</span></b>:
|
|
|
-
|
|
|
- The <code class="computeroutput">safe_bool</code> conversion
|
|
|
- opens a loophole whereby two <code class="computeroutput">function</code>
|
|
|
- instances can be compared via <code class="computeroutput">==</code>, although this
|
|
|
- is not feasible to implement. The undefined <code class="computeroutput">void
|
|
|
- operator==</code> closes the loophole and ensures a
|
|
|
- compile-time or link-time error.</p>
|
|
|
-</li>
|
|
|
-<li>
|
|
|
-<p><a name="id1066261"></a></p>
|
|
|
-<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id834162-bb"></a><span class="bold"><strong>operator</strong></span>!=(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>& f, Functor g);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id961954-bb"></a><span class="bold"><strong>operator</strong></span>!=(Functor g, <span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>& f);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id867993-bb"></a><span class="bold"><strong>operator</strong></span>!=(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>& f,
|
|
|
- <a href="../reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor> g);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature, <span class="bold"><strong>typename</strong></span> Allocator, <span class="bold"><strong>typename</strong></span> Functor>
|
|
|
- <span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id1066866-bb"></a><span class="bold"><strong>operator</strong></span>!=(<a href="../reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor> g,
|
|
|
- <span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature, Allocator>& f);
|
|
|
-<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Signature1, <span class="bold"><strong>typename</strong></span> Allocator1, <span class="bold"><strong>typename</strong></span> Signature2,
|
|
|
- <span class="bold"><strong>typename</strong></span> Allocator2>
|
|
|
- <span class="type"><span class="bold"><strong>void</strong></span></span> <a name="id966586-bb"></a><span class="bold"><strong>operator</strong></span>!=(<span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature1, Allocator1>& f1,
|
|
|
- <span class="bold"><strong>const</strong></span> <a href="function.html" title="Class template function">function</a><Signature2, Allocator2>& f2);</pre>
|
|
|
-<p><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Returns</span></b>:
|
|
|
-
|
|
|
- True when <code class="computeroutput">f</code> does not store an
|
|
|
- object of type <code class="computeroutput">Functor</code> or it stores an object of
|
|
|
- type <code class="computeroutput">Functor</code> and one of the following conditions
|
|
|
- applies:
|
|
|
- <div class="itemizedlist"><ul type="disc">
|
|
|
-<li>
|
|
|
-<code class="computeroutput">g</code> is of type
|
|
|
- <code class="computeroutput"><a href="../reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor></code>
|
|
|
- and <code class="computeroutput">f.target<Functor>() != g.<a href="../reference_wrapper.html#id656887-bb">get_pointer</a>()</code>.</li>
|
|
|
-<li>
|
|
|
-<code class="computeroutput">g</code> is not of type
|
|
|
- <code class="computeroutput"><a href="../reference_wrapper.html" title="Class template reference_wrapper">reference_wrapper</a><Functor></code>
|
|
|
- and <code class="computeroutput">!function_equals(*(f.target<Functor>()), g)</code>.</li>
|
|
|
-</ul></div><br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Notes</span></b>:
|
|
|
-
|
|
|
- <code class="computeroutput"><a href="function.html" title="Class template function">function</a></code>
|
|
|
- objects are not
|
|
|
- <a href="../EqualityComparable.html" title="Concept EqualityComparable">EqualityComparable</a>.<br><b xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision"><span class="term">Rationale</span></b>:
|
|
|
-
|
|
|
- The <code class="computeroutput">safe_bool</code> conversion
|
|
|
- opens a loophole whereby two <code class="computeroutput">function</code>
|
|
|
- instances can be compared via <code class="computeroutput">!=</code>, although this
|
|
|
- is not feasible to implement. The undefined <code class="computeroutput">void
|
|
|
- operator!=</code> closes the loophole and ensures a
|
|
|
- compile-time or link-time error.</p>
|
|
|
-</li>
|
|
|
-</ol></div>
|
|
|
-</div>
|
|
|
-</div>
|
|
|
-</div>
|
|
|
-<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
|
|
-<td align="left"></td>
|
|
|
-<td align="right"><small>Copyright © 2001-2004 Douglas Gregor</small></td>
|
|
|
-</tr></table>
|
|
|
-<hr>
|
|
|
-<div class="spirit-nav">
|
|
|
-<a accesskey="p" href="../functionN.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../function/reference.html#header.boost.function.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="../function_equal.html"><img src="../images/next.png" alt="Next"></a>
|
|
|
-</div>
|
|
|
-</body>
|
|
|
-</html>
|