1 |
742 |
jeremybenn |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2 |
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3 |
|
|
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Chapter 24. Utilities</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><meta name="keywords" content=" ISO C++ , library "/><meta name="keywords" content=" ISO C++ , runtime , library "/><link rel="home" href="../index.html" title="The GNU C++ Library"/><link rel="up" href="extensions.html" title="Part III. Extensions"/><link rel="prev" href="bk01pt03ch23s02.html" title="Deprecated"/><link rel="next" href="ext_algorithms.html" title="Chapter 25. Algorithms"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 24. Utilities</th></tr><tr><td align="left"><a accesskey="p" href="bk01pt03ch23s02.html">Prev</a> </td><th width="60%" align="center">Part III.
|
4 |
|
|
Extensions
|
5 |
|
|
|
6 |
|
|
</th><td align="right"> <a accesskey="n" href="ext_algorithms.html">Next</a></td></tr></table><hr/></div><div class="chapter" title="Chapter 24. Utilities"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.util"/>Chapter 24. Utilities</h2></div></div></div><p>
|
7 |
|
|
The <code class="filename"><functional></code> header
|
8 |
|
|
contains many additional functors
|
9 |
|
|
and helper functions, extending section 20.3. They are
|
10 |
|
|
implemented in the file stl_function.h:
|
11 |
|
|
</p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"><p><code class="code">identity_element</code> for addition and multiplication.
|
12 |
|
|
</p></li><li class="listitem"><p>The functor <code class="code">identity</code>, whose <code class="code">operator()</code>
|
13 |
|
|
returns the argument unchanged.
|
14 |
|
|
</p></li><li class="listitem"><p>Composition functors <code class="code">unary_function</code> and
|
15 |
|
|
<code class="code">binary_function</code>, and their helpers <code class="code">compose1</code>
|
16 |
|
|
and <code class="code">compose2</code>.
|
17 |
|
|
</p></li><li class="listitem"><p><code class="code">select1st</code> and <code class="code">select2nd</code>, to strip pairs.
|
18 |
|
|
</p></li><li class="listitem"><p><code class="code">project1st</code> and <code class="code">project2nd</code>. </p></li><li class="listitem"><p>A set of functors/functions which always return the same result. They
|
19 |
|
|
are <code class="code">constant_void_fun</code>, <code class="code">constant_binary_fun</code>,
|
20 |
|
|
<code class="code">constant_unary_fun</code>, <code class="code">constant0</code>,
|
21 |
|
|
<code class="code">constant1</code>, and <code class="code">constant2</code>. </p></li><li class="listitem"><p>The class <code class="code">subtractive_rng</code>. </p></li><li class="listitem"><p>mem_fun adaptor helpers <code class="code">mem_fun1</code> and
|
22 |
|
|
<code class="code">mem_fun1_ref</code> are provided for backwards compatibility. </p></li></ul></div><p>
|
23 |
|
|
20.4.1 can use several different allocators; they are described on the
|
24 |
|
|
main extensions page.
|
25 |
|
|
</p><p>
|
26 |
|
|
20.4.3 is extended with a special version of
|
27 |
|
|
<code class="code">get_temporary_buffer</code> taking a second argument. The
|
28 |
|
|
argument is a pointer, which is ignored, but can be used to specify
|
29 |
|
|
the template type (instead of using explicit function template
|
30 |
|
|
arguments like the standard version does). That is, in addition to
|
31 |
|
|
</p><pre class="programlisting">
|
32 |
|
|
get_temporary_buffer<int>(5);
|
33 |
|
|
</pre><p>
|
34 |
|
|
you can also use
|
35 |
|
|
</p><pre class="programlisting">
|
36 |
|
|
get_temporary_buffer(5, (int*)0);
|
37 |
|
|
</pre><p>
|
38 |
|
|
A class <code class="code">temporary_buffer</code> is given in stl_tempbuf.h.
|
39 |
|
|
</p><p>
|
40 |
|
|
The specialized algorithms of section 20.4.4 are extended with
|
41 |
|
|
<code class="code">uninitialized_copy_n</code>.
|
42 |
|
|
</p></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="bk01pt03ch23s02.html">Prev</a> </td><td align="center"><a accesskey="u" href="extensions.html">Up</a></td><td align="right"> <a accesskey="n" href="ext_algorithms.html">Next</a></td></tr><tr><td align="left" valign="top">Deprecated </td><td align="center"><a accesskey="h" href="../index.html">Home</a></td><td align="right" valign="top"> Chapter 25. Algorithms</td></tr></table></div></body></html>
|