google_hash 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. data/README +21 -0
  2. data/Rakefile +11 -0
  3. data/VERSION +1 -0
  4. data/ext/extconf.rb +15 -0
  5. data/ext/go.cpp +109 -0
  6. data/ext/sparsehash-1.5.2/AUTHORS +2 -0
  7. data/ext/sparsehash-1.5.2/COPYING +28 -0
  8. data/ext/sparsehash-1.5.2/ChangeLog +167 -0
  9. data/ext/sparsehash-1.5.2/INSTALL +236 -0
  10. data/ext/sparsehash-1.5.2/Makefile.am +157 -0
  11. data/ext/sparsehash-1.5.2/Makefile.in +1019 -0
  12. data/ext/sparsehash-1.5.2/NEWS +0 -0
  13. data/ext/sparsehash-1.5.2/README +149 -0
  14. data/ext/sparsehash-1.5.2/README.windows +25 -0
  15. data/ext/sparsehash-1.5.2/TODO +28 -0
  16. data/ext/sparsehash-1.5.2/aclocal.m4 +868 -0
  17. data/ext/sparsehash-1.5.2/compile +99 -0
  18. data/ext/sparsehash-1.5.2/config.guess +1516 -0
  19. data/ext/sparsehash-1.5.2/config.sub +1626 -0
  20. data/ext/sparsehash-1.5.2/configure +8054 -0
  21. data/ext/sparsehash-1.5.2/configure.ac +74 -0
  22. data/ext/sparsehash-1.5.2/depcomp +530 -0
  23. data/ext/sparsehash-1.5.2/doc/dense_hash_map.html +1591 -0
  24. data/ext/sparsehash-1.5.2/doc/dense_hash_set.html +1445 -0
  25. data/ext/sparsehash-1.5.2/doc/designstyle.css +115 -0
  26. data/ext/sparsehash-1.5.2/doc/implementation.html +365 -0
  27. data/ext/sparsehash-1.5.2/doc/index.html +69 -0
  28. data/ext/sparsehash-1.5.2/doc/performance.html +96 -0
  29. data/ext/sparsehash-1.5.2/doc/sparse_hash_map.html +1527 -0
  30. data/ext/sparsehash-1.5.2/doc/sparse_hash_set.html +1376 -0
  31. data/ext/sparsehash-1.5.2/doc/sparsetable.html +1393 -0
  32. data/ext/sparsehash-1.5.2/experimental/Makefile +9 -0
  33. data/ext/sparsehash-1.5.2/experimental/README +14 -0
  34. data/ext/sparsehash-1.5.2/experimental/example.c +54 -0
  35. data/ext/sparsehash-1.5.2/experimental/libchash.c +1537 -0
  36. data/ext/sparsehash-1.5.2/experimental/libchash.h +252 -0
  37. data/ext/sparsehash-1.5.2/google-sparsehash.sln +47 -0
  38. data/ext/sparsehash-1.5.2/install-sh +323 -0
  39. data/ext/sparsehash-1.5.2/m4/acx_pthread.m4 +363 -0
  40. data/ext/sparsehash-1.5.2/m4/google_namespace.m4 +42 -0
  41. data/ext/sparsehash-1.5.2/m4/namespaces.m4 +15 -0
  42. data/ext/sparsehash-1.5.2/m4/stl_hash.m4 +70 -0
  43. data/ext/sparsehash-1.5.2/m4/stl_hash_fun.m4 +36 -0
  44. data/ext/sparsehash-1.5.2/m4/stl_namespace.m4 +25 -0
  45. data/ext/sparsehash-1.5.2/missing +360 -0
  46. data/ext/sparsehash-1.5.2/mkinstalldirs +158 -0
  47. data/ext/sparsehash-1.5.2/packages/deb.sh +74 -0
  48. data/ext/sparsehash-1.5.2/packages/deb/README +7 -0
  49. data/ext/sparsehash-1.5.2/packages/deb/changelog +107 -0
  50. data/ext/sparsehash-1.5.2/packages/deb/compat +1 -0
  51. data/ext/sparsehash-1.5.2/packages/deb/control +17 -0
  52. data/ext/sparsehash-1.5.2/packages/deb/copyright +35 -0
  53. data/ext/sparsehash-1.5.2/packages/deb/docs +16 -0
  54. data/ext/sparsehash-1.5.2/packages/deb/rules +117 -0
  55. data/ext/sparsehash-1.5.2/packages/deb/sparsehash.dirs +2 -0
  56. data/ext/sparsehash-1.5.2/packages/deb/sparsehash.install +2 -0
  57. data/ext/sparsehash-1.5.2/packages/rpm.sh +86 -0
  58. data/ext/sparsehash-1.5.2/packages/rpm/rpm.spec +61 -0
  59. data/ext/sparsehash-1.5.2/src/config.h.in +131 -0
  60. data/ext/sparsehash-1.5.2/src/config.h.include +23 -0
  61. data/ext/sparsehash-1.5.2/src/google/dense_hash_map +310 -0
  62. data/ext/sparsehash-1.5.2/src/google/dense_hash_set +287 -0
  63. data/ext/sparsehash-1.5.2/src/google/sparse_hash_map +294 -0
  64. data/ext/sparsehash-1.5.2/src/google/sparse_hash_set +275 -0
  65. data/ext/sparsehash-1.5.2/src/google/sparsehash/densehashtable.h +1062 -0
  66. data/ext/sparsehash-1.5.2/src/google/sparsehash/sparsehashtable.h +1015 -0
  67. data/ext/sparsehash-1.5.2/src/google/sparsetable +1468 -0
  68. data/ext/sparsehash-1.5.2/src/google/type_traits.h +250 -0
  69. data/ext/sparsehash-1.5.2/src/hashtable_unittest.cc +1375 -0
  70. data/ext/sparsehash-1.5.2/src/simple_test.cc +103 -0
  71. data/ext/sparsehash-1.5.2/src/sparsetable_unittest.cc +696 -0
  72. data/ext/sparsehash-1.5.2/src/time_hash_map.cc +488 -0
  73. data/ext/sparsehash-1.5.2/src/type_traits_unittest.cc +492 -0
  74. data/ext/sparsehash-1.5.2/src/windows/config.h +149 -0
  75. data/ext/sparsehash-1.5.2/src/windows/google/sparsehash/sparseconfig.h +32 -0
  76. data/ext/sparsehash-1.5.2/src/windows/port.cc +63 -0
  77. data/ext/sparsehash-1.5.2/src/windows/port.h +81 -0
  78. data/ext/sparsehash-1.5.2/src/words +8944 -0
  79. data/ext/sparsehash-1.5.2/vsprojects/hashtable_unittest/hashtable_unittest.vcproj +187 -0
  80. data/ext/sparsehash-1.5.2/vsprojects/sparsetable_unittest/sparsetable_unittest.vcproj +172 -0
  81. data/ext/sparsehash-1.5.2/vsprojects/time_hash_map/time_hash_map.vcproj +187 -0
  82. data/ext/sparsehash-1.5.2/vsprojects/type_traits_unittest/type_traits_unittest.vcproj +169 -0
  83. data/ext/test.rb +10 -0
  84. data/test/spec.go +70 -0
  85. metadata +147 -0
@@ -0,0 +1,1591 @@
1
+ <HTML>
2
+ <!-- The API of this class and the documentation -- but not the
3
+ implementation! -- are based on that for SGI's hash_map class,
4
+ augmented with tr1 support.
5
+ -->
6
+ <!--
7
+ -- Copyright (c) 1996-1999
8
+ -- Silicon Graphics Computer Systems, Inc.
9
+ --
10
+ -- Permission to use, copy, modify, distribute and sell this software
11
+ -- and its documentation for any purpose is hereby granted without fee,
12
+ -- provided that the above copyright notice appears in all copies and
13
+ -- that both that copyright notice and this permission notice appear
14
+ -- in supporting documentation. Silicon Graphics makes no
15
+ -- representations about the suitability of this software for any
16
+ -- purpose. It is provided "as is" without express or implied warranty.
17
+ --
18
+ -- Copyright (c) 1994
19
+ -- Hewlett-Packard Company
20
+ --
21
+ -- Permission to use, copy, modify, distribute and sell this software
22
+ -- and its documentation for any purpose is hereby granted without fee,
23
+ -- provided that the above copyright notice appears in all copies and
24
+ -- that both that copyright notice and this permission notice appear
25
+ -- in supporting documentation. Hewlett-Packard Company makes no
26
+ -- representations about the suitability of this software for any
27
+ -- purpose. It is provided "as is" without express or implied warranty.
28
+ --
29
+ -->
30
+
31
+ <HEAD>
32
+ <Title>dense_hash_map&lt;Key, Data, HashFcn, EqualKey, Alloc&gt;</Title>
33
+ </HEAD>
34
+
35
+ <BODY>
36
+
37
+ <p><i>[Note: this document is formatted similarly to the SGI STL
38
+ implementation documentation pages, and refers to concepts and classes
39
+ defined there. However, neither this document nor the code it
40
+ describes is associated with SGI, nor is it necessary to have SGI's
41
+ STL implementation installed in order to use this class.]</i></p>
42
+
43
+
44
+ <H1>dense_hash_map&lt;Key, Data, HashFcn, EqualKey, Alloc&gt;</H1>
45
+
46
+ <p><tt>dense_hash_map</tt> is a <A
47
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
48
+ Associative Container</A> that associates objects of type <tt>Key</tt>
49
+ with objects of type <tt>Data</tt>. <tt>dense_hash_map</tt> is a <A
50
+ href="http://www.sgi.com/tech/stl/PairAssociativeContainer.html">Pair
51
+ Associative Container</A>, meaning that its value type is <tt><A
52
+ href="pair.html">pair</A>&lt;const Key, Data&gt;</tt>. It is also a
53
+ <A
54
+ href="http://www.sgi.com/tech/stl/UniqueAssociativeContainer.html">Unique
55
+ Associative Container</A>, meaning that no two elements have keys that
56
+ compare equal using <tt>EqualKey</tt>.</p>
57
+
58
+ <p>Looking up an element in a <tt>dense_hash_map</tt> by its key is
59
+ efficient, so <tt>dense_hash_map</tt> is useful for &quot;dictionaries&quot;
60
+ where the order of elements is irrelevant. If it is important for the
61
+ elements to be in a particular order, however, then <tt><A
62
+ href="http://www.sgi.com/tech/stl/Map.html">map</A></tt> is more appropriate.</p>
63
+
64
+ <p><tt>dense_hash_map</tt> is distinguished from other hash-map
65
+ implementations by its speed and by the ability to save
66
+ and restore contents to disk. On the other hand, this hash-map
67
+ implementation can use significantly more space than other hash-map
68
+ implementations, and it also has requirements -- for instance, for a
69
+ distinguished "empty key" -- that may not be easy for all
70
+ applications to satisfy.</p>
71
+
72
+ <p>This class is appropriate for applications that need speedy access
73
+ to relatively small "dictionaries" stored in memory, or for
74
+ applications that need these dictionaries to be persistent. <A
75
+ HREF="#io">[implementation note]</A>)</p>
76
+
77
+
78
+ <h3>Example</h3>
79
+
80
+ (Note: this example uses SGI semantics for <code>hash&lt;&gt;</code>
81
+ -- the kind used by gcc and most Unix compiler suites -- and not
82
+ Dinkumware semantics -- the kind used by Microsoft Visual Studio. If
83
+ you are using MSVC, this example will not compile as-is: you'll need
84
+ to change <code>hash</code> to <code>hash_compare</code>, and you
85
+ won't use <code>eqstr</code> at all. See the MSVC documentation for
86
+ <code>hash_map</code> and <code>hash_compare</code>, for more
87
+ details.)
88
+
89
+ <pre>
90
+ #include &lt;iostream&gt;
91
+ #include &lt;google/dense_hash_map&gt;
92
+
93
+ using google::dense_hash_map; // namespace where class lives by default
94
+ using std::cout;
95
+ using std::endl;
96
+ using ext::hash; // or __gnu_cxx::hash, or maybe tr1::hash, depending on your OS
97
+
98
+ struct eqstr
99
+ {
100
+ bool operator()(const char* s1, const char* s2) const
101
+ {
102
+ return (s1 == s2) || (s1 && s2 && strcmp(s1, s2) == 0);
103
+ }
104
+ };
105
+
106
+ int main()
107
+ {
108
+ dense_hash_map&lt;const char*, int, hash&lt;const char*&gt;, eqstr&gt; months;
109
+
110
+ months.set_empty_key(NULL);
111
+ months[&quot;january&quot;] = 31;
112
+ months[&quot;february&quot;] = 28;
113
+ months[&quot;march&quot;] = 31;
114
+ months[&quot;april&quot;] = 30;
115
+ months[&quot;may&quot;] = 31;
116
+ months[&quot;june&quot;] = 30;
117
+ months[&quot;july&quot;] = 31;
118
+ months[&quot;august&quot;] = 31;
119
+ months[&quot;september&quot;] = 30;
120
+ months[&quot;october&quot;] = 31;
121
+ months[&quot;november&quot;] = 30;
122
+ months[&quot;december&quot;] = 31;
123
+
124
+ cout &lt;&lt; &quot;september -&gt; &quot; &lt;&lt; months[&quot;september&quot;] &lt;&lt; endl;
125
+ cout &lt;&lt; &quot;april -&gt; &quot; &lt;&lt; months[&quot;april&quot;] &lt;&lt; endl;
126
+ cout &lt;&lt; &quot;june -&gt; &quot; &lt;&lt; months[&quot;june&quot;] &lt;&lt; endl;
127
+ cout &lt;&lt; &quot;november -&gt; &quot; &lt;&lt; months[&quot;november&quot;] &lt;&lt; endl;
128
+ }
129
+ </pre>
130
+
131
+
132
+ <h3>Definition</h3>
133
+
134
+ Defined in the header <A href="dense_hash_map">dense_hash_map</A>.
135
+ This class is not part of the C++ standard, though it is mostly
136
+ compatible with the tr1 class <code>unordered_map</code>.
137
+
138
+
139
+ <h3>Template parameters</h3>
140
+
141
+ <table border>
142
+ <TR><TH>Parameter</TH><TH>Description</TH><TH>Default</TH></TR>
143
+
144
+ <TR>
145
+ <TD VAlign=top>
146
+ <tt>Key</tt>
147
+ </TD>
148
+ <TD VAlign=top>
149
+ The hash_map's key type. This is also defined as
150
+ <tt>dense_hash_map::key_type</tt>.
151
+ </TD>
152
+ <TD VAlign=top>
153
+ &nbsp;
154
+ </TD>
155
+ </TR>
156
+
157
+ <TR>
158
+ <TD VAlign=top>
159
+ <tt>Data</tt>
160
+ </TD>
161
+ <TD VAlign=top>
162
+ The hash_map's data type. This is also defined as
163
+ <tt>dense_hash_map::data_type</tt>. <A href="#1">[7]</A>
164
+ </TD>
165
+ <TD VAlign=top>
166
+ &nbsp;
167
+ </TD>
168
+ </TR>
169
+
170
+ <TR>
171
+ <TD VAlign=top>
172
+ <tt>HashFcn</tt>
173
+ </TD>
174
+ <TD VAlign=top>
175
+ The <A href="http://www.sgi.com/tech/stl/HashFunction.html">hash function</A> used by the
176
+ hash_map. This is also defined as <tt>dense_hash_map::hasher</tt>.
177
+ <br><b>Note:</b> Hashtable performance depends heavliy on the choice of
178
+ hash function. See <A HREF="performance.html#hashfn">the performance
179
+ page</A> for more information.
180
+ </TD>
181
+ <TD VAlign=top>
182
+ <tt><A href="http://www.sgi.com/tech/stl/hash.html">hash</A>&lt;Key&gt;</tt>
183
+ </TD>
184
+ </TR>
185
+
186
+ <TR>
187
+ <TD VAlign=top>
188
+ <tt>EqualKey</tt>
189
+ </TD>
190
+ <TD VAlign=top>
191
+ The hash_map key equality function: a <A
192
+ href="http://www.sgi.com/tech/stl/BinaryPredicate.html">binary predicate</A> that determines
193
+ whether two keys are equal. This is also defined as
194
+ <tt>dense_hash_map::key_equal</tt>.
195
+ </TD>
196
+ <TD VAlign=top>
197
+ <tt><A href="http://www.sgi.com/tech/stl/equal_to.html">equal_to</A>&lt;Key&gt;</tt>
198
+ </TD>
199
+ </TR>
200
+
201
+ <TR>
202
+ <TD VAlign=top>
203
+ <tt>Alloc</tt>
204
+ </TD>
205
+ <TD VAlign=top>
206
+ <b>Ignored</b>; this is included only for API-compatibility
207
+ with SGI's (and tr1's) STL implementation.
208
+ </TD>
209
+ <TD VAlign=top>
210
+ </TD>
211
+ </TR>
212
+
213
+ </table>
214
+
215
+
216
+ <h3>Model of</h3>
217
+
218
+ <A href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique Hashed Associative Container</A>,
219
+ <A href="http://www.sgi.com/tech/stl/PairAssociativeContainer.html">Pair Associative Container</A>
220
+
221
+
222
+ <h3>Type requirements</h3>
223
+
224
+ <UL>
225
+ <LI>
226
+ <tt>Key</tt> is Assignable.
227
+ <LI>
228
+ <tt>EqualKey</tt> is a Binary Predicate whose argument type is Key.
229
+ <LI>
230
+ <tt>EqualKey</tt> is an equivalence relation.
231
+ <LI>
232
+ <tt>Alloc</tt> is an Allocator.
233
+ </UL>
234
+
235
+
236
+ <h3>Public base classes</h3>
237
+
238
+ None.
239
+
240
+
241
+ <h3>Members</h3>
242
+
243
+ <table border>
244
+ <TR><TH>Member</TH><TH>Where defined</TH><TH>Description</TH></TR>
245
+
246
+ <TR>
247
+ <TD VAlign=top>
248
+ <tt>key_type</tt>
249
+ </TD>
250
+ <TD VAlign=top>
251
+ <A
252
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
253
+ Container</A>
254
+ </TD>
255
+ <TD VAlign=top>
256
+ The <tt>dense_hash_map</tt>'s key type, <tt>Key</tt>.
257
+ </TD>
258
+ </TR>
259
+
260
+ <TR>
261
+ <TD VAlign=top>
262
+ <tt>data_type</tt>
263
+ </TD>
264
+ <TD VAlign=top>
265
+ <A
266
+ href="http://www.sgi.com/tech/stl/PairAssociativeContainer.html">Pair
267
+ Associative Container</A>
268
+ </TD>
269
+ <TD VAlign=top>
270
+ The type of object associated with the keys.
271
+ </TD>
272
+ </TR>
273
+
274
+ <TR>
275
+ <TD VAlign=top>
276
+ <tt>value_type</tt>
277
+ </TD>
278
+ <TD VAlign=top>
279
+ <A
280
+ href="http://www.sgi.com/tech/stl/PairAssociativeContainer.html">Pair
281
+ Associative Container</A>
282
+ </TD>
283
+ <TD VAlign=top>
284
+ The type of object, <tt>pair&lt;const key_type, data_type&gt;</tt>,
285
+ stored in the hash_map.
286
+ </TD>
287
+ </TR>
288
+
289
+ <TR>
290
+ <TD VAlign=top>
291
+ <tt>hasher</tt>
292
+ </TD>
293
+ <TD VAlign=top>
294
+ <A
295
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
296
+ Associative Container</A>
297
+ </TD>
298
+ <TD VAlign=top>
299
+ The <tt>dense_hash_map</tt>'s <A
300
+ href="http://www.sgi.com/tech/stl/HashFunction.html">hash
301
+ function</A>.
302
+ </TD>
303
+ </TR>
304
+
305
+ <TR>
306
+ <TD VAlign=top>
307
+ <tt>key_equal</tt>
308
+ </TD>
309
+ <TD VAlign=top>
310
+ <A
311
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
312
+ Associative Container</A>
313
+ </TD>
314
+ <TD VAlign=top>
315
+ <A href="http://www.sgi.com/tech/stl/functors.html">Function
316
+ object</A> that compares keys for equality.
317
+ </TD>
318
+ </TR>
319
+
320
+ <TR>
321
+ <TD VAlign=top>
322
+ <tt>allocator_type</tt>
323
+ </TD>
324
+ <TD VAlign=top>
325
+ <tt>Unordered Associative Container</tt> (tr1)
326
+ </TD>
327
+ <TD VAlign=top>
328
+ The type of the Allocator given as a template parameter.
329
+ </TD>
330
+ </TR>
331
+
332
+ <TR>
333
+ <TD VAlign=top>
334
+ <tt>pointer</tt>
335
+ </TD>
336
+ <TD VAlign=top>
337
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
338
+ </TD>
339
+ <TD VAlign=top>
340
+ Pointer to <tt>T</tt>.
341
+ </TD>
342
+ </TR>
343
+
344
+ <TR>
345
+ <TD VAlign=top>
346
+ <tt>reference</tt>
347
+ </TD>
348
+ <TD VAlign=top>
349
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
350
+ </TD>
351
+ <TD VAlign=top>
352
+ Reference to <tt>T</tt>
353
+ </TD>
354
+ </TR>
355
+
356
+ <TR>
357
+ <TD VAlign=top>
358
+ <tt>const_reference</tt>
359
+ </TD>
360
+ <TD VAlign=top>
361
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
362
+ </TD>
363
+ <TD VAlign=top>
364
+ Const reference to <tt>T</tt>
365
+ </TD>
366
+ </TR>
367
+
368
+ <TR>
369
+ <TD VAlign=top>
370
+ <tt>size_type</tt>
371
+ </TD>
372
+ <TD VAlign=top>
373
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
374
+ </TD>
375
+ <TD VAlign=top>
376
+ An unsigned integral type.
377
+ </TD>
378
+ </TR>
379
+
380
+ <TR>
381
+ <TD VAlign=top>
382
+ <tt>difference_type</tt>
383
+ </TD>
384
+ <TD VAlign=top>
385
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
386
+ </TD>
387
+ <TD VAlign=top>
388
+ A signed integral type.
389
+ </TD>
390
+ </TR>
391
+
392
+ <TR>
393
+ <TD VAlign=top>
394
+ <tt>iterator</tt>
395
+ </TD>
396
+ <TD VAlign=top>
397
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
398
+ </TD>
399
+ <TD VAlign=top>
400
+ Iterator used to iterate through a <tt>dense_hash_map</tt>. <A
401
+ href="#1">[1]</A>
402
+ </TD>
403
+ </TR>
404
+
405
+ <TR>
406
+ <TD VAlign=top>
407
+ <tt>const_iterator</tt>
408
+ </TD>
409
+ <TD VAlign=top>
410
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
411
+ </TD>
412
+ <TD VAlign=top>
413
+ Const iterator used to iterate through a <tt>dense_hash_map</tt>.
414
+ </TD>
415
+ </TR>
416
+
417
+ <TR>
418
+ <TD VAlign=top>
419
+ <tt>local_iterator</tt>
420
+ </TD>
421
+ <TD VAlign=top>
422
+ <tt>Unordered Associative Container</tt> (tr1)
423
+ </TD>
424
+ <TD VAlign=top>
425
+ Iterator used to iterate through a subset of
426
+ <tt>dense_hash_map</tt>. <A href="#1">[1]</A>
427
+ </TD>
428
+ </TR>
429
+
430
+ <TR>
431
+ <TD VAlign=top>
432
+ <tt>const_local_iterator</tt>
433
+ </TD>
434
+ <TD VAlign=top>
435
+ <tt>Unordered Associative Container</tt> (tr1)
436
+ </TD>
437
+ <TD VAlign=top>
438
+ Const iterator used to iterate through a subset of
439
+ <tt>dense_hash_map</tt>.
440
+ </TD>
441
+ </TR>
442
+
443
+ <TR>
444
+ <TD VAlign=top>
445
+ <tt>iterator begin()</tt>
446
+ </TD>
447
+ <TD VAlign=top>
448
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
449
+ </TD>
450
+ <TD VAlign=top>
451
+ Returns an <tt>iterator</tt> pointing to the beginning of the
452
+ <tt>dense_hash_map</tt>.
453
+ </TD>
454
+ </TR>
455
+
456
+ <TR>
457
+ <TD VAlign=top>
458
+ <tt>iterator end()</tt>
459
+ </TD>
460
+ <TD VAlign=top>
461
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
462
+ </TD>
463
+ <TD VAlign=top>
464
+ Returns an <tt>iterator</tt> pointing to the end of the
465
+ <tt>dense_hash_map</tt>.
466
+ </TD>
467
+ </TR>
468
+
469
+ <TR>
470
+ <TD VAlign=top>
471
+ <tt>const_iterator begin() const</tt>
472
+ </TD>
473
+ <TD VAlign=top>
474
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
475
+ </TD>
476
+ <TD VAlign=top>
477
+ Returns an <tt>const_iterator</tt> pointing to the beginning of the
478
+ <tt>dense_hash_map</tt>.
479
+ </TD>
480
+ </TR>
481
+
482
+ <TR>
483
+ <TD VAlign=top>
484
+ <tt>const_iterator end() const</tt>
485
+ </TD>
486
+ <TD VAlign=top>
487
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
488
+ </TD>
489
+ <TD VAlign=top>
490
+ Returns an <tt>const_iterator</tt> pointing to the end of the
491
+ <tt>dense_hash_map</tt>.
492
+ </TD>
493
+ </TR>
494
+
495
+ <TR>
496
+ <TD VAlign=top>
497
+ <tt>local_iterator begin(size_type i)</tt>
498
+ </TD>
499
+ <TD VAlign=top>
500
+ <tt>Unordered Associative Container</tt> (tr1)
501
+ </TD>
502
+ <TD VAlign=top>
503
+ Returns a <tt>local_iterator</tt> pointing to the beginning of bucket
504
+ <tt>i</tt> in the <tt>dense_hash_map</tt>.
505
+ </TD>
506
+ </TR>
507
+
508
+ <TR>
509
+ <TD VAlign=top>
510
+ <tt>local_iterator end(size_type i)</tt>
511
+ </TD>
512
+ <TD VAlign=top>
513
+ <tt>Unordered Associative Container</tt> (tr1)
514
+ </TD>
515
+ <TD VAlign=top>
516
+ Returns a <tt>local_iterator</tt> pointing to the end of bucket
517
+ <tt>i</tt> in the <tt>dense_hash_map</tt>. For
518
+ <tt>dense_hash_map</tt>, each bucket contains either 0 or 1 item.
519
+ </TD>
520
+ </TR>
521
+
522
+ <TR>
523
+ <TD VAlign=top>
524
+ <tt>const_local_iterator begin(size_type i) const</tt>
525
+ </TD>
526
+ <TD VAlign=top>
527
+ <tt>Unordered Associative Container</tt> (tr1)
528
+ </TD>
529
+ <TD VAlign=top>
530
+ Returns a <tt>const_local_iterator</tt> pointing to the beginning of bucket
531
+ <tt>i</tt> in the <tt>dense_hash_map</tt>.
532
+ </TD>
533
+ </TR>
534
+
535
+ <TR>
536
+ <TD VAlign=top>
537
+ <tt>const_local_iterator end(size_type i) const</tt>
538
+ </TD>
539
+ <TD VAlign=top>
540
+ <tt>Unordered Associative Container</tt> (tr1)
541
+ </TD>
542
+ <TD VAlign=top>
543
+ Returns a <tt>const_local_iterator</tt> pointing to the end of bucket
544
+ <tt>i</tt> in the <tt>dense_hash_map</tt>. For
545
+ <tt>dense_hash_map</tt>, each bucket contains either 0 or 1 item.
546
+ </TD>
547
+ </TR>
548
+
549
+ <TR>
550
+ <TD VAlign=top>
551
+ <tt>size_type size() const</tt>
552
+ </TD>
553
+ <TD VAlign=top>
554
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
555
+ </TD>
556
+ <TD VAlign=top>
557
+ Returns the size of the <tt>dense_hash_map</tt>.
558
+ </TD>
559
+ </TR>
560
+
561
+ <TR>
562
+ <TD VAlign=top>
563
+ <tt>size_type max_size() const</tt>
564
+ </TD>
565
+ <TD VAlign=top>
566
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
567
+ </TD>
568
+ <TD VAlign=top>
569
+ Returns the largest possible size of the <tt>dense_hash_map</tt>.
570
+ </TD>
571
+ </TR>
572
+
573
+ <TR>
574
+ <TD VAlign=top>
575
+ <tt>bool empty() const</tt>
576
+ </TD>
577
+ <TD VAlign=top>
578
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
579
+ </TD>
580
+ <TD VAlign=top>
581
+ <tt>true</tt> if the <tt>dense_hash_map</tt>'s size is <tt>0</tt>.
582
+ </TD>
583
+ </TR>
584
+
585
+ <TR>
586
+ <TD VAlign=top>
587
+ <tt>size_type bucket_count() const</tt>
588
+ </TD>
589
+ <TD VAlign=top>
590
+ <A
591
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
592
+ Associative Container</A>
593
+ </TD>
594
+ <TD VAlign=top>
595
+ Returns the number of buckets used by the <tt>dense_hash_map</tt>.
596
+ </TD>
597
+ </TR>
598
+
599
+ <TR>
600
+ <TD VAlign=top>
601
+ <tt>size_type max_bucket_count() const</tt>
602
+ </TD>
603
+ <TD VAlign=top>
604
+ <A
605
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
606
+ Associative Container</A>
607
+ </TD>
608
+ <TD VAlign=top>
609
+ Returns the largest possible number of buckets used by the <tt>dense_hash_map</tt>.
610
+ </TD>
611
+ </TR>
612
+
613
+ <TR>
614
+ <TD VAlign=top>
615
+ <tt>size_type bucket_size(size_type i) const</tt>
616
+ </TD>
617
+ <TD VAlign=top>
618
+ <tt>Unordered Associative Container</tt> (tr1)
619
+ </TD>
620
+ <TD VAlign=top>
621
+ Returns the number of elements in bucket <tt>i</tt>. For
622
+ <tt>dense_hash_map</tt>, this will be either 0 or 1.
623
+ </TD>
624
+ </TR>
625
+
626
+ <TR>
627
+ <TD VAlign=top>
628
+ <tt>size_type bucket(const key_type& key) const</tt>
629
+ </TD>
630
+ <TD VAlign=top>
631
+ <tt>Unordered Associative Container</tt> (tr1)
632
+ </TD>
633
+ <TD VAlign=top>
634
+ If the key exists in the map, returns the index of the bucket
635
+ containing the given key, otherwise, return the bucket the key
636
+ would be inserted into.
637
+ This value may be passed to <tt>begin(size_type)</tt> and
638
+ <tt>end(size_type)</tt>.
639
+ </TD>
640
+ </TR>
641
+
642
+ <TR>
643
+ <TD VAlign=top>
644
+ <tt>float load_factor() const</tt>
645
+ </TD>
646
+ <TD VAlign=top>
647
+ <tt>Unordered Associative Container</tt> (tr1)
648
+ </TD>
649
+ <TD VAlign=top>
650
+ The number of elements in the <tt>dense_hash_map</tt> divided by
651
+ the number of buckets.
652
+ </TD>
653
+ </TR>
654
+
655
+ <TR>
656
+ <TD VAlign=top>
657
+ <tt>float max_load_factor() const</tt>
658
+ </TD>
659
+ <TD VAlign=top>
660
+ <tt>Unordered Associative Container</tt> (tr1)
661
+ </TD>
662
+ <TD VAlign=top>
663
+ The maximum load factor before increasing the number of buckets in
664
+ the <tt>dense_hash_map</tt>.
665
+ </TD>
666
+ </TR>
667
+
668
+ <TR>
669
+ <TD VAlign=top>
670
+ <tt>float max_load_factor(size_t new_grow)</tt>
671
+ </TD>
672
+ <TD VAlign=top>
673
+ <tt>Unordered Associative Container</tt> (tr1)
674
+ </TD>
675
+ <TD VAlign=top>
676
+ Sets the maximum load factor before increasing the number of
677
+ buckets in the <tt>dense_hash_map</tt>.
678
+ </TD>
679
+ </TR>
680
+
681
+ <TR>
682
+ <TD VAlign=top>
683
+ <tt>float min_load_factor() const</tt>
684
+ </TD>
685
+ <TD VAlign=top>
686
+ <tt>dense_hash_map</tt>
687
+ </TD>
688
+ <TD VAlign=top>
689
+ The minimum load factor before decreasing the number of buckets in
690
+ the <tt>dense_hash_map</tt>.
691
+ </TD>
692
+ </TR>
693
+
694
+ <TR>
695
+ <TD VAlign=top>
696
+ <tt>float min_load_factor(size_t new_grow)</tt>
697
+ </TD>
698
+ <TD VAlign=top>
699
+ <tt>dense_hash_map</tt>
700
+ </TD>
701
+ <TD VAlign=top>
702
+ Sets the minimum load factor before decreasing the number of
703
+ buckets in the <tt>dense_hash_map</tt>.
704
+ </TD>
705
+ </TR>
706
+
707
+ <TR>
708
+ <TD VAlign=top>
709
+ <tt>void set_resizing_parameters(float shrink, float grow)</tt>
710
+ </TD>
711
+ <TD VAlign=top>
712
+ <tt>dense_hash_map</tt>
713
+ </TD>
714
+ <TD VAlign=top>
715
+ DEPRECATED. <A HREF="#new">See below</A>.
716
+ </TD>
717
+ </TR>
718
+
719
+ <TR>
720
+ <TD VAlign=top>
721
+ <tt>void resize(size_type n)</tt>
722
+ </TD>
723
+ <TD VAlign=top>
724
+ <A
725
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
726
+ Associative Container</A>
727
+ </TD>
728
+ <TD VAlign=top>
729
+ Increases the bucket count to hold at least <tt>n</tt> items.
730
+ <A href="#4">[4]</A> <A href="#5">[5]</A>
731
+ </TD>
732
+ </TR>
733
+
734
+ <TR>
735
+ <TD VAlign=top>
736
+ <tt>void rehash(size_type n)</tt>
737
+ </TD>
738
+ <TD VAlign=top>
739
+ <tt>Unordered Associative Container</tt> (tr1)
740
+ </TD>
741
+ <TD VAlign=top>
742
+ Increases the bucket count to hold at least <tt>n</tt> items.
743
+ This is identical to <tt>resize</tt>.
744
+ <A href="#4">[4]</A> <A href="#5">[5]</A>
745
+ </TD>
746
+ </TR>
747
+
748
+ <TR>
749
+ <TD VAlign=top>
750
+ <tt>hasher hash_funct() const</tt>
751
+ </TD>
752
+ <TD VAlign=top>
753
+ <A
754
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
755
+ Associative Container</A>
756
+ </TD>
757
+ <TD VAlign=top>
758
+ Returns the <tt>hasher</tt> object used by the <tt>dense_hash_map</tt>.
759
+ </TD>
760
+ </TR>
761
+
762
+ <TR>
763
+ <TD VAlign=top>
764
+ <tt>hasher hash_function() const</tt>
765
+ </TD>
766
+ <TD VAlign=top>
767
+ <tt>Unordered Associative Container</tt> (tr1)
768
+ </TD>
769
+ <TD VAlign=top>
770
+ Returns the <tt>hasher</tt> object used by the <tt>dense_hash_map</tt>.
771
+ This is idential to <tt>hash_funct</tt>.
772
+ </TD>
773
+ </TR>
774
+
775
+ <TR>
776
+ <TD VAlign=top>
777
+ <tt>key_equal key_eq() const</tt>
778
+ </TD>
779
+ <TD VAlign=top>
780
+ <A
781
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
782
+ Associative Container</A>
783
+ </TD>
784
+ <TD VAlign=top>
785
+ Returns the <tt>key_equal</tt> object used by the
786
+ <tt>dense_hash_map</tt>.
787
+ </TD>
788
+ </TR>
789
+
790
+ <TR>
791
+ <TD VAlign=top>
792
+ <tt>dense_hash_map()</tt>
793
+ </TD>
794
+ <TD VAlign=top>
795
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
796
+ </TD>
797
+ <TD VAlign=top>
798
+ Creates an empty <tt>dense_hash_map</tt>.
799
+ </TD>
800
+ </TR>
801
+
802
+ <TR>
803
+ <TD VAlign=top>
804
+ <tt>dense_hash_map(size_type n)</tt>
805
+ </TD>
806
+ <TD VAlign=top>
807
+ <A
808
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
809
+ Associative Container</A>
810
+ </TD>
811
+ <TD VAlign=top>
812
+ Creates an empty <tt>dense_hash_map</tt> that's optimized for holding
813
+ up to <tt>n</tt> items.
814
+ <A href="#5">[5]</A>
815
+ </TD>
816
+ </TR>
817
+
818
+ <TR>
819
+ <TD VAlign=top>
820
+ <tt>dense_hash_map(size_type n, const hasher&amp; h)</tt>
821
+ </TD>
822
+ <TD VAlign=top>
823
+ <A
824
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
825
+ Associative Container</A>
826
+ </TD>
827
+ <TD VAlign=top>
828
+ Creates an empty <tt>dense_hash_map</tt> that's optimized for up
829
+ to <tt>n</tt> items, using <tt>h</tt> as the hash function.
830
+ </TD>
831
+ </TR>
832
+
833
+ <TR>
834
+ <TD VAlign=top>
835
+ <tt>dense_hash_map(size_type n, const hasher&amp; h, const
836
+ key_equal&amp; k)</tt>
837
+ </TD>
838
+ <TD VAlign=top>
839
+ <A
840
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
841
+ Associative Container</A>
842
+ </TD>
843
+ <TD VAlign=top>
844
+ Creates an empty <tt>dense_hash_map</tt> that's optimized for up
845
+ to <tt>n</tt> items, using <tt>h</tt> as the hash function and
846
+ <tt>k</tt> as the key equal function.
847
+ </TD>
848
+ </TR>
849
+
850
+ <TR>
851
+ <TD VAlign=top>
852
+ <pre>template &lt;class <A
853
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
854
+ dense_hash_map(InputIterator f, InputIterator l) </pre>
855
+ <A href="#2">[2]</A>
856
+ </TD>
857
+ <TD VAlign=top>
858
+ <A
859
+ href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique
860
+ Hashed Associative Container</A>
861
+ </TD>
862
+ <TD VAlign=top>
863
+ Creates a dense_hash_map with a copy of a range.
864
+ </TD>
865
+ </TR>
866
+
867
+ <TR>
868
+ <TD VAlign=top>
869
+ <pre>template &lt;class <A
870
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
871
+ dense_hash_map(InputIterator f, InputIterator l, size_type n) </pre>
872
+ <A href="#2">[2]</A>
873
+ </TD>
874
+ <TD VAlign=top>
875
+ <A
876
+ href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique
877
+ Hashed Associative Container</A>
878
+ </TD>
879
+ <TD VAlign=top>
880
+ Creates a hash_map with a copy of a range that's optimized to
881
+ hold up to <tt>n</tt> items.
882
+ </TD>
883
+ </TR>
884
+
885
+ <TR>
886
+ <TD VAlign=top>
887
+ <pre>template &lt;class <A
888
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
889
+ dense_hash_map(InputIterator f, InputIterator l, size_type n, const
890
+ hasher&amp; h) </pre> <A href="#2">[2]</A>
891
+ </TD>
892
+ <TD VAlign=top>
893
+ <A
894
+ href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique
895
+ Hashed Associative Container</A>
896
+ </TD>
897
+ <TD VAlign=top>
898
+ Creates a hash_map with a copy of a range that's optimized to hold
899
+ up to <tt>n</tt> items, using <tt>h</tt> as the hash function.
900
+ </TD>
901
+ </TR>
902
+
903
+ <TR>
904
+ <TD VAlign=top>
905
+ <pre>template &lt;class <A
906
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
907
+ dense_hash_map(InputIterator f, InputIterator l, size_type n, const
908
+ hasher&amp; h, const key_equal&amp; k) </pre> <A href="#2">[2]</A>
909
+ </TD>
910
+ <TD VAlign=top>
911
+ <A
912
+ href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique
913
+ Hashed Associative Container</A>
914
+ </TD>
915
+ <TD VAlign=top>
916
+ Creates a hash_map with a copy of a range that's optimized for
917
+ holding up to <tt>n</tt> items, using <tt>h</tt> as the hash
918
+ function and <tt>k</tt> as the key equal function.
919
+ </TD>
920
+ </TR>
921
+
922
+ <TR>
923
+ <TD VAlign=top>
924
+ <tt>dense_hash_map(const hash_map&amp;)</tt>
925
+ </TD>
926
+ <TD VAlign=top>
927
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
928
+ </TD>
929
+ <TD VAlign=top>
930
+ The copy constructor.
931
+ </TD>
932
+ </TR>
933
+
934
+ <TR>
935
+ <TD VAlign=top>
936
+ <tt>dense_hash_map&amp; operator=(const hash_map&amp;)</tt>
937
+ </TD>
938
+ <TD VAlign=top>
939
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
940
+ </TD>
941
+ <TD VAlign=top>
942
+ The assignment operator
943
+ </TD>
944
+ </TR>
945
+
946
+ <TR>
947
+ <TD VAlign=top>
948
+ <tt>void swap(hash_map&amp;)</tt>
949
+ </TD>
950
+ <TD VAlign=top>
951
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
952
+ </TD>
953
+ <TD VAlign=top>
954
+ Swaps the contents of two hash_maps.
955
+ </TD>
956
+ </TR>
957
+
958
+ <TR>
959
+ <TD VAlign=top>
960
+ <pre>pair&lt;iterator, bool&gt; insert(const value_type&amp; x)
961
+ </pre>
962
+ </TD>
963
+ <TD VAlign=top>
964
+ <A
965
+ href="http://www.sgi.com/tech/stl/UniqueAssociativeContainer.html">Unique
966
+ Associative Container</A>
967
+ </TD>
968
+ <TD VAlign=top>
969
+ Inserts <tt>x</tt> into the <tt>dense_hash_map</tt>.
970
+ </TD>
971
+ </TR>
972
+
973
+ <TR>
974
+ <TD VAlign=top>
975
+ <pre>template &lt;class <A
976
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
977
+ void insert(InputIterator f, InputIterator l) </pre> <A href="#2">[2]</A>
978
+ </TD>
979
+ <TD VAlign=top>
980
+ <A
981
+ href="http://www.sgi.com/tech/stl/UniqueAssociativeContainer.html">Unique
982
+ Associative Container</A>
983
+ </TD>
984
+ <TD VAlign=top>
985
+ Inserts a range into the <tt>dense_hash_map</tt>.
986
+ </TD>
987
+ </TR>
988
+
989
+ <TR>
990
+ <TD VAlign=top>
991
+ <tt>void set_empty_key(const key_type& key)</tt> <A href="#6">[6]</A>
992
+ </TD>
993
+ <TD VAlign=top>
994
+ <tt>dense_hash_map</tt>
995
+ </TD>
996
+ <TD VAlign=top>
997
+ <A HREF="#new">See below</A>.
998
+ </TD>
999
+ </TR>
1000
+
1001
+ <TR>
1002
+ <TD VAlign=top>
1003
+ <tt>void set_deleted_key(const key_type& key)</tt> <A href="#6">[6]</A>
1004
+ </TD>
1005
+ <TD VAlign=top>
1006
+ <tt>dense_hash_map</tt>
1007
+ </TD>
1008
+ <TD VAlign=top>
1009
+ <A HREF="#new">See below</A>.
1010
+ </TD>
1011
+ </TR>
1012
+
1013
+ <TR>
1014
+ <TD VAlign=top>
1015
+ <tt>void clear_deleted_key()</tt> <A href="#6">[6]</A>
1016
+ </TD>
1017
+ <TD VAlign=top>
1018
+ <tt>dense_hash_map</tt>
1019
+ </TD>
1020
+ <TD VAlign=top>
1021
+ <A HREF="#new">See below</A>.
1022
+ </TD>
1023
+ </TR>
1024
+
1025
+ <TR>
1026
+ <TD VAlign=top>
1027
+ <tt>void erase(iterator pos)</tt>
1028
+ </TD>
1029
+ <TD VAlign=top>
1030
+ <A
1031
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
1032
+ Container</A>
1033
+ </TD>
1034
+ <TD VAlign=top>
1035
+ Erases the element pointed to by <tt>pos</tt>.
1036
+ <A href="#6">[6]</A>
1037
+ </TD>
1038
+ </TR>
1039
+
1040
+ <TR>
1041
+ <TD VAlign=top>
1042
+ <tt>size_type erase(const key_type&amp; k)</tt>
1043
+ </TD>
1044
+ <TD VAlign=top>
1045
+ <A
1046
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
1047
+ Container</A>
1048
+ </TD>
1049
+ <TD VAlign=top>
1050
+ Erases the element whose key is <tt>k</tt>.
1051
+ <A href="#6">[6]</A>
1052
+ </TD>
1053
+ </TR>
1054
+
1055
+ <TR>
1056
+ <TD VAlign=top>
1057
+ <tt>void erase(iterator first, iterator last)</tt>
1058
+ </TD>
1059
+ <TD VAlign=top>
1060
+ <A
1061
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
1062
+ Container</A>
1063
+ </TD>
1064
+ <TD VAlign=top>
1065
+ Erases all elements in a range.
1066
+ <A href="#6">[6]</A>
1067
+ </TD>
1068
+ </TR>
1069
+
1070
+ <TR>
1071
+ <TD VAlign=top>
1072
+ <tt>void clear()</tt>
1073
+ </TD>
1074
+ <TD VAlign=top>
1075
+ <A
1076
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
1077
+ Container</A>
1078
+ </TD>
1079
+ <TD VAlign=top>
1080
+ Erases all of the elements.
1081
+ </TD>
1082
+ </TR>
1083
+
1084
+ <TR>
1085
+ <TD VAlign=top>
1086
+ <tt>void clear_no_resize()</tt>
1087
+ </TD>
1088
+ <TD VAlign=top>
1089
+ <tt>dense_hash_map</tt>
1090
+ </TD>
1091
+ <TD VAlign=top>
1092
+ <A HREF="#new">See below</A>.
1093
+ </TD>
1094
+ </TR>
1095
+
1096
+ <TR>
1097
+ <TD VAlign=top>
1098
+ <tt>const_iterator find(const key_type&amp; k) const</tt>
1099
+ </TD>
1100
+ <TD VAlign=top>
1101
+ <A
1102
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
1103
+ Container</A>
1104
+ </TD>
1105
+ <TD VAlign=top>
1106
+ Finds an element whose key is <tt>k</tt>.
1107
+ </TD>
1108
+ </TR>
1109
+
1110
+ <TR>
1111
+ <TD VAlign=top>
1112
+ <tt>iterator find(const key_type&amp; k)</tt>
1113
+ </TD>
1114
+ <TD VAlign=top>
1115
+ <A
1116
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
1117
+ Container</A>
1118
+ </TD>
1119
+ <TD VAlign=top>
1120
+ Finds an element whose key is <tt>k</tt>.
1121
+ </TD>
1122
+ </TR>
1123
+
1124
+ <TR>
1125
+ <TD VAlign=top>
1126
+ <tt>size_type count(const key_type&amp; k) const</tt>
1127
+ </TD>
1128
+ <TD VAlign=top>
1129
+ <A
1130
+ href="http://www.sgi.com/tech/stl/UniqueAssociativeContainer.html">Unique
1131
+ Associative Container</A>
1132
+ </TD>
1133
+ <TD VAlign=top>
1134
+ Counts the number of elements whose key is <tt>k</tt>.
1135
+ </TD>
1136
+ </TR>
1137
+
1138
+ <TR>
1139
+ <TD VAlign=top>
1140
+ <pre>pair&lt;const_iterator, const_iterator&gt; equal_range(const
1141
+ key_type&amp; k) const </pre>
1142
+ </TD>
1143
+ <TD VAlign=top>
1144
+ <A
1145
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
1146
+ Container</A>
1147
+ </TD>
1148
+ <TD VAlign=top>
1149
+ Finds a range containing all elements whose key is <tt>k</tt>.
1150
+ </TD>
1151
+ </TR>
1152
+
1153
+ <TR>
1154
+ <TD VAlign=top>
1155
+ <pre>pair&lt;iterator, iterator&gt; equal_range(const
1156
+ key_type&amp; k) </pre>
1157
+ </TD>
1158
+ <TD VAlign=top>
1159
+ <A
1160
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
1161
+ Container</A>
1162
+ </TD>
1163
+ <TD VAlign=top>
1164
+ Finds a range containing all elements whose key is <tt>k</tt>.
1165
+ </TD>
1166
+ </TR>
1167
+
1168
+ <TR>
1169
+ <TD VAlign=top>
1170
+ <pre>data_type&amp; operator[](const key_type&amp; k) <A
1171
+ href="http://www.sgi.com/tech/stl/#3">[3]</A> </pre>
1172
+ </TD>
1173
+ <TD VAlign=top>
1174
+ <tt>dense_hash_map</tt>
1175
+ </TD>
1176
+ <TD VAlign=top>
1177
+ <A HREF="#new">See below</A>.
1178
+ </TD>
1179
+ </TR>
1180
+
1181
+ <TR>
1182
+ <TD VAlign=top>
1183
+ <tt>bool write_metadata(FILE *fp)</tt>
1184
+ </TD>
1185
+ <TD VAlign=top>
1186
+ <tt>dense_hash_map</tt>
1187
+ </TD>
1188
+ <TD VAlign=top>
1189
+ <A HREF="#new">See below</A>.
1190
+ </TD>
1191
+ </TR>
1192
+
1193
+ <TR>
1194
+ <TD VAlign=top>
1195
+ <tt>bool read_metadata(FILE *fp)</tt>
1196
+ </TD>
1197
+ <TD VAlign=top>
1198
+ <tt>dense_hash_map</tt>
1199
+ </TD>
1200
+ <TD VAlign=top>
1201
+ <A HREF="#new">See below</A>.
1202
+ </TD>
1203
+ </TR>
1204
+
1205
+ <TR>
1206
+ <TD VAlign=top>
1207
+ <tt>bool write_nopointer_data(FILE *fp)</tt>
1208
+ </TD>
1209
+ <TD VAlign=top>
1210
+ <tt>dense_hash_map</tt>
1211
+ </TD>
1212
+ <TD VAlign=top>
1213
+ <A HREF="#new">See below</A>.
1214
+ </TD>
1215
+ </TR>
1216
+
1217
+ <TR>
1218
+ <TD VAlign=top>
1219
+ <tt>bool read_nopointer_data(FILE *fp)</tt>
1220
+ </TD>
1221
+ <TD VAlign=top>
1222
+ <tt>dense_hash_map</tt>
1223
+ </TD>
1224
+ <TD VAlign=top>
1225
+ <A HREF="#new">See below</A>.
1226
+ </TD>
1227
+ </TR>
1228
+
1229
+ <TR>
1230
+ <TD VAlign=top>
1231
+ <pre>bool operator==(const hash_map&amp;, const hash_map&amp;)
1232
+ </pre>
1233
+ </TD>
1234
+ <TD VAlign=top>
1235
+ <A
1236
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
1237
+ Associative Container</A>
1238
+ </TD>
1239
+ <TD VAlign=top>
1240
+ Tests two hash_maps for equality. This is a global function, not a
1241
+ member function.
1242
+ </TD>
1243
+ </TR>
1244
+
1245
+ </table>
1246
+
1247
+
1248
+ <h3><A NAME="new">New members</A></h3>
1249
+
1250
+ These members are not defined in the <A
1251
+ href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique
1252
+ Hashed Associative Container</A>, <A
1253
+ href="http://www.sgi.com/tech/stl/PairAssociativeContainer.html">Pair
1254
+ Associative Container</A>, or tr1's +<tt>Unordered Associative
1255
+ Container</tt> requirements, but are specific to
1256
+ <tt>dense_hash_map</tt>.
1257
+
1258
+ <table border>
1259
+ <TR><TH>Member</TH><TH>Description</TH></TR>
1260
+
1261
+ <TR>
1262
+ <TD VAlign=top>
1263
+ <tt>void set_empty_key(const key_type& key)</tt>
1264
+ </TD>
1265
+ <TD VAlign=top>
1266
+ Sets the distinguished "empty" key to <tt>key</tt>. This must be
1267
+ called immediately after construct time, before calls to another
1268
+ other <tt>dense_hash_map</tt> operation. <A href="#6">[6]</A>
1269
+ </TD>
1270
+ </TR>
1271
+
1272
+ <TR>
1273
+ <TD VAlign=top>
1274
+ <tt>void set_deleted_key(const key_type& key)</tt>
1275
+ </TD>
1276
+ <TD VAlign=top>
1277
+ Sets the distinguished "deleted" key to <tt>key</tt>. This must be
1278
+ called before any calls to <tt>erase()</tt>. <A href="#6">[6]</A>
1279
+ </TD>
1280
+ </TR>
1281
+
1282
+ <TR>
1283
+ <TD VAlign=top>
1284
+ <tt>void clear_deleted_key()</tt>
1285
+ </TD>
1286
+ <TD VAlign=top>
1287
+ Clears the distinguished "deleted" key. After this is called,
1288
+ calls to <tt>erase()</tt> are not valid on this object.
1289
+ <A href="#6">[6]</A>
1290
+ </TD>
1291
+ </TR>
1292
+
1293
+ <TR>
1294
+ <TD VAlign=top>
1295
+ <tt>void clear_no_resize()</tt>
1296
+ </TD>
1297
+ <TD VAlign=top>
1298
+ Clears the hashtable like <tt>clear()</tt> does, but does not
1299
+ recover the memory used for hashtable buckets. (The memory
1300
+ used by the <i>items</i> in the hashtable is still recovered.)
1301
+ This can save time for applications that want to reuse a
1302
+ <tt>dense_hash_map</tt> many times, each time with a similar number
1303
+ of objects.
1304
+ </TD>
1305
+ </TR>
1306
+
1307
+ <TR>
1308
+ <TD VAlign=top>
1309
+ <pre>
1310
+ data_type&amp;
1311
+ operator[](const key_type&amp; k) <A
1312
+ href="http://www.sgi.com/tech/stl/#3">[3]</A>
1313
+ </pre>
1314
+ </TD>
1315
+ <TD VAlign=top>
1316
+ Returns a reference to the object that is associated with
1317
+ a particular key. If the <tt>dense_hash_map</tt> does not already
1318
+ contain such an object, <tt>operator[]</tt> inserts the default
1319
+ object <tt>data_type()</tt>. <A
1320
+ href="http://www.sgi.com/tech/stl/#3">[3]</A>
1321
+ </TD>
1322
+ </TR>
1323
+
1324
+ <TD VAlign=top>
1325
+ <tt>void set_resizing_parameters(float shrink, float grow)</tt>
1326
+ </TD>
1327
+ <TD VAlign=top>
1328
+ This function is DEPRECATED. It is equivalent to calling
1329
+ <tt>min_load_factor(shrink); max_load_factor(grow)</tt>.
1330
+ </TD>
1331
+ </TR>
1332
+
1333
+ <TR>
1334
+ <TD VAlign=top>
1335
+ <tt>bool write_metadata(FILE *fp)</tt>
1336
+ </TD>
1337
+ <TD VAlign=top>
1338
+ Write hashtable metadata to <tt>fp</tt>. See <A HREF="#io">below</A>.
1339
+ </TD>
1340
+ </TR>
1341
+
1342
+ <TR>
1343
+ <TD VAlign=top>
1344
+ <tt>bool read_metadata(FILE *fp)</tt>
1345
+ </TD>
1346
+ <TD VAlign=top>
1347
+ Read hashtable metadata from <tt>fp</tt>. See <A HREF="#io">below</A>.
1348
+ </TD>
1349
+ </TR>
1350
+
1351
+ <TR>
1352
+ <TD VAlign=top>
1353
+ <tt>bool write_nopointer_data(FILE *fp)</tt>
1354
+ </TD>
1355
+ <TD VAlign=top>
1356
+ Write hashtable contents to <tt>fp</tt>. This is valid only if the
1357
+ hashtable key and value are "plain" data. See <A HREF="#io">below</A>.
1358
+ </TD>
1359
+ </TR>
1360
+
1361
+ <TR>
1362
+ <TD VAlign=top>
1363
+ <tt>bool read_nopointer_data(FILE *fp)</tt>
1364
+ </TD>
1365
+ <TD VAlign=top>
1366
+ Read hashtable contents to <tt>fp</tt>. This is valid only if the
1367
+ hashtable key and value are "plain" data. See <A HREF="#io">below</A>.
1368
+ </TD>
1369
+ </TR>
1370
+
1371
+ </table>
1372
+
1373
+
1374
+ <h3>Notes</h3>
1375
+
1376
+ <P><A name="1">[1]</A>
1377
+
1378
+ <tt>dense_hash_map::iterator</tt> is not a mutable iterator, because
1379
+ <tt>dense_hash_map::value_type</tt> is not <A
1380
+ href="http://www.sgi.com/tech/stl/Assignable.html">Assignable</A>.
1381
+ That is, if <tt>i</tt> is of type <tt>dense_hash_map::iterator</tt>
1382
+ and <tt>p</tt> is of type <tt>dense_hash_map::value_type</tt>, then
1383
+ <tt>*i = p</tt> is not a valid expression. However,
1384
+ <tt>dense_hash_map::iterator</tt> isn't a constant iterator either,
1385
+ because it can be used to modify the object that it points to. Using
1386
+ the same notation as above, <tt>(*i).second = p</tt> is a valid
1387
+ expression.</p>
1388
+
1389
+ <P><A name="2">[2]</A>
1390
+
1391
+ This member function relies on <i>member template</i> functions, which
1392
+ may not be supported by all compilers. If your compiler supports
1393
+ member templates, you can call this function with any type of <A
1394
+ href="http://www.sgi.com/tech/stl/InputIterator.html">input
1395
+ iterator</A>. If your compiler does not yet support member templates,
1396
+ though, then the arguments must either be of type <tt>const
1397
+ value_type*</tt> or of type <tt>dense_hash_map::const_iterator</tt>.</p>
1398
+
1399
+ <P><A name="3">[3]</A>
1400
+
1401
+ Since <tt>operator[]</tt> might insert a new element into the
1402
+ <tt>dense_hash_map</tt>, it can't possibly be a <tt>const</tt> member
1403
+ function. Note that the definition of <tt>operator[]</tt> is
1404
+ extremely simple: <tt>m[k]</tt> is equivalent to
1405
+ <tt>(*((m.insert(value_type(k, data_type()))).first)).second</tt>.
1406
+ Strictly speaking, this member function is unnecessary: it exists only
1407
+ for convenience.</p>
1408
+
1409
+ <P><A name="4">[4]</A>
1410
+
1411
+ In order to preserve iterators, erasing hashtable elements does not
1412
+ cause a hashtable to resize. This means that after a string of
1413
+ <tt>erase()</tt> calls, the hashtable will use more space than is
1414
+ required. At a cost of invalidating all current iterators, you can
1415
+ call <tt>resize()</tt> to manually compact the hashtable. The
1416
+ hashtable promotes too-small <tt>resize()</tt> arguments to the
1417
+ smallest legal value, so to compact a hashtable, it's sufficient to
1418
+ call <tt>resize(0)</tt>.</p>
1419
+
1420
+ <P><A name="5">[5]</A>
1421
+
1422
+ Unlike some other hashtable implementations, the optional <i>n</i> in
1423
+ the calls to the constructor, <tt>resize</tt>, and <tt>rehash</tt>
1424
+ indicates not the desired number of buckets that
1425
+ should be allocated, but instead the expected number of items to be
1426
+ inserted. The class then sizes the hash-map appropriately for the
1427
+ number of items specified. It's not an error to actually insert more
1428
+ or fewer items into the hashtable, but the implementation is most
1429
+ efficient -- does the fewest hashtable resizes -- if the number of
1430
+ inserted items is <i>n</i> or slightly less.</p>
1431
+
1432
+ <P><A name="6">[6]</A>
1433
+
1434
+ <tt>dense_hash_map</tt> <b>requires</b> you call
1435
+ <tt>set_empty_key()</tt> immediately after constructing the hash-map,
1436
+ and before calling any other <tt>dense_hash_map</tt> method. (This is
1437
+ the largest difference between the <tt>dense_hash_map</tt> API and
1438
+ other hash-map APIs. See <A HREF="implementation.html">implementation.html</A>
1439
+ for why this is necessary.)
1440
+ The argument to <tt>set_empty_key()</tt> should be a key-value that
1441
+ is never used for legitimate hash-map entries. If you have no such
1442
+ key value, you will be unable to use <tt>dense_hash_map</tt>. It is
1443
+ an error to call <tt>insert()</tt> with an item whose key is the
1444
+ "empty key."</p>
1445
+
1446
+ <tt>dense_hash_map</tt> also requires you call
1447
+ <tt>set_deleted_key()</tt> before calling <tt>erase()</tt>.
1448
+ The argument to <tt>set_deleted_key()</tt> should be a key-value that
1449
+ is never used for legitimate hash-map entries. It must be different
1450
+ from the key-value used for <tt>set_empty_key()</tt>. It is an error to call
1451
+ <tt>erase()</tt> without first calling <tt>set_deleted_key()</tt>, and
1452
+ it is also an error to call <tt>insert()</tt> with an item whose key
1453
+ is the "deleted key."</p>
1454
+
1455
+ <p>There is no need to call <tt>set_deleted_key</tt> if you do not
1456
+ wish to call <tt>erase()</tt> on the hash-map.</p>
1457
+
1458
+ <p>It is acceptable to change the deleted-key at any time by calling
1459
+ <tt>set_deleted_key()</tt> with a new argument. You can also call
1460
+ <tt>clear_deleted_key()</tt>, at which point all keys become valid for
1461
+ insertion but no hashtable entries can be deleted until
1462
+ <tt>set_deleted_key()</tt> is called again.</p>
1463
+
1464
+ <P><A name="7">[7]</A>
1465
+
1466
+ <tt>dense_hash_map</tt> <b>requires</b> that <tt>data_type</tt> has a
1467
+ zero-argument default constructor. This is because
1468
+ <tt>dense_hash_map</tt> uses the special value <tt>pair(empty_key,
1469
+ data_type())</tt> to denote empty buckets, and thus needs to be able
1470
+ to create <tt>data_type</tt> using a zero-argument constructor.</p>
1471
+
1472
+ <p>If your <tt>data_type</tt> does not have a zero-argument default
1473
+ constructor, there are several workarounds:</p>
1474
+ <ul>
1475
+ <li> Store a pointer to <tt>data_type</tt> in the map, instead of
1476
+ <tt>data_type</tt> directly. This may yield faster code as
1477
+ well, since hashtable-resizes will just have to move pointers
1478
+ around, rather than copying the entire <tt>data_type</tt>.
1479
+ <li> Add a zero-argument default constructor to <tt>data_type</tt>.
1480
+ <li> Subclass <tt>data_type</tt> and add a zero-argument default
1481
+ constructor to the subclass.
1482
+ </ul>
1483
+
1484
+
1485
+ <h3><A NAME=io>Input/Output</A></h3>
1486
+
1487
+ <table border=1 cellpadding=5><tr><td>
1488
+ <p><b>IMPORTANT IMPLEMENTATION NOTE:</b> In the current version of
1489
+ this code, the input/output routines for <tt>dense_hash_map</tt> have
1490
+ <b>not yet been implemented</b>. This section explains the API, but
1491
+ note that all calls to these routines will fail (return
1492
+ <tt>false</tt>). It is a TODO to remedy this situation.</p>
1493
+ </td></tr></table>
1494
+
1495
+ <p>It is possible to save and restore <tt>dense_hash_map</tt> objects
1496
+ to disk. Storage takes place in two steps. The first writes the
1497
+ hashtable metadata. The second writes the actual data.</p>
1498
+
1499
+ <p>To write a hashtable to disk, first call <tt>write_metadata()</tt>
1500
+ on an open file pointer. This saves the hashtable information in a
1501
+ byte-order-independent format.</p>
1502
+
1503
+ <p>After the metadata has been written to disk, you must write the
1504
+ actual data stored in the hash-map to disk. If both the key and data
1505
+ are "simple" enough, you can do this by calling
1506
+ <tt>write_nopointer_data()</tt>. "Simple" data is data that can be
1507
+ safely copied to disk via <tt>fwrite()</tt>. Native C data types fall
1508
+ into this category, as do structs of native C data types. Pointers
1509
+ and STL objects do not.</p>
1510
+
1511
+ <p>Note that <tt>write_nopointer_data()</tt> does not do any endian
1512
+ conversion. Thus, it is only appropriate when you intend to read the
1513
+ data on the same endian architecture as you write the data.</p>
1514
+
1515
+ <p>If you cannot use <tt>write_nopointer_data()</tt> for any reason,
1516
+ you can write the data yourself by iterating over the
1517
+ <tt>dense_hash_map</tt> with a <tt>const_iterator</tt> and writing
1518
+ the key and data in any manner you wish.</p>
1519
+
1520
+ <p>To read the hashtable information from disk, first you must create
1521
+ a <tt>dense_hash_map</tt> object. Then open a file pointer to point
1522
+ to the saved hashtable, and call <tt>read_metadata()</tt>. If you
1523
+ saved the data via <tt>write_nopointer_data()</tt>, you can follow the
1524
+ <tt>read_metadata()</tt> call with a call to
1525
+ <tt>read_nopointer_data()</tt>. This is all that is needed.</p>
1526
+
1527
+ <p>If you saved the data through a custom write routine, you must call
1528
+ a custom read routine to read in the data. To do this, iterate over
1529
+ the <tt>dense_hash_map</tt> with an <tt>iterator</tt>; this operation
1530
+ is sensical because the metadata has already been set up. For each
1531
+ iterator item, you can read the key and value from disk, and set it
1532
+ appropriately. You will need to do a <tt>const_cast</tt> on the
1533
+ iterator, since <tt>it-&gt;first</tt> is always <tt>const</tt>. You
1534
+ will also need to use placement-new if the key or value is a C++
1535
+ object. The code might look like this:</p>
1536
+ <pre>
1537
+ for (dense_hash_map&lt;int*, ComplicatedClass&gt;::iterator it = ht.begin();
1538
+ it != ht.end(); ++it) {
1539
+ // The key is stored in the dense_hash_map as a pointer
1540
+ const_cast&lt;int*&gt;(it-&gt;first) = new int;
1541
+ fread(const_cast&lt;int*&gt;(it-&gt;first), sizeof(int), 1, fp);
1542
+ // The value is a complicated C++ class that takes an int to construct
1543
+ int ctor_arg;
1544
+ fread(&ctor_arg, sizeof(int), 1, fp);
1545
+ new (&it-&gt;second) ComplicatedClass(ctor_arg); // "placement new"
1546
+ }
1547
+ </pre>
1548
+
1549
+
1550
+ <h3><A NAME=iter>Validity of Iterators</A></h3>
1551
+
1552
+ <p><tt>erase()</tt> is guaranteed not to invalidate any iterators --
1553
+ except for any iterators pointing to the item being erased, of course.
1554
+ <tt>insert()</tt> invalidates all iterators, as does
1555
+ <tt>resize()</tt>. </p>
1556
+
1557
+ <p>This is implemented by making <tt>erase()</tt> not resize the
1558
+ hashtable. If you desire maximum space efficiency, you can call
1559
+ <tt>resize(0)</tt> after a string of <tt>erase()</tt> calls, to force
1560
+ the hashtable to resize to the smallest possible size.</p>
1561
+
1562
+ <p>In addition to invalidating iterators, <tt>insert()</tt>
1563
+ and <tt>resize()</tt> invalidate all pointers into the hashtable. If
1564
+ you want to store a pointer to an object held in a dense_hash_map,
1565
+ either do so after finishing hashtable inserts, or store the object on
1566
+ the heap and a pointer to it in the dense_hash_map.</p>
1567
+
1568
+
1569
+ <h3>See also</h3>
1570
+
1571
+ <p>The following are SGI STL, and some Google STL, concepts and
1572
+ classes related to <tt>dense_hash_map</tt>.</p>
1573
+
1574
+ <tt><A href="http://www.sgi.com/tech/stl/hash_map.html">hash_map</A></tt>,
1575
+ <A href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative Container</A>,
1576
+ <A href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed Associative Container</A>,
1577
+ <A href="http://www.sgi.com/tech/stl/PairAssociativeContainer.html">Pair Associative Container</A>,
1578
+ <A href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique Hashed Associative Container</A>,
1579
+ <tt><A href="http://www.sgi.com/tech/stl/set.html">set</A></tt>,
1580
+ <tt><A href="http://www.sgi.com/tech/stl/Map.html">map</A></tt>
1581
+ <tt><A href="http://www.sgi.com/tech/stl/multiset.html">multiset</A></tt>,
1582
+ <tt><A href="http://www.sgi.com/tech/stl/Multimap.html">multimap</A></tt>,
1583
+ <tt><A href="http://www.sgi.com/tech/stl/hash_set.html">hash_set</A></tt>,
1584
+ <tt><A href="http://www.sgi.com/tech/stl/hash_multiset.html">hash_multiset</A></tt>,
1585
+ <tt><A href="http://www.sgi.com/tech/stl/hash_multimap.html">hash_multimap</A></tt>,
1586
+ <tt><A href="sparse_hash_map.html">sparse_hash_map</A></tt>,
1587
+ <tt><A href="sparse_hash_set.html">sparse_hash_set</A></tt>,
1588
+ <tt><A href="dense_hash_set.html">dense_hash_set</A></tt>
1589
+
1590
+ </BODY>
1591
+ </HTML>