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,1393 @@
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
+ -->
5
+ <!--
6
+ -- Copyright (c) 1996-1999
7
+ -- Silicon Graphics Computer Systems, Inc.
8
+ --
9
+ -- Permission to use, copy, modify, distribute and sell this software
10
+ -- and its documentation for any purpose is hereby granted without fee,
11
+ -- provided that the above copyright notice appears in all copies and
12
+ -- that both that copyright notice and this permission notice appear
13
+ -- in supporting documentation. Silicon Graphics makes no
14
+ -- representations about the suitability of this software for any
15
+ -- purpose. It is provided "as is" without express or implied warranty.
16
+ --
17
+ -- Copyright (c) 1994
18
+ -- Hewlett-Packard Company
19
+ --
20
+ -- Permission to use, copy, modify, distribute and sell this software
21
+ -- and its documentation for any purpose is hereby granted without fee,
22
+ -- provided that the above copyright notice appears in all copies and
23
+ -- that both that copyright notice and this permission notice appear
24
+ -- in supporting documentation. Hewlett-Packard Company makes no
25
+ -- representations about the suitability of this software for any
26
+ -- purpose. It is provided "as is" without express or implied warranty.
27
+ --
28
+ -->
29
+
30
+ <HEAD>
31
+ <Title>sparsetable&lt;T, GROUP_SIZE&gt;</Title>
32
+ </HEAD>
33
+
34
+ <BODY>
35
+
36
+ <p><i>[Note: this document is formatted similarly to the SGI STL
37
+ implementation documentation pages, and refers to concepts and classes
38
+ defined there. However, neither this document nor the code it
39
+ describes is associated with SGI, nor is it necessary to have SGI's
40
+ STL implementation installed in order to use this class.]</i></p>
41
+
42
+ <H1>sparsetable&lt;T, GROUP_SIZE&gt;</H1>
43
+
44
+ <p>A <tt>sparsetable</tt> is a <A
45
+ href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random
46
+ Access Container</A> that supports constant time random access to
47
+ elements, and constant time insertion and removal of elements. It
48
+ implements the "array" or "table" abstract data type. The number of
49
+ elements in a <tt>sparsetable</tt> is set at constructor time, though
50
+ you can change it at any time by calling <tt>resize()</tt>.</p>
51
+
52
+ <p><tt>sparsetable</tt> is distinguished from other array
53
+ implementations, including the default C implementation, in its stingy
54
+ use of memory -- in particular, unused array elements require only 1 bit
55
+ of disk space to store, rather than <tt>sizeof(T)</tt> bytes -- and by
56
+ the ability to save and restore contents to disk. On the other hand,
57
+ this array implementation, while still efficient, is slower than other
58
+ array implementations.</p>
59
+
60
+ <A NAME="assigned">
61
+ <p>A <tt>sparsetable</tt> distinguishes between table elements that
62
+ have been <i>assigned</i> and those that are <i>unassigned</i>.
63
+ Assigned table elements are those that have had a value set via
64
+ <tt>set()</tt>, <tt>operator()</tt>, assignment via an iterator, and
65
+ so forth. Unassigned table elements are those that have not had a
66
+ value set in one of these ways, or that have been explicitly
67
+ unassigned via a call to <tt>erase()</tt> or <tt>clear()</tt>. Lookup
68
+ is valid on both assigned and unassigned table elements; for
69
+ unassigned elements, lookup returns the default value
70
+ <tt>T()</tt>.</p>
71
+ </A>
72
+
73
+ <p>This class is appropriate for applications that need to store large
74
+ arrays in memory, or for applications that need these arrays to be
75
+ persistent.</p>
76
+
77
+
78
+ <h3>Example</h3>
79
+
80
+ <pre>
81
+ #include &lt;google/sparsetable&gt;
82
+
83
+ using google::sparsetable; // namespace where class lives by default
84
+
85
+ sparsetable&lt;int&gt; t(100);
86
+ t[5] = 6;
87
+ cout &lt;&lt; "t[5] = " &lt;&lt t[5];
88
+ cout &lt;&lt; "Default value = " &lt;&lt t[99];
89
+ </pre>
90
+
91
+
92
+ <h3>Definition</h3>
93
+
94
+ Defined in the header <A href="sparsetable">sparsetable</A>. This
95
+ class is not part of the C++ standard.
96
+
97
+
98
+ <h3>Template parameters</h3>
99
+
100
+ <table border>
101
+ <TR><TH>Parameter</TH><TH>Description</TH><TH>Default</TH></TR>
102
+
103
+ <TR>
104
+ <TD VAlign=top>
105
+ <tt>T</tt>
106
+ </TD>
107
+ <TD VAlign=top>
108
+ The sparsetable's value type: the type of object that is stored in
109
+ the table.
110
+ </TD>
111
+ <TD VAlign=top>
112
+ &nbsp;
113
+ </TD>
114
+ </TR>
115
+
116
+ <TR>
117
+ <TD VAlign=top>
118
+ <tt>GROUP_SIZE</tt>
119
+ </TD>
120
+ <TD VAlign=top>
121
+ The number of elements in each sparsetable group (see <A
122
+ HREF="implementation.html">the implementation doc</A> for more details
123
+ on this value). This almost never need be specified; the default
124
+ template parameter value works well in all situations.
125
+ </TD>
126
+ <TD VAlign=top>
127
+ &nbsp;
128
+ </TD>
129
+ </TR>
130
+
131
+ </table>
132
+
133
+
134
+ <h3>Model of</h3>
135
+
136
+ <A href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random Access Container</A>
137
+
138
+
139
+ <h3>Type requirements</h3>
140
+
141
+ None, except for those imposed by the requirements of
142
+ <A
143
+ href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random
144
+ Access Container</A>
145
+
146
+
147
+ <h3>Public base classes</h3>
148
+
149
+ None.
150
+
151
+
152
+ <h3>Members</h3>
153
+
154
+ <table border>
155
+ <TR><TH>Member</TH><TH>Where defined</TH><TH>Description</TH></TR>
156
+
157
+ <TR>
158
+ <TD VAlign=top>
159
+ <tt>value_type</tt>
160
+ </TD>
161
+ <TD VAlign=top>
162
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
163
+ </TD>
164
+ <TD VAlign=top>
165
+ The type of object, <tt>T</tt>, stored in the table.
166
+ </TD>
167
+ </TR>
168
+
169
+ <TR>
170
+ <TD VAlign=top>
171
+ <tt>pointer</tt>
172
+ </TD>
173
+ <TD VAlign=top>
174
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
175
+ </TD>
176
+ <TD VAlign=top>
177
+ Pointer to <tt>T</tt>.
178
+ </TD>
179
+ </TR>
180
+
181
+ <TR>
182
+ <TD VAlign=top>
183
+ <tt>reference</tt>
184
+ </TD>
185
+ <TD VAlign=top>
186
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
187
+ </TD>
188
+ <TD VAlign=top>
189
+ Reference to <tt>T</tt>.
190
+ </TD>
191
+ </TR>
192
+
193
+ <TR>
194
+ <TD VAlign=top>
195
+ <tt>const_reference</tt>
196
+ </TD>
197
+ <TD VAlign=top>
198
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
199
+ </TD>
200
+ <TD VAlign=top>
201
+ Const reference to <tt>T</tt>.
202
+ </TD>
203
+ </TR>
204
+
205
+ <TR>
206
+ <TD VAlign=top>
207
+ <tt>size_type</tt>
208
+ </TD>
209
+ <TD VAlign=top>
210
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
211
+ </TD>
212
+ <TD VAlign=top>
213
+ An unsigned integral type.
214
+ </TD>
215
+ </TR>
216
+
217
+ <TR>
218
+ <TD VAlign=top>
219
+ <tt>difference_type</tt>
220
+ </TD>
221
+ <TD VAlign=top>
222
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
223
+ </TD>
224
+ <TD VAlign=top>
225
+ A signed integral type.
226
+ </TD>
227
+ </TR>
228
+
229
+ <TR>
230
+ <TD VAlign=top>
231
+ <tt>iterator</tt>
232
+ </TD>
233
+ <TD VAlign=top>
234
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
235
+ </TD>
236
+ <TD VAlign=top>
237
+ Iterator used to iterate through a <tt>sparsetable</tt>.
238
+ </TD>
239
+ </TR>
240
+
241
+ <TR>
242
+ <TD VAlign=top>
243
+ <tt>const_iterator</tt>
244
+ </TD>
245
+ <TD VAlign=top>
246
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
247
+ </TD>
248
+ <TD VAlign=top>
249
+ Const iterator used to iterate through a <tt>sparsetable</tt>.
250
+ </TD>
251
+ </TR>
252
+
253
+ <TR>
254
+ <TD VAlign=top>
255
+ <tt>reverse_iterator</tt>
256
+ </TD>
257
+ <TD VAlign=top>
258
+ <A
259
+ href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible
260
+ Container</A>
261
+ </TD>
262
+ <TD VAlign=top>
263
+ Iterator used to iterate backwards through a <tt>sparsetable</tt>.
264
+ </TD>
265
+ </TR>
266
+
267
+ <TR>
268
+ <TD VAlign=top>
269
+ <tt>const_reverse_iterator</tt>
270
+ </TD>
271
+ <TD VAlign=top>
272
+ <A
273
+ href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible
274
+ Container</A>
275
+ </TD>
276
+ <TD VAlign=top>
277
+ Const iterator used to iterate backwards through a
278
+ <tt>sparsetable</tt>.
279
+ </TD>
280
+ </TR>
281
+
282
+ <TR>
283
+ <TD VAlign=top>
284
+ <tt>nonempty_iterator</tt>
285
+ </TD>
286
+ <TD VAlign=top>
287
+ <tt>sparsetable</tt>
288
+ </TD>
289
+ <TD VAlign=top>
290
+ Iterator used to iterate through the
291
+ <A HREF="#assigned">assigned</A> elements of the
292
+ <tt>sparsetable</tt>.
293
+ </TD>
294
+ </TR>
295
+
296
+ <TR>
297
+ <TD VAlign=top>
298
+ <tt>const_nonempty_iterator</tt>
299
+ </TD>
300
+ <TD VAlign=top>
301
+ <tt>sparsetable</tt>
302
+ </TD>
303
+ <TD VAlign=top>
304
+ Const iterator used to iterate through the
305
+ <A HREF="#assigned">assigned</A> elements of the
306
+ <tt>sparsetable</tt>.
307
+ </TD>
308
+ </TR>
309
+
310
+ <TR>
311
+ <TD VAlign=top>
312
+ <tt>reverse_nonempty_iterator</tt>
313
+ </TD>
314
+ <TD VAlign=top>
315
+ <tt>sparsetable</tt>
316
+ </TD>
317
+ <TD VAlign=top>
318
+ Iterator used to iterate backwards through the
319
+ <A HREF="#assigned">assigned</A> elements of the
320
+ <tt>sparsetable</tt>.
321
+ </TD>
322
+ </TR>
323
+
324
+ <TR>
325
+ <TD VAlign=top>
326
+ <tt>const_reverse_nonempty_iterator</tt>
327
+ </TD>
328
+ <TD VAlign=top>
329
+ <tt>sparsetable</tt>
330
+ </TD>
331
+ <TD VAlign=top>
332
+ Const iterator used to iterate backwards through the
333
+ <A HREF="#assigned">assigned</A> elements of the
334
+ <tt>sparsetable</tt>.
335
+ </TD>
336
+ </TR>
337
+
338
+ <TR>
339
+ <TD VAlign=top>
340
+ <tt>destructive_iterator</tt>
341
+ </TD>
342
+ <TD VAlign=top>
343
+ <tt>sparsetable</tt>
344
+ </TD>
345
+ <TD VAlign=top>
346
+ Iterator used to iterate through the
347
+ <A HREF="#assigned">assigned</A> elements of the
348
+ <tt>sparsetable</tt>, erasing elements as it iterates.
349
+ <A href="#1">[1]</A>
350
+ </TD>
351
+ </TR>
352
+
353
+ <TR>
354
+ <TD VAlign=top>
355
+ <tt>iterator begin()</tt>
356
+ </TD>
357
+ <TD VAlign=top>
358
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
359
+ </TD>
360
+ <TD VAlign=top>
361
+ Returns an <tt>iterator</tt> pointing to the beginning of the
362
+ <tt>sparsetable</tt>.
363
+ </TD>
364
+ </TR>
365
+
366
+ <TR>
367
+ <TD VAlign=top>
368
+ <tt>iterator end()</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
+ Returns an <tt>iterator</tt> pointing to the end of the
375
+ <tt>sparsetable</tt>.
376
+ </TD>
377
+ </TR>
378
+
379
+ <TR>
380
+ <TD VAlign=top>
381
+ <tt>const_iterator begin() const</tt>
382
+ </TD>
383
+ <TD VAlign=top>
384
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
385
+ </TD>
386
+ <TD VAlign=top>
387
+ Returns an <tt>const_iterator</tt> pointing to the beginning of the
388
+ <tt>sparsetable</tt>.
389
+ </TD>
390
+ </TR>
391
+
392
+ <TR>
393
+ <TD VAlign=top>
394
+ <tt>const_iterator end() const</tt>
395
+ </TD>
396
+ <TD VAlign=top>
397
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
398
+ </TD>
399
+ <TD VAlign=top>
400
+ Returns an <tt>const_iterator</tt> pointing to the end of the
401
+ <tt>sparsetable</tt>.
402
+ </TD>
403
+ </TR>
404
+
405
+ <TR>
406
+ <TD VAlign=top>
407
+ <tt>reverse_iterator rbegin()</tt>
408
+ </TD>
409
+ <TD VAlign=top>
410
+ <A
411
+ href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible
412
+ Container</A>
413
+ </TD>
414
+ <TD VAlign=top>
415
+ Returns a <tt>reverse_iterator</tt> pointing to the beginning of the
416
+ reversed <tt>sparsetable</tt>.
417
+ </TD>
418
+ </TR>
419
+
420
+ <TR>
421
+ <TD VAlign=top>
422
+ <tt>reverse_iterator rend()</tt>
423
+ </TD>
424
+ <TD VAlign=top>
425
+ <A
426
+ href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible
427
+ Container</A>
428
+ </TD>
429
+ <TD VAlign=top>
430
+ Returns a <tt>reverse_iterator</tt> pointing to the end of the
431
+ reversed <tt>sparsetable</tt>.
432
+ </TD>
433
+ </TR>
434
+
435
+ <TR>
436
+ <TD VAlign=top>
437
+ <tt>const_reverse_iterator rbegin() const</tt>
438
+ </TD>
439
+ <TD VAlign=top>
440
+ <A
441
+ href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible
442
+ Container</A>
443
+ </TD>
444
+ <TD VAlign=top>
445
+ Returns a <tt>const_reverse_iterator</tt> pointing to the beginning
446
+ of the reversed <tt>sparsetable</tt>.
447
+ </TD>
448
+ </TR>
449
+
450
+ <TR>
451
+ <TD VAlign=top>
452
+ <tt>const_reverse_iterator rend() const</tt>
453
+ </TD>
454
+ <TD VAlign=top>
455
+ <A
456
+ href="http://www.sgi.com/tech/stl/ReversibleContainer.html">Reversible
457
+ Container</A>
458
+ </TD>
459
+ <TD VAlign=top>
460
+ Returns a <tt>const_reverse_iterator</tt> pointing to the end of
461
+ the reversed <tt>sparsetable</tt>.
462
+ </TD>
463
+ </TR>
464
+
465
+ <TR>
466
+ <TD VAlign=top>
467
+ <tt>nonempty_iterator nonempty_begin()</tt>
468
+ </TD>
469
+ <TD VAlign=top>
470
+ <tt>sparsetable</tt>
471
+ </TD>
472
+ <TD VAlign=top>
473
+ Returns a <tt>nonempty_iterator</tt> pointing to the first
474
+ <A HREF="#assigned">assigned</A> element of the
475
+ <tt>sparsetable</tt>.
476
+ </TD>
477
+ </TR>
478
+
479
+ <TR>
480
+ <TD VAlign=top>
481
+ <tt>nonempty_iterator nonempty_end()</tt>
482
+ </TD>
483
+ <TD VAlign=top>
484
+ <tt>sparsetable</tt>
485
+ </TD>
486
+ <TD VAlign=top>
487
+ Returns a <tt>nonempty_iterator</tt> pointing to the end of the
488
+ <tt>sparsetable</tt>.
489
+ </TD>
490
+ </TR>
491
+
492
+ <TR>
493
+ <TD VAlign=top>
494
+ <tt>const_nonempty_iterator nonempty_begin() const</tt>
495
+ </TD>
496
+ <TD VAlign=top>
497
+ <tt>sparsetable</tt>
498
+ </TD>
499
+ <TD VAlign=top>
500
+ Returns a <tt>const_nonempty_iterator</tt> pointing to the first
501
+ <A HREF="#assigned">assigned</A> element of the
502
+ <tt>sparsetable</tt>.
503
+ </TD>
504
+ </TR>
505
+
506
+ <TR>
507
+ <TD VAlign=top>
508
+ <tt>const_nonempty_iterator nonempty_end() const</tt>
509
+ </TD>
510
+ <TD VAlign=top>
511
+ <tt>sparsetable</tt>
512
+ </TD>
513
+ <TD VAlign=top>
514
+ Returns a <tt>const_nonempty_iterator</tt> pointing to the end of
515
+ the <tt>sparsetable</tt>.
516
+ </TD>
517
+ </TR>
518
+
519
+ <TR>
520
+ <TD VAlign=top>
521
+ <tt>reverse_nonempty_iterator nonempty_rbegin()</tt>
522
+ </TD>
523
+ <TD VAlign=top>
524
+ <tt>sparsetable</tt>
525
+ </TD>
526
+ <TD VAlign=top>
527
+ Returns a <tt>reverse_nonempty_iterator</tt> pointing to the first
528
+ <A HREF="#assigned">assigned</A> element of the reversed
529
+ <tt>sparsetable</tt>.
530
+ </TD>
531
+ </TR>
532
+
533
+ <TR>
534
+ <TD VAlign=top>
535
+ <tt>reverse_nonempty_iterator nonempty_rend()</tt>
536
+ </TD>
537
+ <TD VAlign=top>
538
+ <tt>sparsetable</tt>
539
+ </TD>
540
+ <TD VAlign=top>
541
+ Returns a <tt>reverse_nonempty_iterator</tt> pointing to the end of
542
+ the reversed <tt>sparsetable</tt>.
543
+ </TD>
544
+ </TR>
545
+
546
+ <TR>
547
+ <TD VAlign=top>
548
+ <tt>const_reverse_nonempty_iterator nonempty_rbegin() const</tt>
549
+ </TD>
550
+ <TD VAlign=top>
551
+ <tt>sparsetable</tt>
552
+ </TD>
553
+ <TD VAlign=top>
554
+ Returns a <tt>const_reverse_nonempty_iterator</tt> pointing to the
555
+ first <A HREF="#assigned">assigned</A> element of the reversed
556
+ <tt>sparsetable</tt>.
557
+ </TD>
558
+ </TR>
559
+
560
+ <TR>
561
+ <TD VAlign=top>
562
+ <tt>const_reverse_nonempty_iterator nonempty_rend() const</tt>
563
+ </TD>
564
+ <TD VAlign=top>
565
+ <tt>sparsetable</tt>
566
+ </TD>
567
+ <TD VAlign=top>
568
+ Returns a <tt>const_reverse_nonempty_iterator</tt> pointing to the
569
+ end of the reversed <tt>sparsetable</tt>.
570
+ </TD>
571
+ </TR>
572
+
573
+ <TR>
574
+ <TD VAlign=top>
575
+ <tt>destructive_iterator destructive_begin()</tt>
576
+ </TD>
577
+ <TD VAlign=top>
578
+ <tt>sparsetable</tt>
579
+ </TD>
580
+ <TD VAlign=top>
581
+ Returns a <tt>destructive_iterator</tt> pointing to the first
582
+ <A HREF="#assigned">assigned</A> element of the
583
+ <tt>sparsetable</tt>.
584
+ </TD>
585
+ </TR>
586
+
587
+ <TR>
588
+ <TD VAlign=top>
589
+ <tt>destructive_iterator destructive_end()</tt>
590
+ </TD>
591
+ <TD VAlign=top>
592
+ <tt>sparsetable</tt>
593
+ </TD>
594
+ <TD VAlign=top>
595
+ Returns a <tt>destructive_iterator</tt> pointing to the end of
596
+ the <tt>sparsetable</tt>.
597
+ </TD>
598
+ </TR>
599
+
600
+ <TR>
601
+ <TD VAlign=top>
602
+ <tt>size_type size() const</tt>
603
+ </TD>
604
+ <TD VAlign=top>
605
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
606
+ </TD>
607
+ <TD VAlign=top>
608
+ Returns the size of the <tt>sparsetable</tt>.
609
+ </TD>
610
+ </TR>
611
+
612
+ <TR>
613
+ <TD VAlign=top>
614
+ <tt>size_type max_size() const</tt>
615
+ </TD>
616
+ <TD VAlign=top>
617
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
618
+ </TD>
619
+ <TD VAlign=top>
620
+ Returns the largest possible size of the <tt>sparsetable</tt>.
621
+ </TD>
622
+ </TR>
623
+
624
+ <TR>
625
+ <TD VAlign=top>
626
+ <tt>bool empty() const</tt>
627
+ </TD>
628
+ <TD VAlign=top>
629
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
630
+ </TD>
631
+ <TD VAlign=top>
632
+ <tt>true</tt> if the <tt>sparsetable</tt>'s size is <tt>0</tt>.
633
+ </TD>
634
+ </TR>
635
+
636
+ <TR>
637
+ <TD VAlign=top>
638
+ <tt>size_type num_nonempty() const</tt>
639
+ </TD>
640
+ <TD VAlign=top>
641
+ <tt>sparsetable</tt>
642
+ </TD>
643
+ <TD VAlign=top>
644
+ Returns the number of sparsetable elements that are currently <A
645
+ HREF="#assigned">assigned</A>.
646
+ </TD>
647
+ </TR>
648
+
649
+ <TR>
650
+ <TD VAlign=top>
651
+ <tt>sparsetable(size_type n)</tt>
652
+ </TD>
653
+ <TD VAlign=top>
654
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
655
+ </TD>
656
+ <TD VAlign=top>
657
+ Creates a <tt>sparsetable</tt> with <tt>n</tt> elements.
658
+ </TD>
659
+ </TR>
660
+
661
+ <TR>
662
+ <TD VAlign=top>
663
+ <tt>sparsetable(const sparsetable&amp;)</tt>
664
+ </TD>
665
+ <TD VAlign=top>
666
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
667
+ </TD>
668
+ <TD VAlign=top>
669
+ The copy constructor.
670
+ </TD>
671
+ </TR>
672
+
673
+ <TR>
674
+ <TD VAlign=top>
675
+ <tt>~sparsetable()</tt>
676
+ </TD>
677
+ <TD VAlign=top>
678
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
679
+ </TD>
680
+ <TD VAlign=top>
681
+ The destructor.
682
+ </TD>
683
+ </TR>
684
+
685
+ <TR>
686
+ <TD VAlign=top>
687
+ <tt>sparsetable&amp; operator=(const sparsetable&amp;)</tt>
688
+ </TD>
689
+ <TD VAlign=top>
690
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
691
+ </TD>
692
+ <TD VAlign=top>
693
+ The assignment operator
694
+ </TD>
695
+ </TR>
696
+
697
+ <TR>
698
+ <TD VAlign=top>
699
+ <tt>void swap(sparsetable&amp;)</tt>
700
+ </TD>
701
+ <TD VAlign=top>
702
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>
703
+ </TD>
704
+ <TD VAlign=top>
705
+ Swaps the contents of two sparsetables.
706
+ </TD>
707
+ </TR>
708
+
709
+ <TR>
710
+ <TD VAlign=top>
711
+ <tt>reference operator[](size_type n)</tt>
712
+ </TD>
713
+ <TD VAlign=top>
714
+ <A
715
+ href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random
716
+ Access Container</A>
717
+ </TD>
718
+ <TD VAlign=top>
719
+ Returns the <tt>n</tt>'th element. <A href="#2">[2]</A>
720
+ </TD>
721
+ </TR>
722
+
723
+ <TR>
724
+ <TD VAlign=top>
725
+ <tt>const_reference operator[](size_type n) const</tt>
726
+ </TD>
727
+ <TD VAlign=top>
728
+ <A
729
+ href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random
730
+ Access Container</A>
731
+ </TD>
732
+ <TD VAlign=top>
733
+ Returns the <tt>n</tt>'th element.
734
+ </TD>
735
+ </TR>
736
+
737
+ <TR>
738
+ <TD VAlign=top>
739
+ <tt>bool test(size_type i) const</tt>
740
+ </TD>
741
+ <TD VAlign=top>
742
+ <tt>sparsetable</tt>
743
+ </TD>
744
+ <TD VAlign=top>
745
+ true if the <tt>i</tt>'th element of the <tt>sparsetable</tt> is <A
746
+ HREF="#assigned">assigned</A>.
747
+ </TD>
748
+ </TR>
749
+
750
+ <TR>
751
+ <TD VAlign=top>
752
+ <tt>bool test(iterator pos) const</tt>
753
+ </TD>
754
+ <TD VAlign=top>
755
+ <tt>sparsetable</tt>
756
+ </TD>
757
+ <TD VAlign=top>
758
+ true if the <tt>sparsetable</tt> element pointed to by <tt>pos</tt>
759
+ is <A HREF="#assigned">assigned</A>.
760
+ </TD>
761
+ </TR>
762
+
763
+ <TR>
764
+ <TD VAlign=top>
765
+ <tt>bool test(const_iterator pos) const</tt>
766
+ </TD>
767
+ <TD VAlign=top>
768
+ <tt>sparsetable</tt>
769
+ </TD>
770
+ <TD VAlign=top>
771
+ true if the <tt>sparsetable</tt> element pointed to by <tt>pos</tt>
772
+ is <A HREF="#assigned">assigned</A>.
773
+ </TD>
774
+ </TR>
775
+
776
+ <TR>
777
+ <TD VAlign=top>
778
+ <tt>const_reference get(size_type i) const</tt>
779
+ </TD>
780
+ <TD VAlign=top>
781
+ <tt>sparsetable</tt>
782
+ </TD>
783
+ <TD VAlign=top>
784
+ returns the <tt>i</tt>'th element of the <tt>sparsetable</tt>.
785
+ </TD>
786
+ </TR>
787
+
788
+ <TR>
789
+ <TD VAlign=top>
790
+ <tt>reference set(size_type i, const_reference val)</tt>
791
+ </TD>
792
+ <TD VAlign=top>
793
+ <tt>sparsetable</tt>
794
+ </TD>
795
+ <TD VAlign=top>
796
+ Sets the <tt>i</tt>'th element of the <tt>sparsetable</tt> to value
797
+ <tt>val</tt>.
798
+ </TD>
799
+ </TR>
800
+
801
+ <TR>
802
+ <TD VAlign=top>
803
+ <tt>void erase(size_type i)</tt>
804
+ </TD>
805
+ <TD VAlign=top>
806
+ <tt>sparsetable</tt>
807
+ </TD>
808
+ <TD VAlign=top>
809
+ Erases the <tt>i</tt>'th element of the <tt>sparsetable</tt>.
810
+ </TD>
811
+ </TR>
812
+
813
+ <TR>
814
+ <TD VAlign=top>
815
+ <tt>void erase(iterator pos)</tt>
816
+ </TD>
817
+ <TD VAlign=top>
818
+ <tt>sparsetable</tt>
819
+ </TD>
820
+ <TD VAlign=top>
821
+ Erases the element of the <tt>sparsetable</tt> pointed to by
822
+ <tt>pos</tt>.
823
+ </TD>
824
+ </TR>
825
+
826
+ <TR>
827
+ <TD VAlign=top>
828
+ <tt>void erase(iterator first, iterator last)</tt>
829
+ </TD>
830
+ <TD VAlign=top>
831
+ <tt>sparsetable</tt>
832
+ </TD>
833
+ <TD VAlign=top>
834
+ Erases the elements of the <tt>sparsetable</tt> in the range
835
+ <tt>[first, last)</tt>.
836
+ </TD>
837
+ </TR>
838
+
839
+ <TR>
840
+ <TD VAlign=top>
841
+ <tt>void clear()</tt>
842
+ </TD>
843
+ <TD VAlign=top>
844
+ <tt>sparsetable</tt>
845
+ </TD>
846
+ <TD VAlign=top>
847
+ Erases all of the elements.
848
+ </TD>
849
+ </TR>
850
+
851
+ <TR>
852
+ <TD VAlign=top>
853
+ <tt>void resize(size_type n)</tt>
854
+ </TD>
855
+ <TD VAlign=top>
856
+ <tt>sparsetable</tt>
857
+ </TD>
858
+ <TD VAlign=top>
859
+ Changes the size of sparsetable to <tt>n</tt>.
860
+ </TD>
861
+ </TR>
862
+
863
+ <TR>
864
+ <TD VAlign=top>
865
+ <tt>bool write_metadata(FILE *fp)</tt>
866
+ </TD>
867
+ <TD VAlign=top>
868
+ <tt>sparsetable</tt>
869
+ </TD>
870
+ <TD VAlign=top>
871
+ See below.
872
+ </TD>
873
+ </TR>
874
+
875
+ <TR>
876
+ <TD VAlign=top>
877
+ <tt>bool read_metadata(FILE *fp)</tt>
878
+ </TD>
879
+ <TD VAlign=top>
880
+ <tt>sparsetable</tt>
881
+ </TD>
882
+ <TD VAlign=top>
883
+ See below.
884
+ </TD>
885
+ </TR>
886
+
887
+ <TR>
888
+ <TD VAlign=top>
889
+ <tt>bool write_nopointer_data(FILE *fp)</tt>
890
+ </TD>
891
+ <TD VAlign=top>
892
+ <tt>sparsetable</tt>
893
+ </TD>
894
+ <TD VAlign=top>
895
+ See below.
896
+ </TD>
897
+ </TR>
898
+
899
+ <TR>
900
+ <TD VAlign=top>
901
+ <tt>bool read_nopointer_data(FILE *fp)</tt>
902
+ </TD>
903
+ <TD VAlign=top>
904
+ <tt>sparsetable</tt>
905
+ </TD>
906
+ <TD VAlign=top>
907
+ See below.
908
+ </TD>
909
+ </TR>
910
+
911
+ <TR>
912
+ <TD VAlign=top>
913
+ <pre>bool operator==(const sparsetable&amp;, const sparsetable&amp;)
914
+ </pre>
915
+ </TD>
916
+ <TD VAlign=top>
917
+ <A
918
+ href="http://www.sgi.com/tech/stl/ForwardContainer.html">Forward
919
+ Container</A>
920
+ </TD>
921
+ <TD VAlign=top>
922
+ Tests two sparsetables for equality. This is a global function,
923
+ not a member function.
924
+ </TD>
925
+ </TR>
926
+
927
+ <TR>
928
+ <TD VAlign=top>
929
+ <pre>bool operator&lt;(const sparsetable&amp;, const sparsetable&amp;)
930
+ </pre>
931
+ </TD>
932
+ <TD VAlign=top>
933
+ <A
934
+ href="http://www.sgi.com/tech/stl/ForwardContainer.html">Forward
935
+ Container</A>
936
+ </TD>
937
+ <TD VAlign=top>
938
+ Lexicographical comparison. This is a global function,
939
+ not a member function.
940
+ </TD>
941
+ </TR>
942
+
943
+ </table>
944
+
945
+
946
+ <h3>New members</h3>
947
+
948
+ These members are not defined in the <A
949
+ href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random
950
+ Access Container</A> requirement, but are specific to
951
+ <tt>sparsetable</tt>.
952
+
953
+ <table border>
954
+ <TR><TH>Member</TH><TH>Description</TH></TR>
955
+
956
+ <TR>
957
+ <TD VAlign=top>
958
+ <tt>nonempty_iterator</tt>
959
+ </TD>
960
+ <TD VAlign=top>
961
+ Iterator used to iterate through the
962
+ <A HREF="#assigned">assigned</A> elements of the
963
+ <tt>sparsetable</tt>.
964
+ </TD>
965
+ </TR>
966
+
967
+ <TR>
968
+ <TD VAlign=top>
969
+ <tt>const_nonempty_iterator</tt>
970
+ </TD>
971
+ <TD VAlign=top>
972
+ Const iterator used to iterate through the
973
+ <A HREF="#assigned">assigned</A> elements of the
974
+ <tt>sparsetable</tt>.
975
+ </TD>
976
+ </TR>
977
+
978
+ <TR>
979
+ <TD VAlign=top>
980
+ <tt>reverse_nonempty_iterator</tt>
981
+ </TD>
982
+ <TD VAlign=top>
983
+ Iterator used to iterate backwards through the
984
+ <A HREF="#assigned">assigned</A> elements of the
985
+ <tt>sparsetable</tt>.
986
+ </TD>
987
+ </TR>
988
+
989
+ <TR>
990
+ <TD VAlign=top>
991
+ <tt>const_reverse_nonempty_iterator</tt>
992
+ </TD>
993
+ <TD VAlign=top>
994
+ Const iterator used to iterate backwards through the
995
+ <A HREF="#assigned">assigned</A> elements of the
996
+ <tt>sparsetable</tt>.
997
+ </TD>
998
+ </TR>
999
+
1000
+ <TR>
1001
+ <TD VAlign=top>
1002
+ <tt>destructive_iterator</tt>
1003
+ </TD>
1004
+ <TD VAlign=top>
1005
+ Iterator used to iterate through the
1006
+ <A HREF="#assigned">assigned</A> elements of the
1007
+ <tt>sparsetable</tt>, erasing elements as it iterates.
1008
+ <A href="#1">[1]</A>
1009
+ </TD>
1010
+ </TR>
1011
+
1012
+ <TR>
1013
+ <TD VAlign=top>
1014
+ <tt>nonempty_iterator nonempty_begin()</tt>
1015
+ </TD>
1016
+ <TD VAlign=top>
1017
+ Returns a <tt>nonempty_iterator</tt> pointing to the first
1018
+ <A HREF="#assigned">assigned</A> element of the
1019
+ <tt>sparsetable</tt>.
1020
+ </TD>
1021
+ </TR>
1022
+
1023
+ <TR>
1024
+ <TD VAlign=top>
1025
+ <tt>nonempty_iterator nonempty_end()</tt>
1026
+ </TD>
1027
+ <TD VAlign=top>
1028
+ Returns a <tt>nonempty_iterator</tt> pointing to the end of the
1029
+ <tt>sparsetable</tt>.
1030
+ </TD>
1031
+ </TR>
1032
+
1033
+ <TR>
1034
+ <TD VAlign=top>
1035
+ <tt>const_nonempty_iterator nonempty_begin() const</tt>
1036
+ </TD>
1037
+ <TD VAlign=top>
1038
+ Returns a <tt>const_nonempty_iterator</tt> pointing to the first
1039
+ <A HREF="#assigned">assigned</A> element of the
1040
+ <tt>sparsetable</tt>.
1041
+ </TD>
1042
+ </TR>
1043
+
1044
+ <TR>
1045
+ <TD VAlign=top>
1046
+ <tt>const_nonempty_iterator nonempty_end() const</tt>
1047
+ </TD>
1048
+ <TD VAlign=top>
1049
+ Returns a <tt>const_nonempty_iterator</tt> pointing to the end of
1050
+ the <tt>sparsetable</tt>.
1051
+ </TD>
1052
+ </TR>
1053
+
1054
+ <TR>
1055
+ <TD VAlign=top>
1056
+ <tt>reverse_nonempty_iterator nonempty_rbegin()</tt>
1057
+ </TD>
1058
+ <TD VAlign=top>
1059
+ Returns a <tt>reverse_nonempty_iterator</tt> pointing to the first
1060
+ <A HREF="#assigned">assigned</A> element of the reversed
1061
+ <tt>sparsetable</tt>.
1062
+ </TD>
1063
+ </TR>
1064
+
1065
+ <TR>
1066
+ <TD VAlign=top>
1067
+ <tt>reverse_nonempty_iterator nonempty_rend()</tt>
1068
+ </TD>
1069
+ <TD VAlign=top>
1070
+ Returns a <tt>reverse_nonempty_iterator</tt> pointing to the end of
1071
+ the reversed <tt>sparsetable</tt>.
1072
+ </TD>
1073
+ </TR>
1074
+
1075
+ <TR>
1076
+ <TD VAlign=top>
1077
+ <tt>const_reverse_nonempty_iterator nonempty_rbegin() const</tt>
1078
+ </TD>
1079
+ <TD VAlign=top>
1080
+ Returns a <tt>const_reverse_nonempty_iterator</tt> pointing to the
1081
+ first <A HREF="#assigned">assigned</A> element of the reversed
1082
+ <tt>sparsetable</tt>.
1083
+ </TD>
1084
+ </TR>
1085
+
1086
+ <TR>
1087
+ <TD VAlign=top>
1088
+ <tt>const_reverse_nonempty_iterator nonempty_rend() const</tt>
1089
+ </TD>
1090
+ <TD VAlign=top>
1091
+ Returns a <tt>const_reverse_nonempty_iterator</tt> pointing to the
1092
+ end of the reversed <tt>sparsetable</tt>.
1093
+ </TD>
1094
+ </TR>
1095
+
1096
+ <TR>
1097
+ <TD VAlign=top>
1098
+ <tt>destructive_iterator destructive_begin()</tt>
1099
+ </TD>
1100
+ <TD VAlign=top>
1101
+ Returns a <tt>destructive_iterator</tt> pointing to the first
1102
+ <A HREF="#assigned">assigned</A> element of the
1103
+ <tt>sparsetable</tt>.
1104
+ </TD>
1105
+ </TR>
1106
+
1107
+ <TR>
1108
+ <TD VAlign=top>
1109
+ <tt>destructive_iterator destructive_end()</tt>
1110
+ </TD>
1111
+ <TD VAlign=top>
1112
+ Returns a <tt>destructive_iterator</tt> pointing to the end of
1113
+ the <tt>sparsetable</tt>.
1114
+ </TD>
1115
+ </TR>
1116
+
1117
+ <TR>
1118
+ <TD VAlign=top>
1119
+ <tt>size_type num_nonempty() const</tt>
1120
+ </TD>
1121
+ <TD VAlign=top>
1122
+ Returns the number of sparsetable elements that are currently <A
1123
+ HREF="#assigned">assigned</A>.
1124
+ </TD>
1125
+ </TR>
1126
+
1127
+ <TR>
1128
+ <TD VAlign=top>
1129
+ <tt>bool test(size_type i) const</tt>
1130
+ </TD>
1131
+ <TD VAlign=top>
1132
+ true if the <tt>i</tt>'th element of the <tt>sparsetable</tt> is <A
1133
+ HREF="#assigned">assigned</A>.
1134
+ </TD>
1135
+ </TR>
1136
+
1137
+ <TR>
1138
+ <TD VAlign=top>
1139
+ <tt>bool test(iterator pos) const</tt>
1140
+ </TD>
1141
+ <TD VAlign=top>
1142
+ true if the <tt>sparsetable</tt> element pointed to by <tt>pos</tt>
1143
+ is <A HREF="#assigned">assigned</A>.
1144
+ </TD>
1145
+ </TR>
1146
+
1147
+ <TR>
1148
+ <TD VAlign=top>
1149
+ <tt>bool test(const_iterator pos) const</tt>
1150
+ </TD>
1151
+ <TD VAlign=top>
1152
+ true if the <tt>sparsetable</tt> element pointed to by <tt>pos</tt>
1153
+ is <A HREF="#assigned">assigned</A>.
1154
+ </TD>
1155
+ </TR>
1156
+
1157
+ <TR>
1158
+ <TD VAlign=top>
1159
+ <tt>const_reference get(size_type i) const</tt>
1160
+ </TD>
1161
+ <TD VAlign=top>
1162
+ returns the <tt>i</tt>'th element of the <tt>sparsetable</tt>. If
1163
+ the <tt>i</tt>'th element is <A HREF="#assigned">assigned</A>, the
1164
+ assigned value is returned, otherwise, the default value
1165
+ <tt>T()</tt> is returned.
1166
+ </TD>
1167
+ </TR>
1168
+
1169
+ <TR>
1170
+ <TD VAlign=top>
1171
+ <tt>reference set(size_type i, const_reference val)</tt>
1172
+ </TD>
1173
+ <TD VAlign=top>
1174
+ Sets the <tt>i</tt>'th element of the <tt>sparsetable</tt> to value
1175
+ <tt>val</tt>, and returns a reference to the <tt>i</tt>'th element
1176
+ of the table. This operation causes the <tt>i</tt>'th element to
1177
+ be <A HREF="#assigned">assigned</A>.
1178
+ </TD>
1179
+ </TR>
1180
+
1181
+ <TR>
1182
+ <TD VAlign=top>
1183
+ <tt>void erase(size_type i)</tt>
1184
+ </TD>
1185
+ <TD VAlign=top>
1186
+ Erases the <tt>i</tt>'th element of the <tt>sparsetable</tt>. This
1187
+ operation causes the <tt>i</tt>'th element to be <A
1188
+ HREF="#assigned">unassigned</A>.
1189
+ </TD>
1190
+ </TR>
1191
+
1192
+ <TR>
1193
+ <TD VAlign=top>
1194
+ <tt>void erase(iterator pos)</tt>
1195
+ </TD>
1196
+ <TD VAlign=top>
1197
+ Erases the element of the <tt>sparsetable</tt> pointed to by
1198
+ <tt>pos</tt>. This operation causes the <tt>i</tt>'th element to
1199
+ be <A HREF="#assigned">unassigned</A>.
1200
+ </TD>
1201
+ </TR>
1202
+
1203
+ <TR>
1204
+ <TD VAlign=top>
1205
+ <tt>void erase(iterator first, iterator last)</tt>
1206
+ </TD>
1207
+ <TD VAlign=top>
1208
+ Erases the elements of the <tt>sparsetable</tt> in the range
1209
+ <tt>[first, last)</tt>. This operation causes these elements to
1210
+ be <A HREF="#assigned">unassigned</A>.
1211
+ </TD>
1212
+ </TR>
1213
+
1214
+ <TR>
1215
+ <TD VAlign=top>
1216
+ <tt>void clear()</tt>
1217
+ </TD>
1218
+ <TD VAlign=top>
1219
+ Erases all of the elements. This causes all elements to be
1220
+ <A HREF="#assigned">unassigned</A>.
1221
+ </TD>
1222
+ </TR>
1223
+
1224
+ <TR>
1225
+ <TD VAlign=top>
1226
+ <tt>void resize(size_type n)</tt>
1227
+ </TD>
1228
+ <TD VAlign=top>
1229
+ Changes the size of sparsetable to <tt>n</tt>. If <tt>n</tt> is
1230
+ greater than the old size, new, <A HREF="#assigned">unassigned</A>
1231
+ elements are appended. If <tt>n</tt> is less than the old size,
1232
+ all elements in position &gt;<tt>n</tt> are deleted.
1233
+ </TD>
1234
+ </TR>
1235
+
1236
+ <TR>
1237
+ <TD VAlign=top>
1238
+ <tt>bool write_metadata(FILE *fp)</tt>
1239
+ </TD>
1240
+ <TD VAlign=top>
1241
+ Write hashtable metadata to <tt>fp</tt>. See <A HREF="#io">below</A>.
1242
+ </TD>
1243
+ </TR>
1244
+
1245
+ <TR>
1246
+ <TD VAlign=top>
1247
+ <tt>bool read_metadata(FILE *fp)</tt>
1248
+ </TD>
1249
+ <TD VAlign=top>
1250
+ Read hashtable metadata from <tt>fp</tt>. See <A HREF="#io">below</A>.
1251
+ </TD>
1252
+ </TR>
1253
+
1254
+ <TR>
1255
+ <TD VAlign=top>
1256
+ <tt>bool write_nopointer_data(FILE *fp)</tt>
1257
+ </TD>
1258
+ <TD VAlign=top>
1259
+ Write hashtable contents to <tt>fp</tt>. This is valid only if the
1260
+ hashtable key and value are "plain" data. See <A HREF="#io">below</A>.
1261
+ </TD>
1262
+ </TR>
1263
+
1264
+ <TR>
1265
+ <TD VAlign=top>
1266
+ <tt>bool read_nopointer_data(FILE *fp)</tt>
1267
+ </TD>
1268
+ <TD VAlign=top>
1269
+ Read hashtable contents to <tt>fp</tt>. This is valid only if the
1270
+ hashtable key and value are "plain" data. See <A HREF="#io">below</A>.
1271
+ </TD>
1272
+ </TR>
1273
+
1274
+ </table>
1275
+
1276
+
1277
+ <h3>Notes</h3>
1278
+
1279
+ <P><A name="1">[1]</A>
1280
+
1281
+ <tt>sparsetable::destructive_iterator</tt> iterates through a
1282
+ sparsetable like a normal iterator, but <tt>++it</tt> may delete the
1283
+ element being iterated past. Obviously, this iterator can only be
1284
+ used once on a given table! One application of this iterator is to
1285
+ copy data from a sparsetable to some other data structure without
1286
+ using extra memory to store the data in both places during the
1287
+ copy.</p>
1288
+
1289
+ <P><A name="2">[2]</A>
1290
+
1291
+ Since <tt>operator[]</tt> might insert a new element into the
1292
+ <tt>sparsetable</tt>, it can't possibly be a <tt>const</tt> member
1293
+ function. In theory, since it might insert a new element, it should
1294
+ cause the element it refers to to become <A
1295
+ HREF="#assigned">assigned</A>. However, this is undesirable when
1296
+ <tt>operator[]</tt> is used to examine elements, rather than assign
1297
+ them. Thus, as an implementation trick, <tt>operator[]</tt> does not
1298
+ really return a <tt>reference</tt>. Instead it returns an object that
1299
+ behaves almost exactly like a <tt>reference</tt>. This object,
1300
+ however, delays setting the appropriate sparsetable element to <A
1301
+ HREF="#assigned">assigned</A> to when it is actually assigned to.</p>
1302
+
1303
+ <p>For a bit more detail: the object returned by <tt>operator[]</tt>
1304
+ is an opaque type which defines <tt>operator=</tt>, <tt>operator
1305
+ reference()</tt>, and <tt>operator&</tt>. The first operator controls
1306
+ assigning to the value. The second controls examining the value. The
1307
+ third controls pointing to the value.</p>
1308
+
1309
+ <p>All three operators perform exactly as an object of type
1310
+ <tt>reference</tt> would perform. The only problems that arise is
1311
+ when this object is accessed in situations where C++ cannot do the
1312
+ conversion by default. By far the most common situation is with
1313
+ variadic functions such as <tt>printf</tt>. In such situations, you
1314
+ may need to manually cast the object to the right type:</p>
1315
+ <pre>
1316
+ printf("%d", static_cast&lt;typename table::reference&gt;(table[i]));
1317
+ </pre>
1318
+
1319
+
1320
+ <h3><A NAME=io>Input/Output</A></h3>
1321
+
1322
+ <p>It is possible to save and restore <tt>sparsetable</tt> objects
1323
+ to disk. Storage takes place in two steps. The first writes the
1324
+ table metadata. The second writes the actual data.</p>
1325
+
1326
+ <p>To write a sparsetable to disk, first call <tt>write_metadata()</tt>
1327
+ on an open file pointer. This saves the sparsetable information in a
1328
+ byte-order-independent format.</p>
1329
+
1330
+ <p>After the metadata has been written to disk, you must write the
1331
+ actual data stored in the sparsetable to disk. If the value is
1332
+ "simple" enough, you can do this by calling
1333
+ <tt>write_nopointer_data()</tt>. "Simple" data is data that can be
1334
+ safely copied to disk via <tt>fwrite()</tt>. Native C data types fall
1335
+ into this category, as do structs of native C data types. Pointers
1336
+ and STL objects do not.</p>
1337
+
1338
+ <p>Note that <tt>write_nopointer_data()</tt> does not do any endian
1339
+ conversion. Thus, it is only appropriate when you intend to read the
1340
+ data on the same endian architecture as you write the data.</p>
1341
+
1342
+ <p>If you cannot use <tt>write_nopointer_data()</tt> for any reason,
1343
+ you can write the data yourself by iterating over the
1344
+ <tt>sparsetable</tt> with a <tt>const_nonempty_iterator</tt> and
1345
+ writing the key and data in any manner you wish.</p>
1346
+
1347
+ <p>To read the hashtable information from disk, first you must create
1348
+ a <tt>sparsetable</tt> object. Then open a file pointer to point
1349
+ to the saved sparsetable, and call <tt>read_metadata()</tt>. If you
1350
+ saved the data via <tt>write_nopointer_data()</tt>, you can follow the
1351
+ <tt>read_metadata()</tt> call with a call to
1352
+ <tt>read_nopointer_data()</tt>. This is all that is needed.</p>
1353
+
1354
+ <p>If you saved the data through a custom write routine, you must call
1355
+ a custom read routine to read in the data. To do this, iterate over
1356
+ the <tt>sparsetable</tt> with a <tt>nonempty_iterator</tt>; this
1357
+ operation is sensical because the metadata has already been set up.
1358
+ For each iterator item, you can read the key and value from disk, and
1359
+ set it appropriately. The code might look like this:</p>
1360
+ <pre>
1361
+ for (sparsetable&lt;int*&gt;::nonempty_iterator it = t.nonempty_begin();
1362
+ it != t.nonempty_end(); ++it) {
1363
+ *it = new int;
1364
+ fread(*it, sizeof(int), 1, fp);
1365
+ }
1366
+ </pre>
1367
+
1368
+ <p>Here's another example, where the item stored in the sparsetable is
1369
+ a C++ object with a non-trivial constructor. In this case, you must
1370
+ use "placement new" to construct the object at the correct memory
1371
+ location.</p>
1372
+ <pre>
1373
+ for (sparsetable&lt;ComplicatedCppClass&gt;::nonempty_iterator it = t.nonempty_begin();
1374
+ it != t.nonempty_end(); ++it) {
1375
+ int constructor_arg; // ComplicatedCppClass takes an int to construct
1376
+ fread(&constructor_arg, sizeof(int), 1, fp);
1377
+ new (&(*it)) ComplicatedCppClass(constructor_arg); // placement new
1378
+ }
1379
+ </pre>
1380
+
1381
+
1382
+ <h3>See also</h3>
1383
+
1384
+ <p>The following are SGI STL concepts and classes related to
1385
+ <tt>sparsetable</tt>.</p>
1386
+
1387
+ <A href="http://www.sgi.com/tech/stl/Container.html">Container</A>,
1388
+ <A href="http://www.sgi.com/tech/stl/RandomAccessContainer.html">Random Access Container</A>,
1389
+ <tt><A href="sparse_hash_set.html">sparse_hash_set</A></tt>,
1390
+ <tt><A href="sparse_hash_map.html">sparse_hash_map</A></tt>
1391
+
1392
+ </BODY>
1393
+ </HTML>