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