mirror of
https://github.com/boostorg/functional.git
synced 2025-08-02 22:14:28 +02:00
@@ -107,7 +107,7 @@ interfaces.
|
|||||||
|
|
||||||
// [...]
|
// [...]
|
||||||
|
|
||||||
std::auto_ptr<an_abstract_factory> x = factories[some_name]->create();
|
std::auto_ptr<an_abstract_class> x(factories.at(some_name).create());
|
||||||
|
|
||||||
// [...]
|
// [...]
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||||
<title>Chapter<EFBFBD>1.<2E>Boost.Functional/Factory 1.0</title>
|
<title>Chapter 1. Boost.Functional/Factory 1.0</title>
|
||||||
<link rel="stylesheet" href="boostbook.css" type="text/css">
|
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||||
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
|
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||||
<link rel="start" href="index.html" title="Chapter<EFBFBD>1.<2E>Boost.Functional/Factory 1.0">
|
<link rel="home" href="index.html" title="Chapter 1. Boost.Functional/Factory 1.0">
|
||||||
</head>
|
</head>
|
||||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||||
<table cellpadding="2" width="100%"><tr>
|
<table cellpadding="2" width="100%"><tr>
|
||||||
@@ -17,16 +17,16 @@
|
|||||||
</tr></table>
|
</tr></table>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="spirit-nav"></div>
|
<div class="spirit-nav"></div>
|
||||||
<div class="chapter" lang="en">
|
<div class="chapter">
|
||||||
<div class="titlepage"><div>
|
<div class="titlepage"><div>
|
||||||
<div><h2 class="title">
|
<div><h2 class="title">
|
||||||
<a name="boost_functional_factory"></a>Chapter<EFBFBD>1.<2E>Boost.Functional/Factory 1.0</h2></div>
|
<a name="boost_functional_factory"></a>Chapter 1. Boost.Functional/Factory 1.0</h2></div>
|
||||||
<div><div class="author"><h3 class="author">
|
<div><div class="author"><h3 class="author">
|
||||||
<span class="firstname">Tobias</span> <span class="surname">Schwinger</span>
|
<span class="firstname">Tobias</span> <span class="surname">Schwinger</span>
|
||||||
</h3></div></div>
|
</h3></div></div>
|
||||||
<div><p class="copyright">Copyright <EFBFBD> 2007, 2008 Tobias Schwinger</p></div>
|
<div><p class="copyright">Copyright © 2007, 2008 Tobias Schwinger</p></div>
|
||||||
<div><div class="legalnotice">
|
<div><div class="legalnotice">
|
||||||
<a name="id934161"></a><p>
|
<a name="id2865350"></a><p>
|
||||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||||
</p>
|
</p>
|
||||||
@@ -37,14 +37,15 @@
|
|||||||
<dl>
|
<dl>
|
||||||
<dt><span class="section"><a href="index.html#boost_functional_factory.brief_description">Brief Description</a></span></dt>
|
<dt><span class="section"><a href="index.html#boost_functional_factory.brief_description">Brief Description</a></span></dt>
|
||||||
<dt><span class="section"><a href="index.html#boost_functional_factory.background">Background</a></span></dt>
|
<dt><span class="section"><a href="index.html#boost_functional_factory.background">Background</a></span></dt>
|
||||||
<dt><span class="section"><a href="index.html#boost_functional_factory.reference"> Reference</a></span></dt>
|
<dt><span class="section"><a href="index.html#boost_functional_factory.reference">Reference</a></span></dt>
|
||||||
<dt><span class="section"><a href="index.html#boost_functional_factory.acknowledgements">Acknowledgements</a></span></dt>
|
<dt><span class="section"><a href="index.html#boost_functional_factory.acknowledgements">Acknowledgements</a></span></dt>
|
||||||
<dt><span class="section"><a href="index.html#boost_functional_factory.references">References</a></span></dt>
|
<dt><span class="section"><a href="index.html#boost_functional_factory.references">References</a></span></dt>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" lang="en">
|
<div class="section">
|
||||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||||
<a name="boost_functional_factory.brief_description"></a><a href="index.html#boost_functional_factory.brief_description" title="Brief Description">Brief Description</a></h2></div></div></div>
|
<a name="boost_functional_factory.brief_description"></a><a class="link" href="index.html#boost_functional_factory.brief_description" title="Brief Description">Brief Description</a>
|
||||||
|
</h2></div></div></div>
|
||||||
<p>
|
<p>
|
||||||
The template <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">factory</span></code> lets you encapsulate a <code class="computeroutput"><span class="keyword">new</span></code> expression as a function object, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">value_factory</span></code>
|
The template <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">factory</span></code> lets you encapsulate a <code class="computeroutput"><span class="keyword">new</span></code> expression as a function object, <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">value_factory</span></code>
|
||||||
encapsulates a constructor invocation without <code class="computeroutput"><span class="keyword">new</span></code>.
|
encapsulates a constructor invocation without <code class="computeroutput"><span class="keyword">new</span></code>.
|
||||||
@@ -61,9 +62,10 @@
|
|||||||
or <a href="http://www.boost.org/libs/bind/bind.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span></code></a>.
|
or <a href="http://www.boost.org/libs/bind/bind.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span></code></a>.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" lang="en">
|
<div class="section">
|
||||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||||
<a name="boost_functional_factory.background"></a><a href="index.html#boost_functional_factory.background" title="Background">Background</a></h2></div></div></div>
|
<a name="boost_functional_factory.background"></a><a class="link" href="index.html#boost_functional_factory.background" title="Background">Background</a>
|
||||||
|
</h2></div></div></div>
|
||||||
<p>
|
<p>
|
||||||
In traditional Object Oriented Programming a Factory is an object implementing
|
In traditional Object Oriented Programming a Factory is an object implementing
|
||||||
an interface of one or more methods that construct objects conforming to known
|
an interface of one or more methods that construct objects conforming to known
|
||||||
@@ -112,7 +114,7 @@
|
|||||||
|
|
||||||
<span class="comment">// [...]
|
<span class="comment">// [...]
|
||||||
</span>
|
</span>
|
||||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">auto_ptr</span><span class="special"><</span><span class="identifier">an_abstract_factory</span><span class="special">></span> <span class="identifier">x</span> <span class="special">=</span> <span class="identifier">factories</span><span class="special">[</span><span class="identifier">some_name</span><span class="special">]-></span><span class="identifier">create</span><span class="special">();</span>
|
<span class="identifier">std</span><span class="special">::</span><span class="identifier">auto_ptr</span><span class="special"><</span><span class="identifier">an_abstract_class</span><span class="special">></span> <span class="identifier">x</span><span class="special">(</span><span class="identifier">factories</span><span class="special">.</span><span class="identifier">at</span><span class="special">(</span><span class="identifier">some_name</span><span class="special">).</span><span class="identifier">create</span><span class="special">());</span>
|
||||||
|
|
||||||
<span class="comment">// [...]
|
<span class="comment">// [...]
|
||||||
</span><span class="special">}</span>
|
</span><span class="special">}</span>
|
||||||
@@ -130,7 +132,7 @@
|
|||||||
<span class="identifier">objects</span><span class="special">,</span>
|
<span class="identifier">objects</span><span class="special">,</span>
|
||||||
<span class="identifier">o</span> <span class="identifier">we</span> <span class="identifier">might</span> <span class="keyword">not</span> <span class="identifier">necessarily</span> <span class="identifier">need</span> <span class="identifier">a</span> <span class="identifier">polymorphic</span> <span class="identifier">base</span> <span class="keyword">class</span> <span class="keyword">for</span> <span class="identifier">the</span> <span class="identifier">objects</span><span class="special">,</span>
|
<span class="identifier">o</span> <span class="identifier">we</span> <span class="identifier">might</span> <span class="keyword">not</span> <span class="identifier">necessarily</span> <span class="identifier">need</span> <span class="identifier">a</span> <span class="identifier">polymorphic</span> <span class="identifier">base</span> <span class="keyword">class</span> <span class="keyword">for</span> <span class="identifier">the</span> <span class="identifier">objects</span><span class="special">,</span>
|
||||||
<span class="identifier">o</span> <span class="identifier">as</span> <span class="identifier">we</span> <span class="identifier">will</span> <span class="identifier">see</span><span class="special">,</span> <span class="identifier">we</span> <span class="keyword">do</span> <span class="keyword">not</span> <span class="identifier">need</span> <span class="identifier">a</span> <span class="identifier">factory</span> <span class="identifier">base</span> <span class="keyword">class</span> <span class="identifier">at</span> <span class="identifier">all</span><span class="special">,</span>
|
<span class="identifier">o</span> <span class="identifier">as</span> <span class="identifier">we</span> <span class="identifier">will</span> <span class="identifier">see</span><span class="special">,</span> <span class="identifier">we</span> <span class="keyword">do</span> <span class="keyword">not</span> <span class="identifier">need</span> <span class="identifier">a</span> <span class="identifier">factory</span> <span class="identifier">base</span> <span class="keyword">class</span> <span class="identifier">at</span> <span class="identifier">all</span><span class="special">,</span>
|
||||||
<span class="identifier">o</span> <span class="identifier">we</span> <span class="identifier">might</span> <span class="identifier">want</span> <span class="identifier">to</span> <span class="identifier">just</span> <span class="identifier">call</span> <span class="identifier">the</span> <span class="identifier">constructor</span> <span class="special">-</span> <span class="identifier">without</span> #<span class="keyword">new</span># <span class="identifier">to</span> <span class="identifier">create</span>
|
<span class="identifier">o</span> <span class="identifier">we</span> <span class="identifier">might</span> <span class="identifier">want</span> <span class="identifier">to</span> <span class="identifier">just</span> <span class="identifier">call</span> <span class="identifier">the</span> <span class="identifier">constructor</span> <span class="special">-</span> <span class="identifier">without</span> <span class="error">`</span><span class="keyword">new</span><span class="error">`</span> <span class="identifier">to</span> <span class="identifier">create</span>
|
||||||
<span class="identifier">an</span> <span class="identifier">object</span> <span class="identifier">on</span> <span class="identifier">the</span> <span class="identifier">stack</span><span class="special">,</span> <span class="keyword">and</span>
|
<span class="identifier">an</span> <span class="identifier">object</span> <span class="identifier">on</span> <span class="identifier">the</span> <span class="identifier">stack</span><span class="special">,</span> <span class="keyword">and</span>
|
||||||
<span class="identifier">o</span> <span class="identifier">finally</span> <span class="identifier">we</span> <span class="identifier">might</span> <span class="identifier">want</span> <span class="identifier">to</span> <span class="identifier">use</span> <span class="identifier">customized</span> <span class="identifier">memory</span> <span class="identifier">management</span><span class="special">.</span>
|
<span class="identifier">o</span> <span class="identifier">finally</span> <span class="identifier">we</span> <span class="identifier">might</span> <span class="identifier">want</span> <span class="identifier">to</span> <span class="identifier">use</span> <span class="identifier">customized</span> <span class="identifier">memory</span> <span class="identifier">management</span><span class="special">.</span>
|
||||||
</pre>
|
</pre>
|
||||||
@@ -246,33 +248,35 @@
|
|||||||
<a href="http://www.boost.org/libs/smart_ptr/index.html" target="_top">Smart Pointers</a>.
|
<a href="http://www.boost.org/libs/smart_ptr/index.html" target="_top">Smart Pointers</a>.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" lang="en">
|
<div class="section">
|
||||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||||
<a name="boost_functional_factory.reference"></a><a href="index.html#boost_functional_factory.reference" title=" Reference"> Reference</a></h2></div></div></div>
|
<a name="boost_functional_factory.reference"></a><a class="link" href="index.html#boost_functional_factory.reference" title="Reference">Reference</a>
|
||||||
|
</h2></div></div></div>
|
||||||
<div class="toc"><dl>
|
<div class="toc"><dl>
|
||||||
<dt><span class="section"><a href="index.html#boost_functional_factory.reference.value_factory">value_factory</a></span></dt>
|
<dt><span class="section"><a href="index.html#boost_functional_factory.reference.value_factory">value_factory</a></span></dt>
|
||||||
<dt><span class="section"><a href="index.html#boost_functional_factory.reference.factory">factory</a></span></dt>
|
<dt><span class="section"><a href="index.html#boost_functional_factory.reference.factory">factory</a></span></dt>
|
||||||
</dl></div>
|
</dl></div>
|
||||||
<div class="section" lang="en">
|
<div class="section">
|
||||||
<div class="titlepage"><div><div><h3 class="title">
|
<div class="titlepage"><div><div><h3 class="title">
|
||||||
<a name="boost_functional_factory.reference.value_factory"></a><a href="index.html#boost_functional_factory.reference.value_factory" title="value_factory">value_factory</a></h3></div></div></div>
|
<a name="boost_functional_factory.reference.value_factory"></a><a class="link" href="index.html#boost_functional_factory.reference.value_factory" title="value_factory">value_factory</a>
|
||||||
<a name="boost_functional_factory.reference.value_factory.description"></a><h4>
|
</h3></div></div></div>
|
||||||
<a name="id936876"></a>
|
<a name="boost_functional_factory.reference.value_factory.description"></a><h5>
|
||||||
<a href="index.html#boost_functional_factory.reference.value_factory.description">Description</a>
|
<a name="boost_functional_factory.reference.value_factory.description-heading"></a>
|
||||||
</h4>
|
<a class="link" href="index.html#boost_functional_factory.reference.value_factory.description">Description</a>
|
||||||
|
</h5>
|
||||||
<p>
|
<p>
|
||||||
Function object template that invokes the constructor of the type <code class="computeroutput"><span class="identifier">T</span></code>.
|
Function object template that invokes the constructor of the type <code class="computeroutput"><span class="identifier">T</span></code>.
|
||||||
</p>
|
</p>
|
||||||
<a name="boost_functional_factory.reference.value_factory.header"></a><h4>
|
<a name="boost_functional_factory.reference.value_factory.header"></a><h5>
|
||||||
<a name="id936914"></a>
|
<a name="boost_functional_factory.reference.value_factory.header-heading"></a>
|
||||||
<a href="index.html#boost_functional_factory.reference.value_factory.header">Header</a>
|
<a class="link" href="index.html#boost_functional_factory.reference.value_factory.header">Header</a>
|
||||||
</h4>
|
</h5>
|
||||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">functional</span><span class="special">/</span><span class="identifier">value_factory</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">functional</span><span class="special">/</span><span class="identifier">value_factory</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||||
</pre>
|
</pre>
|
||||||
<a name="boost_functional_factory.reference.value_factory.synopsis"></a><h4>
|
<a name="boost_functional_factory.reference.value_factory.synopsis"></a><h5>
|
||||||
<a name="id936989"></a>
|
<a name="boost_functional_factory.reference.value_factory.synopsis-heading"></a>
|
||||||
<a href="index.html#boost_functional_factory.reference.value_factory.synopsis">Synopsis</a>
|
<a class="link" href="index.html#boost_functional_factory.reference.value_factory.synopsis">Synopsis</a>
|
||||||
</h4>
|
</h5>
|
||||||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
||||||
<span class="special">{</span>
|
<span class="special">{</span>
|
||||||
<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">></span>
|
<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T</span> <span class="special">></span>
|
||||||
@@ -284,27 +288,27 @@
|
|||||||
<dl>
|
<dl>
|
||||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">T</span></code></span></dt>
|
<dt><span class="term"><code class="computeroutput"><span class="identifier">T</span></code></span></dt>
|
||||||
<dd><p>
|
<dd><p>
|
||||||
an arbitrary type with at least one public constructor
|
an arbitrary type with at least one public constructor
|
||||||
</p></dd>
|
</p></dd>
|
||||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code></span></dt>
|
<dt><span class="term"><code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code></span></dt>
|
||||||
<dd><p>
|
<dd><p>
|
||||||
argument LValues to a constructor of <code class="computeroutput"><span class="identifier">T</span></code>
|
argument LValues to a constructor of <code class="computeroutput"><span class="identifier">T</span></code>
|
||||||
</p></dd>
|
</p></dd>
|
||||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">F</span></code></span></dt>
|
<dt><span class="term"><code class="computeroutput"><span class="identifier">F</span></code></span></dt>
|
||||||
<dd><p>
|
<dd><p>
|
||||||
the type <code class="computeroutput"><span class="identifier">value_factory</span><span class="special"><</span><span class="identifier">F</span><span class="special">></span></code>
|
the type <code class="computeroutput"><span class="identifier">value_factory</span><span class="special"><</span><span class="identifier">F</span><span class="special">></span></code>
|
||||||
</p></dd>
|
</p></dd>
|
||||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">f</span></code></span></dt>
|
<dt><span class="term"><code class="computeroutput"><span class="identifier">f</span></code></span></dt>
|
||||||
<dd><p>
|
<dd><p>
|
||||||
an instance object of <code class="computeroutput"><span class="identifier">F</span></code>
|
an instance object of <code class="computeroutput"><span class="identifier">F</span></code>
|
||||||
</p></dd>
|
</p></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<a name="boost_functional_factory.reference.value_factory.expression_semantics"></a><h4>
|
<a name="boost_functional_factory.reference.value_factory.expression_semantics"></a><h5>
|
||||||
<a name="id937226"></a>
|
<a name="boost_functional_factory.reference.value_factory.expression_semantics-heading"></a>
|
||||||
<a href="index.html#boost_functional_factory.reference.value_factory.expression_semantics">Expression
|
<a class="link" href="index.html#boost_functional_factory.reference.value_factory.expression_semantics">Expression
|
||||||
Semantics</a>
|
Semantics</a>
|
||||||
</h4>
|
</h5>
|
||||||
<div class="informaltable"><table class="table">
|
<div class="informaltable"><table class="table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col>
|
<col>
|
||||||
@@ -312,83 +316,84 @@
|
|||||||
</colgroup>
|
</colgroup>
|
||||||
<thead><tr>
|
<thead><tr>
|
||||||
<th>
|
<th>
|
||||||
<p>
|
<p>
|
||||||
Expression
|
Expression
|
||||||
</p>
|
</p>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<p>
|
<p>
|
||||||
Semantics
|
Semantics
|
||||||
</p>
|
</p>
|
||||||
</th>
|
</th>
|
||||||
</tr></thead>
|
</tr></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<code class="computeroutput"><span class="identifier">F</span><span class="special">()</span></code>
|
<code class="computeroutput"><span class="identifier">F</span><span class="special">()</span></code>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
creates an object of type <code class="computeroutput"><span class="identifier">F</span></code>.
|
creates an object of type <code class="computeroutput"><span class="identifier">F</span></code>.
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<code class="computeroutput"><span class="identifier">F</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span></code>
|
<code class="computeroutput"><span class="identifier">F</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span></code>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
creates an object of type <code class="computeroutput"><span class="identifier">F</span></code>.
|
creates an object of type <code class="computeroutput"><span class="identifier">F</span></code>.
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span><span class="special">)</span></code>
|
<code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span><span class="special">)</span></code>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
returns <code class="computeroutput"><span class="identifier">T</span><span class="special">(</span><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span><span class="special">)</span></code>.
|
returns <code class="computeroutput"><span class="identifier">T</span><span class="special">(</span><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span><span class="special">)</span></code>.
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<code class="computeroutput"><span class="identifier">F</span><span class="special">::</span><span class="identifier">result_type</span></code>
|
<code class="computeroutput"><span class="identifier">F</span><span class="special">::</span><span class="identifier">result_type</span></code>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
is the type <code class="computeroutput"><span class="identifier">T</span></code>.
|
is the type <code class="computeroutput"><span class="identifier">T</span></code>.
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table></div>
|
</table></div>
|
||||||
<a name="boost_functional_factory.reference.value_factory.limits"></a><h4>
|
<a name="boost_functional_factory.reference.value_factory.limits"></a><h5>
|
||||||
<a name="id937498"></a>
|
<a name="boost_functional_factory.reference.value_factory.limits-heading"></a>
|
||||||
<a href="index.html#boost_functional_factory.reference.value_factory.limits">Limits</a>
|
<a class="link" href="index.html#boost_functional_factory.reference.value_factory.limits">Limits</a>
|
||||||
</h4>
|
</h5>
|
||||||
<p>
|
<p>
|
||||||
The macro BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY can be defined to set
|
The macro BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY can be defined to set
|
||||||
the maximum arity. It defaults to 10.
|
the maximum arity. It defaults to 10.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" lang="en">
|
<div class="section">
|
||||||
<div class="titlepage"><div><div><h3 class="title">
|
<div class="titlepage"><div><div><h3 class="title">
|
||||||
<a name="boost_functional_factory.reference.factory"></a><a href="index.html#boost_functional_factory.reference.factory" title="factory">factory</a></h3></div></div></div>
|
<a name="boost_functional_factory.reference.factory"></a><a class="link" href="index.html#boost_functional_factory.reference.factory" title="factory">factory</a>
|
||||||
<a name="boost_functional_factory.reference.factory.description"></a><h4>
|
</h3></div></div></div>
|
||||||
<a name="id937545"></a>
|
<a name="boost_functional_factory.reference.factory.description"></a><h5>
|
||||||
<a href="index.html#boost_functional_factory.reference.factory.description">Description</a>
|
<a name="boost_functional_factory.reference.factory.description-heading"></a>
|
||||||
</h4>
|
<a class="link" href="index.html#boost_functional_factory.reference.factory.description">Description</a>
|
||||||
|
</h5>
|
||||||
<p>
|
<p>
|
||||||
Function object template that dynamically constructs a pointee object for
|
Function object template that dynamically constructs a pointee object for
|
||||||
the type of pointer given as template argument. Smart pointers may be used
|
the type of pointer given as template argument. Smart pointers may be used
|
||||||
@@ -396,12 +401,12 @@
|
|||||||
yields the pointee type.
|
yields the pointee type.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
If an <span class="underline">_allocator</span>_ is given, it is used
|
If an <span class="underline">_allocator_</span> is given, it is used
|
||||||
for memory allocation and the placement form of the <code class="computeroutput"><span class="keyword">new</span></code>
|
for memory allocation and the placement form of the <code class="computeroutput"><span class="keyword">new</span></code>
|
||||||
operator is used to construct the object. A function object that calls the
|
operator is used to construct the object. A function object that calls the
|
||||||
destructor and deallocates the memory with a copy of the Allocator is used
|
destructor and deallocates the memory with a copy of the Allocator is used
|
||||||
for the second constructor argument of <code class="computeroutput"><span class="identifier">Pointer</span></code>
|
for the second constructor argument of <code class="computeroutput"><span class="identifier">Pointer</span></code>
|
||||||
(thus it must be a __smart<span class="underline">pointer</span>_
|
(thus it must be a <span class="underline">_smart_pointer_</span>
|
||||||
that provides a suitable constructor, such as <a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span></code></a>).
|
that provides a suitable constructor, such as <a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span></code></a>).
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@@ -409,16 +414,16 @@
|
|||||||
the allocator itself is used for the third constructor argument of <code class="computeroutput"><span class="identifier">Pointer</span></code> (<a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span></code></a> then uses the allocator
|
the allocator itself is used for the third constructor argument of <code class="computeroutput"><span class="identifier">Pointer</span></code> (<a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_ptr</span></code></a> then uses the allocator
|
||||||
to manage the memory of its seperately allocated reference counter).
|
to manage the memory of its seperately allocated reference counter).
|
||||||
</p>
|
</p>
|
||||||
<a name="boost_functional_factory.reference.factory.header"></a><h4>
|
<a name="boost_functional_factory.reference.factory.header"></a><h5>
|
||||||
<a name="id937729"></a>
|
<a name="boost_functional_factory.reference.factory.header-heading"></a>
|
||||||
<a href="index.html#boost_functional_factory.reference.factory.header">Header</a>
|
<a class="link" href="index.html#boost_functional_factory.reference.factory.header">Header</a>
|
||||||
</h4>
|
</h5>
|
||||||
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">functional</span><span class="special">/</span><span class="identifier">factory</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">functional</span><span class="special">/</span><span class="identifier">factory</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||||
</pre>
|
</pre>
|
||||||
<a name="boost_functional_factory.reference.factory.synopsis"></a><h4>
|
<a name="boost_functional_factory.reference.factory.synopsis"></a><h5>
|
||||||
<a name="id937804"></a>
|
<a name="boost_functional_factory.reference.factory.synopsis-heading"></a>
|
||||||
<a href="index.html#boost_functional_factory.reference.factory.synopsis">Synopsis</a>
|
<a class="link" href="index.html#boost_functional_factory.reference.factory.synopsis">Synopsis</a>
|
||||||
</h4>
|
</h5>
|
||||||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
||||||
<span class="special">{</span>
|
<span class="special">{</span>
|
||||||
<span class="keyword">enum</span> <span class="identifier">factory_alloc_propagation</span>
|
<span class="keyword">enum</span> <span class="identifier">factory_alloc_propagation</span>
|
||||||
@@ -439,31 +444,31 @@
|
|||||||
<dl>
|
<dl>
|
||||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">T</span></code></span></dt>
|
<dt><span class="term"><code class="computeroutput"><span class="identifier">T</span></code></span></dt>
|
||||||
<dd><p>
|
<dd><p>
|
||||||
an arbitrary type with at least one public constructor
|
an arbitrary type with at least one public constructor
|
||||||
</p></dd>
|
</p></dd>
|
||||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">P</span></code></span></dt>
|
<dt><span class="term"><code class="computeroutput"><span class="identifier">P</span></code></span></dt>
|
||||||
<dd><p>
|
<dd><p>
|
||||||
pointer or smart pointer to <code class="computeroutput"><span class="identifier">T</span></code>
|
pointer or smart pointer to <code class="computeroutput"><span class="identifier">T</span></code>
|
||||||
</p></dd>
|
</p></dd>
|
||||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code></span></dt>
|
<dt><span class="term"><code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code></span></dt>
|
||||||
<dd><p>
|
<dd><p>
|
||||||
argument LValues to a constructor of <code class="computeroutput"><span class="identifier">T</span></code>
|
argument LValues to a constructor of <code class="computeroutput"><span class="identifier">T</span></code>
|
||||||
</p></dd>
|
</p></dd>
|
||||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">F</span></code></span></dt>
|
<dt><span class="term"><code class="computeroutput"><span class="identifier">F</span></code></span></dt>
|
||||||
<dd><p>
|
<dd><p>
|
||||||
the type <code class="computeroutput"><span class="identifier">factory</span><span class="special"><</span><span class="identifier">P</span><span class="special">></span></code>
|
the type <code class="computeroutput"><span class="identifier">factory</span><span class="special"><</span><span class="identifier">P</span><span class="special">></span></code>
|
||||||
</p></dd>
|
</p></dd>
|
||||||
<dt><span class="term"><code class="computeroutput"><span class="identifier">f</span></code></span></dt>
|
<dt><span class="term"><code class="computeroutput"><span class="identifier">f</span></code></span></dt>
|
||||||
<dd><p>
|
<dd><p>
|
||||||
an instance object of <code class="computeroutput"><span class="identifier">F</span></code>
|
an instance object of <code class="computeroutput"><span class="identifier">F</span></code>
|
||||||
</p></dd>
|
</p></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<a name="boost_functional_factory.reference.factory.expression_semantics"></a><h4>
|
<a name="boost_functional_factory.reference.factory.expression_semantics"></a><h5>
|
||||||
<a name="id938169"></a>
|
<a name="boost_functional_factory.reference.factory.expression_semantics-heading"></a>
|
||||||
<a href="index.html#boost_functional_factory.reference.factory.expression_semantics">Expression
|
<a class="link" href="index.html#boost_functional_factory.reference.factory.expression_semantics">Expression
|
||||||
Semantics</a>
|
Semantics</a>
|
||||||
</h4>
|
</h5>
|
||||||
<div class="informaltable"><table class="table">
|
<div class="informaltable"><table class="table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col>
|
<col>
|
||||||
@@ -471,83 +476,84 @@
|
|||||||
</colgroup>
|
</colgroup>
|
||||||
<thead><tr>
|
<thead><tr>
|
||||||
<th>
|
<th>
|
||||||
<p>
|
<p>
|
||||||
Expression
|
Expression
|
||||||
</p>
|
</p>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<p>
|
<p>
|
||||||
Semantics
|
Semantics
|
||||||
</p>
|
</p>
|
||||||
</th>
|
</th>
|
||||||
</tr></thead>
|
</tr></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<code class="computeroutput"><span class="identifier">F</span><span class="special">()</span></code>
|
<code class="computeroutput"><span class="identifier">F</span><span class="special">()</span></code>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
creates an object of type <code class="computeroutput"><span class="identifier">F</span></code>.
|
creates an object of type <code class="computeroutput"><span class="identifier">F</span></code>.
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<code class="computeroutput"><span class="identifier">F</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span></code>
|
<code class="computeroutput"><span class="identifier">F</span><span class="special">(</span><span class="identifier">f</span><span class="special">)</span></code>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
creates an object of type <code class="computeroutput"><span class="identifier">F</span></code>.
|
creates an object of type <code class="computeroutput"><span class="identifier">F</span></code>.
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span><span class="special">)</span></code>
|
<code class="computeroutput"><span class="identifier">f</span><span class="special">(</span><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span><span class="special">)</span></code>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
dynamically creates an object of type <code class="computeroutput"><span class="identifier">T</span></code>
|
dynamically creates an object of type <code class="computeroutput"><span class="identifier">T</span></code>
|
||||||
using <code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code> as arguments for the constructor
|
using <code class="computeroutput"><span class="identifier">a0</span></code>...<code class="computeroutput"><span class="identifier">aN</span></code> as arguments for the constructor
|
||||||
invocation.
|
invocation.
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
<code class="computeroutput"><span class="identifier">F</span><span class="special">::</span><span class="identifier">result_type</span></code>
|
<code class="computeroutput"><span class="identifier">F</span><span class="special">::</span><span class="identifier">result_type</span></code>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<p>
|
<p>
|
||||||
is the type <code class="computeroutput"><span class="identifier">P</span></code> with
|
is the type <code class="computeroutput"><span class="identifier">P</span></code> with
|
||||||
top-level cv-qualifiers removed.
|
top-level cv-qualifiers removed.
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table></div>
|
</table></div>
|
||||||
<a name="boost_functional_factory.reference.factory.limits"></a><h4>
|
<a name="boost_functional_factory.reference.factory.limits"></a><h5>
|
||||||
<a name="id938440"></a>
|
<a name="boost_functional_factory.reference.factory.limits-heading"></a>
|
||||||
<a href="index.html#boost_functional_factory.reference.factory.limits">Limits</a>
|
<a class="link" href="index.html#boost_functional_factory.reference.factory.limits">Limits</a>
|
||||||
</h4>
|
</h5>
|
||||||
<p>
|
<p>
|
||||||
The macro BOOST_FUNCTIONAL_FACTORY_MAX_ARITY can be defined to set the maximum
|
The macro BOOST_FUNCTIONAL_FACTORY_MAX_ARITY can be defined to set the maximum
|
||||||
arity. It defaults to 10.
|
arity. It defaults to 10.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" lang="en">
|
<div class="section">
|
||||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||||
<a name="boost_functional_factory.acknowledgements"></a><a href="index.html#boost_functional_factory.acknowledgements" title="Acknowledgements">Acknowledgements</a></h2></div></div></div>
|
<a name="boost_functional_factory.acknowledgements"></a><a class="link" href="index.html#boost_functional_factory.acknowledgements" title="Acknowledgements">Acknowledgements</a>
|
||||||
|
</h2></div></div></div>
|
||||||
<p>
|
<p>
|
||||||
Eric Niebler requested a function to invoke a type's constructor (with the
|
Eric Niebler requested a function to invoke a type's constructor (with the
|
||||||
arguments supplied as a Tuple) as a Fusion feature. These Factory utilities
|
arguments supplied as a Tuple) as a Fusion feature. These Factory utilities
|
||||||
@@ -565,26 +571,27 @@
|
|||||||
and their evolution.
|
and their evolution.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" lang="en">
|
<div class="section">
|
||||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||||
<a name="boost_functional_factory.references"></a><a href="index.html#boost_functional_factory.references" title="References">References</a></h2></div></div></div>
|
<a name="boost_functional_factory.references"></a><a class="link" href="index.html#boost_functional_factory.references" title="References">References</a>
|
||||||
<div class="orderedlist"><ol type="1">
|
</h2></div></div></div>
|
||||||
<li>
|
<div class="orderedlist"><ol class="orderedlist" type="1">
|
||||||
<a href="http://en.wikipedia.org/wiki/Design_Patterns" target="_top">Design Patterns</a>,
|
<li class="listitem">
|
||||||
Gamma et al. - Addison Wesley Publishing, 1995
|
<a href="http://en.wikipedia.org/wiki/Design_Patterns" target="_top">Design Patterns</a>,
|
||||||
</li>
|
Gamma et al. - Addison Wesley Publishing, 1995
|
||||||
<li>
|
</li>
|
||||||
<a href="http://www.sgi.com/tech/stl/" target="_top">Standard Template Library Programmer's
|
<li class="listitem">
|
||||||
Guide</a>, Hewlett-Packard Company, 1994
|
<a href="http://www.sgi.com/tech/stl/" target="_top">Standard Template Library Programmer's
|
||||||
</li>
|
Guide</a>, Hewlett-Packard Company, 1994
|
||||||
<li>
|
</li>
|
||||||
<a href="http://www.boost.org/libs/bind/bind.html" target="_top">Boost.Bind</a>,
|
<li class="listitem">
|
||||||
Peter Dimov, 2001-2005
|
<a href="http://www.boost.org/libs/bind/bind.html" target="_top">Boost.Bind</a>,
|
||||||
</li>
|
Peter Dimov, 2001-2005
|
||||||
<li>
|
</li>
|
||||||
<a href="http://www.boost.org/doc/html/function.html" target="_top">Boost.Function</a>,
|
<li class="listitem">
|
||||||
Douglas Gregor, 2001-2004
|
<a href="http://www.boost.org/doc/html/function.html" target="_top">Boost.Function</a>,
|
||||||
</li>
|
Douglas Gregor, 2001-2004
|
||||||
|
</li>
|
||||||
</ol></div>
|
</ol></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user