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