blob: 8bffe3ebaaad8988ade1308d5da6a4395dba5185 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<link href="../pool.css" rel="stylesheet" type="text/css">
<title>Object Pool Constructors Generator</title>
</head>
<body>
<img src="../../../../boost.png" width="276" height="86" alt="C++ Boost">
<h1 align="center">Object Pool Constructors Generator</h1>
<h2>Description</h2>
<p>The template class <span class="code">object_pool</span> (see <a href=
"object_pool.html">object_pool.html</a>) contains a number of functions
<span class="code">construct(..)</span>, which both allocate and construct
an object in a single operation.</p>
<p>Since the number and type of arguments to this function is totally
arbitrary, a simple system has been set up to automatically generate
template <span class="code">construct</span> functions. This system is
based on the macro preprocessor <strong>m4</strong>, which is standard on
UNIX systems and also available for Win32 systems.</p>
<p>detail/pool_construct.m4, when run with <strong>m4</strong>, will create
the file detail/pool_construct.inc, which only defines the <span class=
"code">construct</span> functions for the proper number of arguments. The
number of arguments may be passed into the file as an m4 macro,
<span class="code">NumberOfArguments</span>; if not provided, it will
default to <span class="code">3</span>.</p>
<p>For each different number of arguments (<span class="code">1</span> to
<span class="code">NumberOfArguments</span>), a template function is
generated. There are the same number of template parameters as there are
arguments, and each argument's type is a reference to that (possibly
cv-qualified) template argument. Each possible permutation of the
cv-qualifications is also generated.</p>
<p>Because each permutation is generated for each possible number of
arguments, the included file size grows exponentially in terms of the
number of constructor arguments, not linearly. For the sake of rational
compile times, only use as many arguments as you need.</p>
<p>detail/pool_construct.bat and detail/pool_construct.sh are also provided
to call <strong>m4</strong>, defining <span class=
"code">NumberOfArguments</span> to be their command-line parameter. See
these files for more details.</p>
<h2>Dependencies</h2>
<p>Dependent on for.m4 (see <a href="for.html">for.html</a>).</p>
<h2>Future Directions</h2>
<p>This system may be complemented by or replaced by a Python (or some
other language) script.</p>
<h2><a href="../interfaces/object_pool.html">Interface Description</a></h2>
<hr>
<p><a href="http://validator.w3.org/check?uri=referer"><img border="0" src=
"../../../../doc/images/valid-html401.png" alt="Valid HTML 4.01 Transitional"
height="31" width="88"></a></p>
<p>Revised
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->05
December, 2006<!--webbot bot="Timestamp" endspan i-checksum="38516" --></p>
<p><i>Copyright &copy; 2000, 2001 Stephen Cleary (scleary AT jerviswebb DOT
com)</i></p>
<p><i>Distributed under the Boost Software License, Version 1.0. (See
accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
or copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</i></p>
</body>
</html>