OSDN Git Service

2f75d608b5e458466846101c060534471cb777ce
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / doc / html / manual / bk01pt03ch21s03.html
1 <?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>Deprecated HP/SGI</title><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><meta name="keywords" content="&#10;      ISO C++&#10;    , &#10;      library&#10;    "/><link rel="home" href="../spine.html" title="The GNU C++ Library"/><link rel="up" href="ext_containers.html" title="Chapter 21. Containers"/><link rel="prev" href="bk01pt03ch21s02.html" title="HP/SGI"/><link rel="next" href="ext_utilities.html" title="Chapter 22. Utilities"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Deprecated HP/SGI</th></tr><tr><td align="left"><a accesskey="p" href="bk01pt03ch21s02.html">Prev</a> </td><th width="60%" align="center">Chapter 21. Containers</th><td align="right"> <a accesskey="n" href="ext_utilities.html">Next</a></td></tr></table><hr/></div><div class="section" title="Deprecated HP/SGI"><div class="titlepage"><div><div><h2 class="title"><a id="manual.ext.containers.deprecated_sgi"/>Deprecated HP/SGI</h2></div></div></div><p>
4      The SGI hashing classes <code class="classname">hash_set</code> and
5      <code class="classname">hash_set</code> have been deprecated by the
6      unordered_set, unordered_multiset, unordered_map,
7      unordered_multimap containers in TR1 and the upcoming C++0x, and
8      may be removed in future releases.
9    </p><p>The SGI headers</p><pre class="programlisting">
10      &lt;hash_map&gt;
11      &lt;hash_set&gt;
12      &lt;rope&gt;
13      &lt;slist&gt;
14      &lt;rb_tree&gt;
15    </pre><p>are all here;
16       <code class="code">&lt;hash_map&gt;</code> and <code class="code">&lt;hash_set&gt;</code>
17       are deprecated but available as backwards-compatible extensions,
18       as discussed further below.  <code class="code">&lt;rope&gt;</code> is the
19       SGI specialization for large strings ("rope,"
20       "large strings," get it? Love that geeky humor.)
21       <code class="code">&lt;slist&gt;</code> is a singly-linked list, for when the
22       doubly-linked <code class="code">list&lt;&gt;</code> is too much space
23       overhead, and <code class="code">&lt;rb_tree&gt;</code> exposes the red-black
24       tree classes used in the implementation of the standard maps and
25       sets.
26    </p><p>Each of the associative containers map, multimap, set, and multiset
27       have a counterpart which uses a
28       <a class="link" href="http://www.sgi.com/tech/stl/HashFunction.html">hashing
29       function</a> to do the arranging, instead of a strict weak ordering
30       function.  The classes take as one of their template parameters a
31       function object that will return the hash value; by default, an
32       instantiation of
33       <a class="link" href="http://www.sgi.com/tech/stl/hash.html">hash</a>.
34       You should specialize this functor for your class, or define your own,
35       before trying to use one of the hashing classes.
36    </p><p>The hashing classes support all the usual associative container
37       functions, as well as some extra constructors specifying the number
38       of buckets, etc.
39    </p><p>Why would you want to use a hashing class instead of the
40       <span class="quote">“<span class="quote">normal</span>”</span>implementations?  Matt Austern writes:
41    </p><div class="blockquote"><blockquote class="blockquote"><p>
42        <span class="emphasis"><em>[W]ith a well chosen hash function, hash tables
43        generally provide much better average-case performance than
44        binary search trees, and much worse worst-case performance.  So
45        if your implementation has hash_map, if you don't mind using
46        nonstandard components, and if you aren't scared about the
47        possibility of pathological cases, you'll probably get better
48        performance from hash_map.
49      </em></span>
50      </p></blockquote></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="bk01pt03ch21s02.html">Prev</a> </td><td align="center"><a accesskey="u" href="ext_containers.html">Up</a></td><td align="right"> <a accesskey="n" href="ext_utilities.html">Next</a></td></tr><tr><td align="left" valign="top">HP/SGI </td><td align="center"><a accesskey="h" href="../spine.html">Home</a></td><td align="right" valign="top"> Chapter 22. Utilities</td></tr></table></div></body></html>