google_hash 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,1445 @@
1
+ <HTML>
2
+ <!-- The API of this class and the documentation -- but not the
3
+ implementation! -- are based on that for SGI's hash_set 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_set&lt;Key, 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_set&lt;Key, HashFcn, EqualKey, Alloc&gt;</H1>
45
+
46
+ <p><tt>dense_hash_set</tt> is a <A
47
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
48
+ Associative Container</A> that stores objects of type <tt>Key</tt>.
49
+ <tt>dense_hash_set</tt> is a <A
50
+ href="http://www.sgi.com/tech/stl/SimpleAssociativeContainer.html">Simple
51
+ Associative Container</A>, meaning that its value type, as well as its
52
+ key type, is <tt>key</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_set</tt> by its key is
59
+ efficient, so <tt>dense_hash_set</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_set</tt> is distinguished from other hash-set
65
+ implementations by its speed and by the ability to save
66
+ and restore contents to disk. On the other hand, this hash-set
67
+ implementation can use significantly more space than other hash-set
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_set&gt;
92
+
93
+ using google::dense_hash_set; // 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
+ void lookup(const hash_set&lt;const char*, hash&lt;const char*&gt;, eqstr&gt;&amp; Set,
107
+ const char* word)
108
+ {
109
+ dense_hash_set&lt;const char*, hash&lt;const char*&gt;, eqstr&gt;::const_iterator it
110
+ = Set.find(word);
111
+ cout &lt;&lt; word &lt;&lt; &quot;: &quot;
112
+ &lt;&lt; (it != Set.end() ? &quot;present&quot; : &quot;not present&quot;)
113
+ &lt;&lt; endl;
114
+ }
115
+
116
+ int main()
117
+ {
118
+ dense_hash_set&lt;const char*, hash&lt;const char*&gt;, eqstr&gt; Set;
119
+ Set.set_empty_key(NULL);
120
+ Set.insert(&quot;kiwi&quot;);
121
+ Set.insert(&quot;plum&quot;);
122
+ Set.insert(&quot;apple&quot;);
123
+ Set.insert(&quot;mango&quot;);
124
+ Set.insert(&quot;apricot&quot;);
125
+ Set.insert(&quot;banana&quot;);
126
+
127
+ lookup(Set, &quot;mango&quot;);
128
+ lookup(Set, &quot;apple&quot;);
129
+ lookup(Set, &quot;durian&quot;);
130
+ }
131
+ </pre>
132
+
133
+
134
+ <h3>Definition</h3>
135
+
136
+ Defined in the header <A href="dense_hash_set">dense_hash_set</A>.
137
+ This class is not part of the C++ standard, though it is mostly
138
+ compatible with the tr1 class <code>unordered_set</code>.
139
+
140
+
141
+ <h3>Template parameters</h3>
142
+
143
+ <table border>
144
+ <TR><TH>Parameter</TH><TH>Description</TH><TH>Default</TH></TR>
145
+
146
+ <TR>
147
+ <TD VAlign=top>
148
+ <tt>Key</tt>
149
+ </TD>
150
+ <TD VAlign=top>
151
+ The hash_set's key and value type. This is also defined as
152
+ <tt>dense_hash_set::key_type</tt> and
153
+ <tt>dense_hash_set::value_type</tt>.
154
+ </TD>
155
+ <TD VAlign=top>
156
+ &nbsp;
157
+ </TD>
158
+ </TR>
159
+
160
+ <TR>
161
+ <TD VAlign=top>
162
+ <tt>HashFcn</tt>
163
+ </TD>
164
+ <TD VAlign=top>
165
+ The <A href="http://www.sgi.com/tech/stl/HashFunction.html">hash function</A> used by the
166
+ hash_set. This is also defined as <tt>dense_hash_set::hasher</tt>.
167
+ <br><b>Note:</b> Hashtable performance depends heavliy on the choice of
168
+ hash function. See <A HREF="performance.html#hashfn">the performance
169
+ page</A> for more information.
170
+ </TD>
171
+ <TD VAlign=top>
172
+ <tt><A href="http://www.sgi.com/tech/stl/hash.html">hash</A>&lt;Key&gt;</tt>
173
+ </TD>
174
+ </TR>
175
+
176
+ <TR>
177
+ <TD VAlign=top>
178
+ <tt>EqualKey</tt>
179
+ </TD>
180
+ <TD VAlign=top>
181
+ The hash_set key equality function: a <A
182
+ href="http://www.sgi.com/tech/stl/BinaryPredicate.html">binary predicate</A> that determines
183
+ whether two keys are equal. This is also defined as
184
+ <tt>dense_hash_set::key_equal</tt>.
185
+ </TD>
186
+ <TD VAlign=top>
187
+ <tt><A href="http://www.sgi.com/tech/stl/equal_to.html">equal_to</A>&lt;Key&gt;</tt>
188
+ </TD>
189
+ </TR>
190
+
191
+ <TR>
192
+ <TD VAlign=top>
193
+ <tt>Alloc</tt>
194
+ </TD>
195
+ <TD VAlign=top>
196
+ <b>Ignored</b>; this is included only for API-compatibility
197
+ with SGI's (and tr1's) STL implementation.
198
+ </TD>
199
+ <TD VAlign=top>
200
+ </TD>
201
+ </TR>
202
+
203
+ </table>
204
+
205
+
206
+ <h3>Model of</h3>
207
+
208
+ <A href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique Hashed Associative Container</A>,
209
+ <A href="http://www.sgi.com/tech/stl/SimpleAssociativeContainer.html">Simple Associative Container</A>
210
+
211
+
212
+ <h3>Type requirements</h3>
213
+
214
+ <UL>
215
+ <LI>
216
+ <tt>Key</tt> is Assignable.
217
+ <LI>
218
+ <tt>EqualKey</tt> is a Binary Predicate whose argument type is Key.
219
+ <LI>
220
+ <tt>EqualKey</tt> is an equivalence relation.
221
+ <LI>
222
+ <tt>Alloc</tt> is an Allocator.
223
+ </UL>
224
+
225
+
226
+ <h3>Public base classes</h3>
227
+
228
+ None.
229
+
230
+
231
+ <h3>Members</h3>
232
+
233
+ <table border>
234
+ <TR><TH>Member</TH><TH>Where defined</TH><TH>Description</TH></TR>
235
+
236
+ <TR>
237
+ <TD VAlign=top>
238
+ <tt>value_type</tt>
239
+ </TD>
240
+ <TD VAlign=top>
241
+ <A
242
+ href="http://www.sgi.com/tech/stl/Container.html">Container</A>
243
+ </TD>
244
+ <TD VAlign=top>
245
+ The type of object, <tt>T</tt>, stored in the hash_set.
246
+ </TD>
247
+ </TR>
248
+
249
+ <TR>
250
+ <TD VAlign=top>
251
+ <tt>key_type</tt>
252
+ </TD>
253
+ <TD VAlign=top>
254
+ <A
255
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
256
+ Container</A>
257
+ </TD>
258
+ <TD VAlign=top>
259
+ The key type associated with <tt>value_type</tt>.
260
+ </TD>
261
+ </TR>
262
+
263
+ <TR>
264
+ <TD VAlign=top>
265
+ <tt>hasher</tt>
266
+ </TD>
267
+ <TD VAlign=top>
268
+ <A
269
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
270
+ Associative Container</A>
271
+ </TD>
272
+ <TD VAlign=top>
273
+ The <tt>dense_hash_set</tt>'s <A
274
+ href="http://www.sgi.com/tech/stl/HashFunction.html">hash
275
+ function</A>.
276
+ </TD>
277
+ </TR>
278
+
279
+ <TR>
280
+ <TD VAlign=top>
281
+ <tt>key_equal</tt>
282
+ </TD>
283
+ <TD VAlign=top>
284
+ <A
285
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
286
+ Associative Container</A>
287
+ </TD>
288
+ <TD VAlign=top>
289
+ <A href="http://www.sgi.com/tech/stl/functors.html">Function
290
+ object</A> that compares keys for equality.
291
+ </TD>
292
+ </TR>
293
+
294
+ <TR>
295
+ <TD VAlign=top>
296
+ <tt>allocator_type</tt>
297
+ </TD>
298
+ <TD VAlign=top>
299
+ <tt>Unordered Associative Container</tt> (tr1)
300
+ </TD>
301
+ <TD VAlign=top>
302
+ The type of the Allocator given as a template parameter.
303
+ </TD>
304
+ </TR>
305
+
306
+ <TR>
307
+ <TD VAlign=top>
308
+ <tt>pointer</tt>
309
+ </TD>
310
+ <TD VAlign=top>
311
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
312
+ </TD>
313
+ <TD VAlign=top>
314
+ Pointer to <tt>T</tt>.
315
+ </TD>
316
+ </TR>
317
+
318
+ <TR>
319
+ <TD VAlign=top>
320
+ <tt>reference</tt>
321
+ </TD>
322
+ <TD VAlign=top>
323
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
324
+ </TD>
325
+ <TD VAlign=top>
326
+ Reference to <tt>T</tt>
327
+ </TD>
328
+ </TR>
329
+
330
+ <TR>
331
+ <TD VAlign=top>
332
+ <tt>const_reference</tt>
333
+ </TD>
334
+ <TD VAlign=top>
335
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
336
+ </TD>
337
+ <TD VAlign=top>
338
+ Const reference to <tt>T</tt>
339
+ </TD>
340
+ </TR>
341
+
342
+ <TR>
343
+ <TD VAlign=top>
344
+ <tt>size_type</tt>
345
+ </TD>
346
+ <TD VAlign=top>
347
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
348
+ </TD>
349
+ <TD VAlign=top>
350
+ An unsigned integral type.
351
+ </TD>
352
+ </TR>
353
+
354
+ <TR>
355
+ <TD VAlign=top>
356
+ <tt>difference_type</tt>
357
+ </TD>
358
+ <TD VAlign=top>
359
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
360
+ </TD>
361
+ <TD VAlign=top>
362
+ A signed integral type.
363
+ </TD>
364
+ </TR>
365
+
366
+ <TR>
367
+ <TD VAlign=top>
368
+ <tt>iterator</tt>
369
+ </TD>
370
+ <TD VAlign=top>
371
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
372
+ </TD>
373
+ <TD VAlign=top>
374
+ Iterator used to iterate through a <tt>dense_hash_set</tt>.
375
+ </TD>
376
+ </TR>
377
+
378
+ <TR>
379
+ <TD VAlign=top>
380
+ <tt>const_iterator</tt>
381
+ </TD>
382
+ <TD VAlign=top>
383
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
384
+ </TD>
385
+ <TD VAlign=top>
386
+ Const iterator used to iterate through a <tt>dense_hash_set</tt>.
387
+ (<tt>iterator</tt> and <tt>const_iterator</tt> are the same type.)
388
+ </TD>
389
+ </TR>
390
+
391
+ <TR>
392
+ <TD VAlign=top>
393
+ <tt>local_iterator</tt>
394
+ </TD>
395
+ <TD VAlign=top>
396
+ <tt>Unordered Associative Container</tt> (tr1)
397
+ </TD>
398
+ <TD VAlign=top>
399
+ Iterator used to iterate through a subset of
400
+ <tt>dense_hash_set</tt>.
401
+ </TD>
402
+ </TR>
403
+
404
+ <TR>
405
+ <TD VAlign=top>
406
+ <tt>const_local_iterator</tt>
407
+ </TD>
408
+ <TD VAlign=top>
409
+ <tt>Unordered Associative Container</tt> (tr1)
410
+ </TD>
411
+ <TD VAlign=top>
412
+ Const iterator used to iterate through a subset of
413
+ <tt>dense_hash_set</tt>.
414
+ </TD>
415
+ </TR>
416
+
417
+ <TR>
418
+ <TD VAlign=top>
419
+ <tt>iterator begin() const</tt>
420
+ </TD>
421
+ <TD VAlign=top>
422
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
423
+ </TD>
424
+ <TD VAlign=top>
425
+ Returns an <tt>iterator</tt> pointing to the beginning of the
426
+ <tt>dense_hash_set</tt>.
427
+ </TD>
428
+ </TR>
429
+
430
+ <TR>
431
+ <TD VAlign=top>
432
+ <tt>iterator end() const</tt>
433
+ </TD>
434
+ <TD VAlign=top>
435
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
436
+ </TD>
437
+ <TD VAlign=top>
438
+ Returns an <tt>iterator</tt> pointing to the end of the
439
+ <tt>dense_hash_set</tt>.
440
+ </TD>
441
+ </TR>
442
+
443
+ <TR>
444
+ <TD VAlign=top>
445
+ <tt>local_iterator begin(size_type i)</tt>
446
+ </TD>
447
+ <TD VAlign=top>
448
+ <tt>Unordered Associative Container</tt> (tr1)
449
+ </TD>
450
+ <TD VAlign=top>
451
+ Returns a <tt>local_iterator</tt> pointing to the beginning of bucket
452
+ <tt>i</tt> in the <tt>dense_hash_set</tt>.
453
+ </TD>
454
+ </TR>
455
+
456
+ <TR>
457
+ <TD VAlign=top>
458
+ <tt>local_iterator end(size_type i)</tt>
459
+ </TD>
460
+ <TD VAlign=top>
461
+ <tt>Unordered Associative Container</tt> (tr1)
462
+ </TD>
463
+ <TD VAlign=top>
464
+ Returns a <tt>local_iterator</tt> pointing to the end of bucket
465
+ <tt>i</tt> in the <tt>dense_hash_set</tt>. For
466
+ <tt>dense_hash_set</tt>, each bucket contains either 0 or 1 item.
467
+ </TD>
468
+ </TR>
469
+
470
+ <TR>
471
+ <TD VAlign=top>
472
+ <tt>const_local_iterator begin(size_type i) const</tt>
473
+ </TD>
474
+ <TD VAlign=top>
475
+ <tt>Unordered Associative Container</tt> (tr1)
476
+ </TD>
477
+ <TD VAlign=top>
478
+ Returns a <tt>const_local_iterator</tt> pointing to the beginning of bucket
479
+ <tt>i</tt> in the <tt>dense_hash_set</tt>.
480
+ </TD>
481
+ </TR>
482
+
483
+ <TR>
484
+ <TD VAlign=top>
485
+ <tt>const_local_iterator end(size_type i) const</tt>
486
+ </TD>
487
+ <TD VAlign=top>
488
+ <tt>Unordered Associative Container</tt> (tr1)
489
+ </TD>
490
+ <TD VAlign=top>
491
+ Returns a <tt>const_local_iterator</tt> pointing to the end of bucket
492
+ <tt>i</tt> in the <tt>dense_hash_set</tt>. For
493
+ <tt>dense_hash_set</tt>, each bucket contains either 0 or 1 item.
494
+ </TD>
495
+ </TR>
496
+
497
+ <TR>
498
+ <TD VAlign=top>
499
+ <tt>size_type size() const</tt>
500
+ </TD>
501
+ <TD VAlign=top>
502
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
503
+ </TD>
504
+ <TD VAlign=top>
505
+ Returns the size of the <tt>dense_hash_set</tt>.
506
+ </TD>
507
+ </TR>
508
+
509
+ <TR>
510
+ <TD VAlign=top>
511
+ <tt>size_type max_size() const</tt>
512
+ </TD>
513
+ <TD VAlign=top>
514
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
515
+ </TD>
516
+ <TD VAlign=top>
517
+ Returns the largest possible size of the <tt>dense_hash_set</tt>.
518
+ </TD>
519
+ </TR>
520
+
521
+ <TR>
522
+ <TD VAlign=top>
523
+ <tt>bool empty() const</tt>
524
+ </TD>
525
+ <TD VAlign=top>
526
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
527
+ </TD>
528
+ <TD VAlign=top>
529
+ <tt>true</tt> if the <tt>dense_hash_set</tt>'s size is <tt>0</tt>.
530
+ </TD>
531
+ </TR>
532
+
533
+ <TR>
534
+ <TD VAlign=top>
535
+ <tt>size_type bucket_count() const</tt>
536
+ </TD>
537
+ <TD VAlign=top>
538
+ <A
539
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
540
+ Associative Container</A>
541
+ </TD>
542
+ <TD VAlign=top>
543
+ Returns the number of buckets used by the <tt>dense_hash_set</tt>.
544
+ </TD>
545
+ </TR>
546
+
547
+ <TR>
548
+ <TD VAlign=top>
549
+ <tt>size_type max_bucket_count() const</tt>
550
+ </TD>
551
+ <TD VAlign=top>
552
+ <A
553
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
554
+ Associative Container</A>
555
+ </TD>
556
+ <TD VAlign=top>
557
+ Returns the largest possible number of buckets used by the <tt>dense_hash_set</tt>.
558
+ </TD>
559
+ </TR>
560
+
561
+ <TR>
562
+ <TD VAlign=top>
563
+ <tt>size_type bucket_size(size_type i) const</tt>
564
+ </TD>
565
+ <TD VAlign=top>
566
+ <tt>Unordered Associative Container</tt> (tr1)
567
+ </TD>
568
+ <TD VAlign=top>
569
+ Returns the number of elements in bucket <tt>i</tt>. For
570
+ <tt>dense_hash_set</tt>, this will be either 0 or 1.
571
+ </TD>
572
+ </TR>
573
+
574
+ <TR>
575
+ <TD VAlign=top>
576
+ <tt>size_type bucket(const key_type& key) const</tt>
577
+ </TD>
578
+ <TD VAlign=top>
579
+ <tt>Unordered Associative Container</tt> (tr1)
580
+ </TD>
581
+ <TD VAlign=top>
582
+ If the key exists in the map, returns the index of the bucket
583
+ containing the given key, otherwise, return the bucket the key
584
+ would be inserted into.
585
+ This value may be passed to <tt>begin(size_type)</tt> and
586
+ <tt>end(size_type)</tt>.
587
+ </TD>
588
+ </TR>
589
+
590
+ <TR>
591
+ <TD VAlign=top>
592
+ <tt>float load_factor() const</tt>
593
+ </TD>
594
+ <TD VAlign=top>
595
+ <tt>Unordered Associative Container</tt> (tr1)
596
+ </TD>
597
+ <TD VAlign=top>
598
+ The number of elements in the <tt>dense_hash_set</tt> divided by
599
+ the number of buckets.
600
+ </TD>
601
+ </TR>
602
+
603
+ <TR>
604
+ <TD VAlign=top>
605
+ <tt>float max_load_factor() const</tt>
606
+ </TD>
607
+ <TD VAlign=top>
608
+ <tt>Unordered Associative Container</tt> (tr1)
609
+ </TD>
610
+ <TD VAlign=top>
611
+ The maximum load factor before increasing the number of buckets in
612
+ the <tt>dense_hash_set</tt>.
613
+ </TD>
614
+ </TR>
615
+
616
+ <TR>
617
+ <TD VAlign=top>
618
+ <tt>float max_load_factor(size_t new_grow)</tt>
619
+ </TD>
620
+ <TD VAlign=top>
621
+ <tt>Unordered Associative Container</tt> (tr1)
622
+ </TD>
623
+ <TD VAlign=top>
624
+ Sets the maximum load factor before increasing the number of
625
+ buckets in the <tt>dense_hash_set</tt>.
626
+ </TD>
627
+ </TR>
628
+
629
+ <TR>
630
+ <TD VAlign=top>
631
+ <tt>float min_load_factor() const</tt>
632
+ </TD>
633
+ <TD VAlign=top>
634
+ <tt>dense_hash_set</tt>
635
+ </TD>
636
+ <TD VAlign=top>
637
+ The minimum load factor before decreasing the number of buckets in
638
+ the <tt>dense_hash_set</tt>.
639
+ </TD>
640
+ </TR>
641
+
642
+ <TR>
643
+ <TD VAlign=top>
644
+ <tt>float min_load_factor(size_t new_grow)</tt>
645
+ </TD>
646
+ <TD VAlign=top>
647
+ <tt>dense_hash_set</tt>
648
+ </TD>
649
+ <TD VAlign=top>
650
+ Sets the minimum load factor before decreasing the number of
651
+ buckets in the <tt>dense_hash_set</tt>.
652
+ </TD>
653
+ </TR>
654
+
655
+ <TR>
656
+ <TD VAlign=top>
657
+ <tt>void set_resizing_parameters(float shrink, float grow)</tt>
658
+ </TD>
659
+ <TD VAlign=top>
660
+ <tt>dense_hash_set</tt>
661
+ </TD>
662
+ <TD VAlign=top>
663
+ DEPRECATED. <A HREF="#new">See below</A>.
664
+ </TD>
665
+ </TR>
666
+
667
+ <TR>
668
+ <TD VAlign=top>
669
+ <tt>void resize(size_type n)</tt>
670
+ </TD>
671
+ <TD VAlign=top>
672
+ <A
673
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
674
+ Associative Container</A>
675
+ </TD>
676
+ <TD VAlign=top>
677
+ Increases the bucket count to hold at least <tt>n</tt> items.
678
+ <A href="#2">[2]</A> <A href="#3">[3]</A>
679
+ </TD>
680
+ </TR>
681
+
682
+ <TR>
683
+ <TD VAlign=top>
684
+ <tt>void rehash(size_type n)</tt>
685
+ </TD>
686
+ <TD VAlign=top>
687
+ <tt>Unordered Associative Container</tt> (tr1)
688
+ </TD>
689
+ <TD VAlign=top>
690
+ Increases the bucket count to hold at least <tt>n</tt> items.
691
+ This is identical to <tt>resize</tt>.
692
+ <A href="#2">[2]</A> <A href="#3">[3]</A>
693
+ </TD>
694
+ </TR>
695
+
696
+ <TR>
697
+ <TD VAlign=top>
698
+ <tt>hasher hash_funct() const</tt>
699
+ </TD>
700
+ <TD VAlign=top>
701
+ <A
702
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
703
+ Associative Container</A>
704
+ </TD>
705
+ <TD VAlign=top>
706
+ Returns the <tt>hasher</tt> object used by the <tt>dense_hash_set</tt>.
707
+ </TD>
708
+ </TR>
709
+
710
+ <TR>
711
+ <TD VAlign=top>
712
+ <tt>hasher hash_function() const</tt>
713
+ </TD>
714
+ <TD VAlign=top>
715
+ <tt>Unordered Associative Container</tt> (tr1)
716
+ </TD>
717
+ <TD VAlign=top>
718
+ Returns the <tt>hasher</tt> object used by the <tt>dense_hash_set</tt>.
719
+ This is idential to <tt>hash_funct</tt>.
720
+ </TD>
721
+ </TR>
722
+
723
+ <TR>
724
+ <TD VAlign=top>
725
+ <tt>key_equal key_eq() const</tt>
726
+ </TD>
727
+ <TD VAlign=top>
728
+ <A
729
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
730
+ Associative Container</A>
731
+ </TD>
732
+ <TD VAlign=top>
733
+ Returns the <tt>key_equal</tt> object used by the
734
+ <tt>dense_hash_set</tt>.
735
+ </TD>
736
+ </TR>
737
+
738
+ <TR>
739
+ <TD VAlign=top>
740
+ <tt>dense_hash_set()</tt>
741
+ </TD>
742
+ <TD VAlign=top>
743
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
744
+ </TD>
745
+ <TD VAlign=top>
746
+ Creates an empty <tt>dense_hash_set</tt>.
747
+ </TD>
748
+ </TR>
749
+
750
+ <TR>
751
+ <TD VAlign=top>
752
+ <tt>dense_hash_set(size_type n)</tt>
753
+ </TD>
754
+ <TD VAlign=top>
755
+ <A
756
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
757
+ Associative Container</A>
758
+ </TD>
759
+ <TD VAlign=top>
760
+ Creates an empty <tt>dense_hash_set</tt> that's optimized for holding
761
+ up to <tt>n</tt> items.
762
+ <A href="#3">[3]</A>
763
+ </TD>
764
+ </TR>
765
+
766
+ <TR>
767
+ <TD VAlign=top>
768
+ <tt>dense_hash_set(size_type n, const hasher&amp; h)</tt>
769
+ </TD>
770
+ <TD VAlign=top>
771
+ <A
772
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
773
+ Associative Container</A>
774
+ </TD>
775
+ <TD VAlign=top>
776
+ Creates an empty <tt>dense_hash_set</tt> that's optimized for up
777
+ to <tt>n</tt> items, using <tt>h</tt> as the hash function.
778
+ </TD>
779
+ </TR>
780
+
781
+ <TR>
782
+ <TD VAlign=top>
783
+ <tt>dense_hash_set(size_type n, const hasher&amp; h, const
784
+ key_equal&amp; k)</tt>
785
+ </TD>
786
+ <TD VAlign=top>
787
+ <A
788
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
789
+ Associative Container</A>
790
+ </TD>
791
+ <TD VAlign=top>
792
+ Creates an empty <tt>dense_hash_set</tt> that's optimized for up
793
+ to <tt>n</tt> items, using <tt>h</tt> as the hash function and
794
+ <tt>k</tt> as the key equal function.
795
+ </TD>
796
+ </TR>
797
+
798
+ <TR>
799
+ <TD VAlign=top>
800
+ <pre>template &lt;class <A
801
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
802
+ dense_hash_set(InputIterator f, InputIterator l) </pre>
803
+ <A href="#1">[2]</A>
804
+ </TD>
805
+ <TD VAlign=top>
806
+ <A
807
+ href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique
808
+ Hashed Associative Container</A>
809
+ </TD>
810
+ <TD VAlign=top>
811
+ Creates a dense_hash_set with a copy of a range.
812
+ </TD>
813
+ </TR>
814
+
815
+ <TR>
816
+ <TD VAlign=top>
817
+ <pre>template &lt;class <A
818
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
819
+ dense_hash_set(InputIterator f, InputIterator l, size_type n) </pre>
820
+ <A href="#1">[2]</A>
821
+ </TD>
822
+ <TD VAlign=top>
823
+ <A
824
+ href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique
825
+ Hashed Associative Container</A>
826
+ </TD>
827
+ <TD VAlign=top>
828
+ Creates a hash_set with a copy of a range that's optimized to
829
+ hold up to <tt>n</tt> items.
830
+ </TD>
831
+ </TR>
832
+
833
+ <TR>
834
+ <TD VAlign=top>
835
+ <pre>template &lt;class <A
836
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
837
+ dense_hash_set(InputIterator f, InputIterator l, size_type n, const
838
+ hasher&amp; h) </pre> <A href="#1">[2]</A>
839
+ </TD>
840
+ <TD VAlign=top>
841
+ <A
842
+ href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique
843
+ Hashed Associative Container</A>
844
+ </TD>
845
+ <TD VAlign=top>
846
+ Creates a hash_set with a copy of a range that's optimized to hold
847
+ up to <tt>n</tt> items, using <tt>h</tt> as the hash function.
848
+ </TD>
849
+ </TR>
850
+
851
+ <TR>
852
+ <TD VAlign=top>
853
+ <pre>template &lt;class <A
854
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
855
+ dense_hash_set(InputIterator f, InputIterator l, size_type n, const
856
+ hasher&amp; h, const key_equal&amp; k) </pre> <A href="#1">[2]</A>
857
+ </TD>
858
+ <TD VAlign=top>
859
+ <A
860
+ href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique
861
+ Hashed Associative Container</A>
862
+ </TD>
863
+ <TD VAlign=top>
864
+ Creates a hash_set with a copy of a range that's optimized for
865
+ holding up to <tt>n</tt> items, using <tt>h</tt> as the hash
866
+ function and <tt>k</tt> as the key equal function.
867
+ </TD>
868
+ </TR>
869
+
870
+ <TR>
871
+ <TD VAlign=top>
872
+ <tt>dense_hash_set(const hash_set&amp;)</tt>
873
+ </TD>
874
+ <TD VAlign=top>
875
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
876
+ </TD>
877
+ <TD VAlign=top>
878
+ The copy constructor.
879
+ </TD>
880
+ </TR>
881
+
882
+ <TR>
883
+ <TD VAlign=top>
884
+ <tt>dense_hash_set&amp; operator=(const hash_set&amp;)</tt>
885
+ </TD>
886
+ <TD VAlign=top>
887
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
888
+ </TD>
889
+ <TD VAlign=top>
890
+ The assignment operator
891
+ </TD>
892
+ </TR>
893
+
894
+ <TR>
895
+ <TD VAlign=top>
896
+ <tt>void swap(hash_set&amp;)</tt>
897
+ </TD>
898
+ <TD VAlign=top>
899
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
900
+ </TD>
901
+ <TD VAlign=top>
902
+ Swaps the contents of two hash_sets.
903
+ </TD>
904
+ </TR>
905
+
906
+ <TR>
907
+ <TD VAlign=top>
908
+ <pre>pair&lt;iterator, bool&gt; insert(const value_type&amp; x)
909
+ </pre>
910
+ </TD>
911
+ <TD VAlign=top>
912
+ <A
913
+ href="http://www.sgi.com/tech/stl/UniqueAssociativeContainer.html">Unique
914
+ Associative Container</A>
915
+ </TD>
916
+ <TD VAlign=top>
917
+ Inserts <tt>x</tt> into the <tt>dense_hash_set</tt>.
918
+ </TD>
919
+ </TR>
920
+
921
+ <TR>
922
+ <TD VAlign=top>
923
+ <pre>template &lt;class <A
924
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
925
+ void insert(InputIterator f, InputIterator l) </pre> <A href="#1">[2]</A>
926
+ </TD>
927
+ <TD VAlign=top>
928
+ <A
929
+ href="http://www.sgi.com/tech/stl/UniqueAssociativeContainer.html">Unique
930
+ Associative Container</A>
931
+ </TD>
932
+ <TD VAlign=top>
933
+ Inserts a range into the <tt>dense_hash_set</tt>.
934
+ </TD>
935
+ </TR>
936
+
937
+ <TR>
938
+ <TD VAlign=top>
939
+ <tt>void set_empty_key(const key_type& key)</tt> <A href="#4">[4]</A>
940
+ </TD>
941
+ <TD VAlign=top>
942
+ <tt>dense_hash_set</tt>
943
+ </TD>
944
+ <TD VAlign=top>
945
+ <A HREF="#new">See below</A>.
946
+ </TD>
947
+ </TR>
948
+
949
+ <TR>
950
+ <TD VAlign=top>
951
+ <tt>void set_deleted_key(const key_type& key)</tt> <A href="#4">[4]</A>
952
+ </TD>
953
+ <TD VAlign=top>
954
+ <tt>dense_hash_set</tt>
955
+ </TD>
956
+ <TD VAlign=top>
957
+ <A HREF="#new">See below</A>.
958
+ </TD>
959
+ </TR>
960
+
961
+ <TR>
962
+ <TD VAlign=top>
963
+ <tt>void clear_deleted_key()</tt> <A href="#4">[4]</A>
964
+ </TD>
965
+ <TD VAlign=top>
966
+ <tt>dense_hash_set</tt>
967
+ </TD>
968
+ <TD VAlign=top>
969
+ <A HREF="#new">See below</A>.
970
+ </TD>
971
+ </TR>
972
+
973
+ <TR>
974
+ <TD VAlign=top>
975
+ <tt>void erase(iterator pos)</tt>
976
+ </TD>
977
+ <TD VAlign=top>
978
+ <A
979
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
980
+ Container</A>
981
+ </TD>
982
+ <TD VAlign=top>
983
+ Erases the element pointed to by <tt>pos</tt>.
984
+ <A href="#4">[4]</A>
985
+ </TD>
986
+ </TR>
987
+
988
+ <TR>
989
+ <TD VAlign=top>
990
+ <tt>size_type erase(const key_type&amp; k)</tt>
991
+ </TD>
992
+ <TD VAlign=top>
993
+ <A
994
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
995
+ Container</A>
996
+ </TD>
997
+ <TD VAlign=top>
998
+ Erases the element whose key is <tt>k</tt>.
999
+ <A href="#4">[4]</A>
1000
+ </TD>
1001
+ </TR>
1002
+
1003
+ <TR>
1004
+ <TD VAlign=top>
1005
+ <tt>void erase(iterator first, iterator last)</tt>
1006
+ </TD>
1007
+ <TD VAlign=top>
1008
+ <A
1009
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
1010
+ Container</A>
1011
+ </TD>
1012
+ <TD VAlign=top>
1013
+ Erases all elements in a range.
1014
+ <A href="#4">[4]</A>
1015
+ </TD>
1016
+ </TR>
1017
+
1018
+ <TR>
1019
+ <TD VAlign=top>
1020
+ <tt>void clear()</tt>
1021
+ </TD>
1022
+ <TD VAlign=top>
1023
+ <A
1024
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
1025
+ Container</A>
1026
+ </TD>
1027
+ <TD VAlign=top>
1028
+ Erases all of the elements.
1029
+ </TD>
1030
+ </TR>
1031
+
1032
+ <TR>
1033
+ <TD VAlign=top>
1034
+ <tt>void clear_no_resize()</tt>
1035
+ </TD>
1036
+ <TD VAlign=top>
1037
+ <tt>dense_hash_map</tt>
1038
+ </TD>
1039
+ <TD VAlign=top>
1040
+ <A HREF="#new">See below</A>.
1041
+ </TD>
1042
+ </TR>
1043
+
1044
+ <TR>
1045
+ <TD VAlign=top>
1046
+ <tt>iterator find(const key_type&amp; k) const</tt>
1047
+ </TD>
1048
+ <TD VAlign=top>
1049
+ <A
1050
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
1051
+ Container</A>
1052
+ </TD>
1053
+ <TD VAlign=top>
1054
+ Finds an element whose key is <tt>k</tt>.
1055
+ </TD>
1056
+ </TR>
1057
+
1058
+ <TR>
1059
+ <TD VAlign=top>
1060
+ <tt>size_type count(const key_type&amp; k) const</tt>
1061
+ </TD>
1062
+ <TD VAlign=top>
1063
+ <A
1064
+ href="http://www.sgi.com/tech/stl/UniqueAssociativeContainer.html">Unique
1065
+ Associative Container</A>
1066
+ </TD>
1067
+ <TD VAlign=top>
1068
+ Counts the number of elements whose key is <tt>k</tt>.
1069
+ </TD>
1070
+ </TR>
1071
+
1072
+ <TR>
1073
+ <TD VAlign=top>
1074
+ <pre>pair&lt;iterator, iterator&gt; equal_range(const
1075
+ key_type&amp; k) const</pre>
1076
+ </TD>
1077
+ <TD VAlign=top>
1078
+ <A
1079
+ href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative
1080
+ Container</A>
1081
+ </TD>
1082
+ <TD VAlign=top>
1083
+ Finds a range containing all elements whose key is <tt>k</tt>.
1084
+ </TD>
1085
+ </TR>
1086
+
1087
+ <TR>
1088
+ <TD VAlign=top>
1089
+ <tt>bool write_metadata(FILE *fp)</tt>
1090
+ </TD>
1091
+ <TD VAlign=top>
1092
+ <tt>dense_hash_set</tt>
1093
+ </TD>
1094
+ <TD VAlign=top>
1095
+ <A HREF="#new">See below</A>.
1096
+ </TD>
1097
+ </TR>
1098
+
1099
+ <TR>
1100
+ <TD VAlign=top>
1101
+ <tt>bool read_metadata(FILE *fp)</tt>
1102
+ </TD>
1103
+ <TD VAlign=top>
1104
+ <tt>dense_hash_set</tt>
1105
+ </TD>
1106
+ <TD VAlign=top>
1107
+ <A HREF="#new">See below</A>.
1108
+ </TD>
1109
+ </TR>
1110
+
1111
+ <TR>
1112
+ <TD VAlign=top>
1113
+ <tt>bool write_nopointer_data(FILE *fp)</tt>
1114
+ </TD>
1115
+ <TD VAlign=top>
1116
+ <tt>dense_hash_set</tt>
1117
+ </TD>
1118
+ <TD VAlign=top>
1119
+ <A HREF="#new">See below</A>.
1120
+ </TD>
1121
+ </TR>
1122
+
1123
+ <TR>
1124
+ <TD VAlign=top>
1125
+ <tt>bool read_nopointer_data(FILE *fp)</tt>
1126
+ </TD>
1127
+ <TD VAlign=top>
1128
+ <tt>dense_hash_set</tt>
1129
+ </TD>
1130
+ <TD VAlign=top>
1131
+ <A HREF="#new">See below</A>.
1132
+ </TD>
1133
+ </TR>
1134
+
1135
+ <TR>
1136
+ <TD VAlign=top>
1137
+ <pre>bool operator==(const hash_set&amp;, const hash_set&amp;)
1138
+ </pre>
1139
+ </TD>
1140
+ <TD VAlign=top>
1141
+ <A
1142
+ href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed
1143
+ Associative Container</A>
1144
+ </TD>
1145
+ <TD VAlign=top>
1146
+ Tests two hash_sets for equality. This is a global function, not a
1147
+ member function.
1148
+ </TD>
1149
+ </TR>
1150
+
1151
+ </table>
1152
+
1153
+
1154
+ <h3><A NAME="new">New members</A></h3>
1155
+
1156
+ These members are not defined in the <A
1157
+ href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique
1158
+ Hashed Associative Container</A>, <A
1159
+ href="http://www.sgi.com/tech/stl/SimpleAssociativeContainer.html">Simple
1160
+ Associative Container</A>, or tr1's <tt>Unordered Associative
1161
+ Container</tt> requirements, but are specific to
1162
+ <tt>dense_hash_set</tt>.
1163
+
1164
+ <table border>
1165
+ <TR><TH>Member</TH><TH>Description</TH></TR>
1166
+
1167
+ <TR>
1168
+ <TD VAlign=top>
1169
+ <tt>void set_empty_key(const key_type& key)</tt>
1170
+ </TD>
1171
+ <TD VAlign=top>
1172
+ Sets the distinguished "empty" key to <tt>key</tt>. This must be
1173
+ called immediately after construct time, before calls to another
1174
+ other <tt>dense_hash_set</tt> operation. <A href="#4">[4]</A>
1175
+ </TD>
1176
+ </TR>
1177
+
1178
+ <TR>
1179
+ <TD VAlign=top>
1180
+ <tt>void set_deleted_key(const key_type& key)</tt>
1181
+ </TD>
1182
+ <TD VAlign=top>
1183
+ Sets the distinguished "deleted" key to <tt>key</tt>. This must be
1184
+ called before any calls to <tt>erase()</tt>. <A href="#4">[4]</A>
1185
+ </TD>
1186
+ </TR>
1187
+
1188
+ <TR>
1189
+ <TD VAlign=top>
1190
+ <tt>void clear_deleted_key()</tt>
1191
+ </TD>
1192
+ <TD VAlign=top>
1193
+ Clears the distinguished "deleted" key. After this is called,
1194
+ calls to <tt>erase()</tt> are not valid on this object.
1195
+ <A href="#4">[4]</A>
1196
+ </TD>
1197
+ </TR>
1198
+
1199
+ <TR>
1200
+ <TD VAlign=top>
1201
+ <tt>void clear_no_resize()</tt>
1202
+ </TD>
1203
+ <TD VAlign=top>
1204
+ Clears the hashtable like <tt>clear()</tt> does, but does not
1205
+ recover the memory used for hashtable buckets. (The memory
1206
+ used by the <i>items</i> in the hashtable is still recovered.)
1207
+ This can save time for applications that want to reuse a
1208
+ <tt>dense_hash_set</tt> many times, each time with a similar number
1209
+ of objects.
1210
+ </TD>
1211
+ </TR>
1212
+
1213
+ <TD VAlign=top>
1214
+ <tt>void set_resizing_parameters(float shrink, float grow)</tt>
1215
+ </TD>
1216
+ <TD VAlign=top>
1217
+ This function is DEPRECATED. It is equivalent to calling
1218
+ <tt>min_load_factor(shrink); max_load_factor(grow)</tt>.
1219
+ </TD>
1220
+ </TR>
1221
+
1222
+ <TR>
1223
+ <TD VAlign=top>
1224
+ <tt>bool write_metadata(FILE *fp)</tt>
1225
+ </TD>
1226
+ <TD VAlign=top>
1227
+ Write hashtable metadata to <tt>fp</tt>. See <A HREF="#io">below</A>.
1228
+ </TD>
1229
+ </TR>
1230
+
1231
+ <TR>
1232
+ <TD VAlign=top>
1233
+ <tt>bool read_metadata(FILE *fp)</tt>
1234
+ </TD>
1235
+ <TD VAlign=top>
1236
+ Read hashtable metadata from <tt>fp</tt>. See <A HREF="#io">below</A>.
1237
+ </TD>
1238
+ </TR>
1239
+
1240
+ <TR>
1241
+ <TD VAlign=top>
1242
+ <tt>bool write_nopointer_data(FILE *fp)</tt>
1243
+ </TD>
1244
+ <TD VAlign=top>
1245
+ Write hashtable contents to <tt>fp</tt>. This is valid only if the
1246
+ hashtable key and value are "plain" data. See <A HREF="#io">below</A>.
1247
+ </TD>
1248
+ </TR>
1249
+
1250
+ <TR>
1251
+ <TD VAlign=top>
1252
+ <tt>bool read_nopointer_data(FILE *fp)</tt>
1253
+ </TD>
1254
+ <TD VAlign=top>
1255
+ Read hashtable contents to <tt>fp</tt>. This is valid only if the
1256
+ hashtable key and value are "plain" data. See <A HREF="#io">below</A>.
1257
+ </TD>
1258
+ </TR>
1259
+
1260
+ </table>
1261
+
1262
+
1263
+ <h3>Notes</h3>
1264
+
1265
+ <P><A name="1">[1]</A>
1266
+
1267
+ This member function relies on <i>member template</i> functions, which
1268
+ may not be supported by all compilers. If your compiler supports
1269
+ member templates, you can call this function with any type of <A
1270
+ href="http://www.sgi.com/tech/stl/InputIterator.html">input
1271
+ iterator</A>. If your compiler does not yet support member templates,
1272
+ though, then the arguments must either be of type <tt>const
1273
+ value_type*</tt> or of type <tt>dense_hash_set::const_iterator</tt>.</p>
1274
+
1275
+ <P><A name="2">[2]</A>
1276
+
1277
+ In order to preserve iterators, erasing hashtable elements does not
1278
+ cause a hashtable to resize. This means that after a string of
1279
+ <tt>erase()</tt> calls, the hashtable will use more space than is
1280
+ required. At a cost of invalidating all current iterators, you can
1281
+ call <tt>resize()</tt> to manually compact the hashtable. The
1282
+ hashtable promotes too-small <tt>resize()</tt> arguments to the
1283
+ smallest legal value, so to compact a hashtable, it's sufficient to
1284
+ call <tt>resize(0)</tt>.
1285
+
1286
+ <P><A name="3">[3]</A>
1287
+
1288
+ Unlike some other hashtable implementations, the optional <i>n</i> in
1289
+ the calls to the constructor, <tt>resize</tt>, and <tt>rehash</tt>
1290
+ indicates not the desired number of buckets that
1291
+ should be allocated, but instead the expected number of items to be
1292
+ inserted. The class then sizes the hash-set appropriately for the
1293
+ number of items specified. It's not an error to actually insert more
1294
+ or fewer items into the hashtable, but the implementation is most
1295
+ efficient -- does the fewest hashtable resizes -- if the number of
1296
+ inserted items is <i>n</i> or slightly less.</p>
1297
+
1298
+ <P><A name="4">[4]</A>
1299
+
1300
+ <tt>dense_hash_set</tt> <b>requires</b> you call
1301
+ <tt>set_empty_key()</tt> immediately after constructing the hash-set,
1302
+ and before calling any other <tt>dense_hash_set</tt> method. (This is
1303
+ the largest difference between the <tt>dense_hash_set</tt> API and
1304
+ other hash-set APIs. See <A HREF="implementation.html">implementation.html</A>
1305
+ for why this is necessary.)
1306
+ The argument to <tt>set_empty_key()</tt> should be a key-value that
1307
+ is never used for legitimate hash-set entries. If you have no such
1308
+ key value, you will be unable to use <tt>dense_hash_set</tt>. It is
1309
+ an error to call <tt>insert()</tt> with an item whose key is the
1310
+ "empty key."</p>
1311
+
1312
+ <tt>dense_hash_set</tt> also requires you call
1313
+ <tt>set_deleted_key()</tt> before calling <tt>erase()</tt>.
1314
+ The argument to <tt>set_deleted_key()</tt> should be a key-value that
1315
+ is never used for legitimate hash-set entries. It must be different
1316
+ from the key-value used for <tt>set_empty_key()</tt>. It is an error to call
1317
+ <tt>erase()</tt> without first calling <tt>set_deleted_key()</tt>, and
1318
+ it is also an error to call <tt>insert()</tt> with an item whose key
1319
+ is the "deleted key."</p>
1320
+
1321
+ <p>There is no need to call <tt>set_deleted_key</tt> if you do not
1322
+ wish to call <tt>erase()</tt> on the hash-set.</p>
1323
+
1324
+ <p>It is acceptable to change the deleted-key at any time by calling
1325
+ <tt>set_deleted_key()</tt> with a new argument. You can also call
1326
+ <tt>clear_deleted_key()</tt>, at which point all keys become valid for
1327
+ insertion but no hashtable entries can be deleted until
1328
+ <tt>set_deleted_key()</tt> is called again.</p>
1329
+
1330
+
1331
+ <h3><A NAME=io>Input/Output</A></h3>
1332
+
1333
+ <table border=1 cellpadding=5><tr><td>
1334
+ <p><b>IMPORTANT IMPLEMENTATION NOTE:</b> In the current version of
1335
+ this code, the input/output routines for <tt>dense_hash_set</tt> have
1336
+ <b>not yet been implemented</b>. This section explains the API, but
1337
+ note that all calls to these routines will fail (return
1338
+ <tt>false</tt>). It is a TODO to remedy this situation.</p>
1339
+ </td></tr></table>
1340
+
1341
+ <p>It is possible to save and restore <tt>dense_hash_set</tt> objects
1342
+ to disk. Storage takes place in two steps. The first writes the
1343
+ hashtable metadata. The second writes the actual data.</p>
1344
+
1345
+ <p>To write a hashtable to disk, first call <tt>write_metadata()</tt>
1346
+ on an open file pointer. This saves the hashtable information in a
1347
+ byte-order-independent format.</p>
1348
+
1349
+ <p>After the metadata has been written to disk, you must write the
1350
+ actual data stored in the hash-set to disk. If both the key and data
1351
+ are "simple" enough, you can do this by calling
1352
+ <tt>write_nopointer_data()</tt>. "Simple" data is data that can be
1353
+ safely copied to disk via <tt>fwrite()</tt>. Native C data types fall
1354
+ into this category, as do structs of native C data types. Pointers
1355
+ and STL objects do not.</p>
1356
+
1357
+ <p>Note that <tt>write_nopointer_data()</tt> does not do any endian
1358
+ conversion. Thus, it is only appropriate when you intend to read the
1359
+ data on the same endian architecture as you write the data.</p>
1360
+
1361
+ <p>If you cannot use <tt>write_nopointer_data()</tt> for any reason,
1362
+ you can write the data yourself by iterating over the
1363
+ <tt>dense_hash_set</tt> with a <tt>const_iterator</tt> and writing
1364
+ the key and data in any manner you wish.</p>
1365
+
1366
+ <p>To read the hashtable information from disk, first you must create
1367
+ a <tt>dense_hash_set</tt> object. Then open a file pointer to point
1368
+ to the saved hashtable, and call <tt>read_metadata()</tt>. If you
1369
+ saved the data via <tt>write_nopointer_data()</tt>, you can follow the
1370
+ <tt>read_metadata()</tt> call with a call to
1371
+ <tt>read_nopointer_data()</tt>. This is all that is needed.</p>
1372
+
1373
+ <p>If you saved the data through a custom write routine, you must call
1374
+ a custom read routine to read in the data. To do this, iterate over
1375
+ the <tt>dense_hash_set</tt> with an <tt>iterator</tt>; this operation
1376
+ is sensical because the metadata has already been set up. For each
1377
+ iterator item, you can read the key and value from disk, and set it
1378
+ appropriately. You will need to do a <tt>const_cast</tt> on the
1379
+ iterator, since <tt>*it</tt> is always <tt>const</tt>. The
1380
+ code might look like this:</p>
1381
+ <pre>
1382
+ for (dense_hash_set&lt;int*&gt;::iterator it = ht.begin();
1383
+ it != ht.end(); ++it) {
1384
+ const_cast&lt;int*&gt;(*it) = new int;
1385
+ fread(const_cast&lt;int*&gt;(*it), sizeof(int), 1, fp);
1386
+ }
1387
+ </pre>
1388
+
1389
+ <p>Here's another example, where the item stored in the hash-set is
1390
+ a C++ object with a non-trivial constructor. In this case, you must
1391
+ use "placement new" to construct the object at the correct memory
1392
+ location.</p>
1393
+ <pre>
1394
+ for (dense_hash_set&lt;ComplicatedClass&gt;::iterator it = ht.begin();
1395
+ it != ht.end(); ++it) {
1396
+ int ctor_arg; // ComplicatedClass takes an int as its constructor arg
1397
+ fread(&ctor_arg, sizeof(int), 1, fp);
1398
+ new (const_cast&lt;ComplicatedClass*&gt;(&(*it))) ComplicatedClass(ctor_arg);
1399
+ }
1400
+ </pre>
1401
+
1402
+
1403
+ <h3><A NAME=iter>Validity of Iterators</A></h3>
1404
+
1405
+ <p><tt>erase()</tt> is guaranteed not to invalidate any iterators --
1406
+ except for any iterators pointing to the item being erased, of course.
1407
+ <tt>insert()</tt> invalidates all iterators, as does
1408
+ <tt>resize()</tt>. </p>
1409
+
1410
+ <p>This is implemented by making <tt>erase()</tt> not resize the
1411
+ hashtable. If you desire maximum space efficiency, you can call
1412
+ <tt>resize(0)</tt> after a string of <tt>erase()</tt> calls, to force
1413
+ the hashtable to resize to the smallest possible size.</p>
1414
+
1415
+ <p>In addition to invalidating iterators, <tt>insert()</tt>
1416
+ and <tt>resize()</tt> invalidate all pointers into the hashtable. If
1417
+ you want to store a pointer to an object held in a dense_hash_set,
1418
+ either do so after finishing hashtable inserts, or store the object on
1419
+ the heap and a pointer to it in the dense_hash_set.</p>
1420
+
1421
+
1422
+
1423
+ <h3>See also</h3>
1424
+
1425
+ <p>The following are SGI STL, and some Google STL, concepts and
1426
+ classes related to <tt>dense_hash_set</tt>.</p>
1427
+
1428
+ <tt><A href="http://www.sgi.com/tech/stl/hash_set.html">hash_set</A></tt>,
1429
+ <A href="http://www.sgi.com/tech/stl/AssociativeContainer.html">Associative Container</A>,
1430
+ <A href="http://www.sgi.com/tech/stl/HashedAssociativeContainer.html">Hashed Associative Container</A>,
1431
+ <A href="http://www.sgi.com/tech/stl/SimpleAssociativeContainer.html">Simple Associative Container</A>,
1432
+ <A href="http://www.sgi.com/tech/stl/UniqueHashedAssociativeContainer.html">Unique Hashed Associative Container</A>,
1433
+ <tt><A href="http://www.sgi.com/tech/stl/set.html">set</A></tt>,
1434
+ <tt><A href="http://www.sgi.com/tech/stl/Map.html">map</A></tt>
1435
+ <tt><A href="http://www.sgi.com/tech/stl/multiset.html">multiset</A></tt>,
1436
+ <tt><A href="http://www.sgi.com/tech/stl/Multimap.html">multimap</A></tt>,
1437
+ <tt><A href="http://www.sgi.com/tech/stl/hash_map.html">hash_map</A></tt>,
1438
+ <tt><A href="http://www.sgi.com/tech/stl/hash_multiset.html">hash_multiset</A></tt>,
1439
+ <tt><A href="http://www.sgi.com/tech/stl/hash_multimap.html">hash_multimap</A></tt>,
1440
+ <tt><A href="sparse_hash_set.html">sparse_hash_set</A></tt>,
1441
+ <tt><A href="sparse_hash_map.html">sparse_hash_map</A></tt>,
1442
+ <tt><A href="dense_hash_map.html">dense_hash_map</A></tt>
1443
+
1444
+ </BODY>
1445
+ </HTML>