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</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="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><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Deprecated</th></tr><tr><td align="left"><a accesskey="p" href="ext_containers.html">Prev</a> </td><th width="60%" align="center">Chapter 23. HP/SGI Extensions</th><td 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"><a id="manual.ext.containers.deprecated_sgi"/>Deprecated</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 C++11, and
8 may be removed in future releases.
9 </p><p>The SGI headers</p><pre class="programlisting">
15 </pre><p>are all here;
16 <code class="filename"><backwards/hash_map></code> and
17 <code class="filename"><backwards/hash_set></code>
18 are deprecated but available as backwards-compatible extensions,
19 as discussed further below.
20 <code class="filename"><ext/rope></code> is the SGI
21 specialization for large strings ("rope," "large strings," get it? Love
23 <code class="filename"><ext/slist></code> (superseded in
24 C++11 by <code class="filename"><forward_list></code>)
25 is a singly-linked list, for when the doubly-linked <code class="code">list<></code>
26 is too much space overhead, and
27 <code class="filename"><ext/rb_tree></code> exposes the
28 red-black tree classes used in the implementation of the standard maps
30 </p><p>Each of the associative containers map, multimap, set, and multiset
31 have a counterpart which uses a
32 <a class="link" href="http://www.sgi.com/tech/stl/HashFunction.html">hashing
33 function</a> to do the arranging, instead of a strict weak ordering
34 function. The classes take as one of their template parameters a
35 function object that will return the hash value; by default, an
37 <a class="link" href="http://www.sgi.com/tech/stl/hash.html">hash</a>.
38 You should specialize this functor for your class, or define your own,
39 before trying to use one of the hashing classes.
40 </p><p>The hashing classes support all the usual associative container
41 functions, as well as some extra constructors specifying the number
43 </p><p>Why would you want to use a hashing class instead of the
44 <span class="quote">“<span class="quote">normal</span>”</span>implementations? Matt Austern writes:
45 </p><div class="blockquote"><blockquote class="blockquote"><p>
46 <span class="emphasis"><em>[W]ith a well chosen hash function, hash tables
47 generally provide much better average-case performance than
48 binary search trees, and much worse worst-case performance. So
49 if your implementation has hash_map, if you don't mind using
50 nonstandard components, and if you aren't scared about the
51 possibility of pathological cases, you'll probably get better
52 performance from hash_map.
54 </p></blockquote></div><p>
55 The deprecated hash tables are superseded by the standard unordered
56 associative containers defined in the ISO C++ 2011 standard in the
57 headers <code class="filename"><unordered_map></code>
58 and <code class="filename"><unordered_set></code>.
59 </p></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="ext_containers.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">Chapter 23. HP/SGI Extensions </td><td align="center"><a accesskey="h" href="../index.html">Home</a></td><td align="right" valign="top"> Chapter 24. Utilities</td></tr></table></div></body></html>