google_hash 0.6.2 → 0.7.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 (99) hide show
  1. data/README +61 -27
  2. data/Rakefile +4 -1
  3. data/TODO +5 -0
  4. data/VERSION +1 -1
  5. data/changelog +3 -0
  6. data/ext/extconf.rb +10 -5
  7. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/AUTHORS +0 -0
  8. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/COPYING +0 -0
  9. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/ChangeLog +47 -0
  10. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/INSTALL +0 -0
  11. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/Makefile.am +29 -14
  12. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/Makefile.in +77 -42
  13. data/ext/sparsehash-1.8.1/NEWS +71 -0
  14. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/README +0 -0
  15. data/ext/{sparsehash-1.5.2/README.windows → sparsehash-1.8.1/README_windows.txt} +25 -25
  16. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/TODO +0 -0
  17. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/aclocal.m4 +0 -0
  18. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/compile +0 -0
  19. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/config.guess +0 -0
  20. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/config.sub +0 -0
  21. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/configure +3690 -4560
  22. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/configure.ac +1 -1
  23. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/depcomp +0 -0
  24. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/doc/dense_hash_map.html +65 -5
  25. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/doc/dense_hash_set.html +65 -5
  26. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/doc/designstyle.css +0 -0
  27. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/doc/implementation.html +11 -5
  28. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/doc/index.html +0 -0
  29. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/doc/performance.html +0 -0
  30. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/doc/sparse_hash_map.html +65 -5
  31. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/doc/sparse_hash_set.html +65 -5
  32. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/doc/sparsetable.html +0 -0
  33. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/experimental/Makefile +0 -0
  34. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/experimental/README +0 -0
  35. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/experimental/example.c +0 -0
  36. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/experimental/libchash.c +0 -0
  37. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/experimental/libchash.h +0 -0
  38. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/google-sparsehash.sln +17 -1
  39. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/install-sh +0 -0
  40. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/m4/acx_pthread.m4 +0 -0
  41. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/m4/google_namespace.m4 +0 -0
  42. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/m4/namespaces.m4 +0 -0
  43. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/m4/stl_hash.m4 +0 -0
  44. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/m4/stl_hash_fun.m4 +0 -0
  45. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/m4/stl_namespace.m4 +0 -0
  46. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/missing +0 -0
  47. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/mkinstalldirs +0 -0
  48. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/packages/deb.sh +0 -0
  49. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/packages/deb/README +0 -0
  50. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/packages/deb/changelog +24 -0
  51. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/packages/deb/compat +0 -0
  52. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/packages/deb/control +1 -1
  53. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/packages/deb/copyright +0 -0
  54. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/packages/deb/docs +0 -0
  55. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/packages/deb/rules +0 -0
  56. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/packages/deb/sparsehash.dirs +0 -0
  57. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/packages/deb/sparsehash.install +0 -0
  58. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/packages/rpm.sh +0 -0
  59. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/packages/rpm/rpm.spec +1 -1
  60. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/config.h.in +3 -0
  61. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/config.h.include +0 -0
  62. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/google/dense_hash_map +43 -27
  63. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/google/dense_hash_set +40 -19
  64. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/google/sparse_hash_map +32 -23
  65. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/google/sparse_hash_set +31 -21
  66. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/google/sparsehash/densehashtable.h +481 -298
  67. data/ext/sparsehash-1.8.1/src/google/sparsehash/hashtable-common.h +178 -0
  68. data/ext/sparsehash-1.8.1/src/google/sparsehash/libc_allocator_with_realloc.h +121 -0
  69. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/google/sparsehash/sparsehashtable.h +404 -233
  70. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/google/sparsetable +173 -83
  71. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/google/type_traits.h +3 -29
  72. data/ext/sparsehash-1.8.1/src/hash_test_interface.h +1011 -0
  73. data/ext/sparsehash-1.8.1/src/hashtable_test.cc +1733 -0
  74. data/ext/sparsehash-1.8.1/src/libc_allocator_with_realloc_test.cc +129 -0
  75. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/simple_test.cc +1 -1
  76. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/sparsetable_unittest.cc +202 -6
  77. data/ext/sparsehash-1.8.1/src/testutil.h +251 -0
  78. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/time_hash_map.cc +128 -54
  79. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/type_traits_unittest.cc +30 -20
  80. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/windows/config.h +0 -0
  81. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/windows/google/sparsehash/sparseconfig.h +0 -0
  82. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/windows/port.cc +0 -0
  83. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/src/windows/port.h +0 -0
  84. data/ext/sparsehash-1.8.1/vsprojects/hashtable_test/hashtable_test.vcproj +197 -0
  85. data/ext/{sparsehash-1.5.2/vsprojects/hashtable_unittest/hashtable_unittest.vcproj → sparsehash-1.8.1/vsprojects/simple_test/simple_test.vcproj} +9 -8
  86. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/vsprojects/sparsetable_unittest/sparsetable_unittest.vcproj +0 -2
  87. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/vsprojects/time_hash_map/time_hash_map.vcproj +3 -2
  88. data/ext/{sparsehash-1.5.2 → sparsehash-1.8.1}/vsprojects/type_traits_unittest/type_traits_unittest.vcproj +0 -2
  89. data/ext/template/google_hash.cpp.erb +2 -1
  90. data/ext/template/main.cpp.erb +1 -1
  91. data/results.txt +6 -22
  92. data/spec/benchmark.rb +57 -0
  93. data/spec/spec.google_hash.rb +1 -8
  94. metadata +140 -130
  95. data/ext/benchmark.rb +0 -47
  96. data/ext/sparsehash-1.5.2/NEWS +0 -0
  97. data/ext/sparsehash-1.5.2/src/hashtable_unittest.cc +0 -1375
  98. data/ext/sparsehash-1.5.2/src/words +0 -8944
  99. data/types.txt +0 -18
@@ -4,7 +4,7 @@
4
4
  # make sure we're interpreted by some minimal autoconf
5
5
  AC_PREREQ(2.57)
6
6
 
7
- AC_INIT(sparsehash, 1.5.2, opensource@google.com)
7
+ AC_INIT(sparsehash, 1.8.1, opensource@google.com)
8
8
  # The argument here is just something that should be in the current directory
9
9
  # (for sanity checking)
10
10
  AC_CONFIG_SRCDIR(README)
@@ -174,7 +174,7 @@ compatible with the tr1 class <code>unordered_map</code>.
174
174
  <TD VAlign=top>
175
175
  The <A href="http://www.sgi.com/tech/stl/HashFunction.html">hash function</A> used by the
176
176
  hash_map. This is also defined as <tt>dense_hash_map::hasher</tt>.
177
- <br><b>Note:</b> Hashtable performance depends heavliy on the choice of
177
+ <br><b>Note:</b> Hashtable performance depends heavily on the choice of
178
178
  hash function. See <A HREF="performance.html#hashfn">the performance
179
179
  page</A> for more information.
180
180
  </TD>
@@ -203,8 +203,19 @@ compatible with the tr1 class <code>unordered_map</code>.
203
203
  <tt>Alloc</tt>
204
204
  </TD>
205
205
  <TD VAlign=top>
206
- <b>Ignored</b>; this is included only for API-compatibility
207
- with SGI's (and tr1's) STL implementation.
206
+ The STL allocator to use. By default, uses the provided allocator
207
+ <code>libc_allocator_with_realloc</code>, which likely gives better
208
+ performance than other STL allocators due to its built-in support
209
+ for <code>realloc</code>, which this container takes advantage of.
210
+ If you use an allocator other than the default, note that this
211
+ container imposes an additional requirement on the STL allocator
212
+ type beyond those in [lib.allocator.requirements]: it does not
213
+ support allocators that define alternate memory models. That is,
214
+ it assumes that <code>pointer</code>, <code>const_pointer</code>,
215
+ <code>size_type</code>, and <code>difference_type</code> are just
216
+ <code>T*</code>, <code>const T*</code>, <code>size_t</code>, and
217
+ <code>ptrdiff_t</code>, respectively. This is also defined as
218
+ <tt>dense_hash_map::allocator_type</tt>.
208
219
  </TD>
209
220
  <TD VAlign=top>
210
221
  </TD>
@@ -667,7 +678,7 @@ None.
667
678
 
668
679
  <TR>
669
680
  <TD VAlign=top>
670
- <tt>float max_load_factor(size_t new_grow)</tt>
681
+ <tt>void max_load_factor(float new_grow)</tt>
671
682
  </TD>
672
683
  <TD VAlign=top>
673
684
  <tt>Unordered Associative Container</tt> (tr1)
@@ -693,7 +704,7 @@ None.
693
704
 
694
705
  <TR>
695
706
  <TD VAlign=top>
696
- <tt>float min_load_factor(size_t new_grow)</tt>
707
+ <tt>void min_load_factor(float new_grow)</tt>
697
708
  </TD>
698
709
  <TD VAlign=top>
699
710
  <tt>dense_hash_map</tt>
@@ -787,6 +798,20 @@ None.
787
798
  </TD>
788
799
  </TR>
789
800
 
801
+ <TR>
802
+ <TD VAlign=top>
803
+ <tt>allocator_type get_allocator() const</tt>
804
+ </TD>
805
+ <TD VAlign=top>
806
+ <tt>Unordered Associative Container</tt> (tr1)
807
+ </TD>
808
+ <TD VAlign=top>
809
+ Returns the <tt>allocator_type</tt> object used by the
810
+ <tt>dense_hash_map</tt>: either the one passed in to the
811
+ constructor, or a default <tt>Alloc</tt> instance.
812
+ </TD>
813
+ </TR>
814
+
790
815
  <TR>
791
816
  <TD VAlign=top>
792
817
  <tt>dense_hash_map()</tt>
@@ -847,6 +872,22 @@ None.
847
872
  </TD>
848
873
  </TR>
849
874
 
875
+ <TR>
876
+ <TD VAlign=top>
877
+ <tt>dense_hash_map(size_type n, const hasher&amp; h, const
878
+ key_equal&amp; k, const allocator_type&amp; a)</tt>
879
+ </TD>
880
+ <TD VAlign=top>
881
+ <tt>Unordered Associative Container</tt> (tr1)
882
+ </TD>
883
+ <TD VAlign=top>
884
+ Creates an empty <tt>dense_hash_map</tt> that's optimized for up
885
+ to <tt>n</tt> items, using <tt>h</tt> as the hash function,
886
+ <tt>k</tt> as the key equal function, and <tt>a</tt> as the
887
+ allocator object.
888
+ </TD>
889
+ </TR>
890
+
850
891
  <TR>
851
892
  <TD VAlign=top>
852
893
  <pre>template &lt;class <A
@@ -919,6 +960,25 @@ hasher&amp; h, const key_equal&amp; k) </pre> <A href="#2">[2]</A>
919
960
  </TD>
920
961
  </TR>
921
962
 
963
+ <TR>
964
+ <TD VAlign=top>
965
+ <pre>template &lt;class <A
966
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
967
+ dense_hash_map(InputIterator f, InputIterator l, size_type n, const
968
+ hasher&amp; h, const key_equal&amp; k, const allocator_type&amp; a) </pre>
969
+ <A href="#2">[2]</A>
970
+ </TD>
971
+ <TD VAlign=top>
972
+ <tt>Unordered Associative Container</tt> (tr1)
973
+ </TD>
974
+ <TD VAlign=top>
975
+ Creates a hash_map with a copy of a range that's optimized for
976
+ holding up to <tt>n</tt> items, using <tt>h</tt> as the hash
977
+ function, <tt>k</tt> as the key equal function, and <tt>a</tt> as
978
+ the allocator object.
979
+ </TD>
980
+ </TR>
981
+
922
982
  <TR>
923
983
  <TD VAlign=top>
924
984
  <tt>dense_hash_map(const hash_map&amp;)</tt>
@@ -164,7 +164,7 @@ compatible with the tr1 class <code>unordered_set</code>.
164
164
  <TD VAlign=top>
165
165
  The <A href="http://www.sgi.com/tech/stl/HashFunction.html">hash function</A> used by the
166
166
  hash_set. This is also defined as <tt>dense_hash_set::hasher</tt>.
167
- <br><b>Note:</b> Hashtable performance depends heavliy on the choice of
167
+ <br><b>Note:</b> Hashtable performance depends heavily on the choice of
168
168
  hash function. See <A HREF="performance.html#hashfn">the performance
169
169
  page</A> for more information.
170
170
  </TD>
@@ -193,8 +193,19 @@ compatible with the tr1 class <code>unordered_set</code>.
193
193
  <tt>Alloc</tt>
194
194
  </TD>
195
195
  <TD VAlign=top>
196
- <b>Ignored</b>; this is included only for API-compatibility
197
- with SGI's (and tr1's) STL implementation.
196
+ The STL allocator to use. By default, uses the provided allocator
197
+ <code>libc_allocator_with_realloc</code>, which likely gives better
198
+ performance than other STL allocators due to its built-in support
199
+ for <code>realloc</code>, which this container takes advantage of.
200
+ If you use an allocator other than the default, note that this
201
+ container imposes an additional requirement on the STL allocator
202
+ type beyond those in [lib.allocator.requirements]: it does not
203
+ support allocators that define alternate memory models. That is,
204
+ it assumes that <code>pointer</code>, <code>const_pointer</code>,
205
+ <code>size_type</code>, and <code>difference_type</code> are just
206
+ <code>T*</code>, <code>const T*</code>, <code>size_t</code>, and
207
+ <code>ptrdiff_t</code>, respectively. This is also defined as
208
+ <tt>dense_hash_set::allocator_type</tt>.
198
209
  </TD>
199
210
  <TD VAlign=top>
200
211
  </TD>
@@ -615,7 +626,7 @@ None.
615
626
 
616
627
  <TR>
617
628
  <TD VAlign=top>
618
- <tt>float max_load_factor(size_t new_grow)</tt>
629
+ <tt>void max_load_factor(float new_grow)</tt>
619
630
  </TD>
620
631
  <TD VAlign=top>
621
632
  <tt>Unordered Associative Container</tt> (tr1)
@@ -641,7 +652,7 @@ None.
641
652
 
642
653
  <TR>
643
654
  <TD VAlign=top>
644
- <tt>float min_load_factor(size_t new_grow)</tt>
655
+ <tt>void min_load_factor(float new_grow)</tt>
645
656
  </TD>
646
657
  <TD VAlign=top>
647
658
  <tt>dense_hash_set</tt>
@@ -735,6 +746,20 @@ None.
735
746
  </TD>
736
747
  </TR>
737
748
 
749
+ <TR>
750
+ <TD VAlign=top>
751
+ <tt>allocator_type get_allocator() const</tt>
752
+ </TD>
753
+ <TD VAlign=top>
754
+ <tt>Unordered Associative Container</tt> (tr1)
755
+ </TD>
756
+ <TD VAlign=top>
757
+ Returns the <tt>allocator_type</tt> object used by the
758
+ <tt>dense_hash_set</tt>: either the one passed in to the
759
+ constructor, or a default <tt>Alloc</tt> instance.
760
+ </TD>
761
+ </TR>
762
+
738
763
  <TR>
739
764
  <TD VAlign=top>
740
765
  <tt>dense_hash_set()</tt>
@@ -795,6 +820,22 @@ None.
795
820
  </TD>
796
821
  </TR>
797
822
 
823
+ <TR>
824
+ <TD VAlign=top>
825
+ <tt>dense_hash_set(size_type n, const hasher&amp; h, const
826
+ key_equal&amp; k, const allocator_type&amp; a)</tt>
827
+ </TD>
828
+ <TD VAlign=top>
829
+ <tt>Unordered Associative Container</tt> (tr1)
830
+ </TD>
831
+ <TD VAlign=top>
832
+ Creates an empty <tt>dense_hash_set</tt> that's optimized for up
833
+ to <tt>n</tt> items, using <tt>h</tt> as the hash function,
834
+ <tt>k</tt> as the key equal function, and <tt>a</tt> as the
835
+ allocator object.
836
+ </TD>
837
+ </TR>
838
+
798
839
  <TR>
799
840
  <TD VAlign=top>
800
841
  <pre>template &lt;class <A
@@ -867,6 +908,25 @@ hasher&amp; h, const key_equal&amp; k) </pre> <A href="#1">[2]</A>
867
908
  </TD>
868
909
  </TR>
869
910
 
911
+ <TR>
912
+ <TD VAlign=top>
913
+ <pre>template &lt;class <A
914
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
915
+ dense_hash_set(InputIterator f, InputIterator l, size_type n, const
916
+ hasher&amp; h, const key_equal&amp; k, const allocator_type&amp; a) </pre>
917
+ <A href="#2">[2]</A>
918
+ </TD>
919
+ <TD VAlign=top>
920
+ <tt>Unordered Associative Container</tt> (tr1)
921
+ </TD>
922
+ <TD VAlign=top>
923
+ Creates a hash_set with a copy of a range that's optimized for
924
+ holding up to <tt>n</tt> items, using <tt>h</tt> as the hash
925
+ function, <tt>k</tt> as the key equal function, and <tt>a</tt> as
926
+ the allocator object.
927
+ </TD>
928
+ </TR>
929
+
870
930
  <TR>
871
931
  <TD VAlign=top>
872
932
  <tt>dense_hash_set(const hash_set&amp;)</tt>
@@ -271,11 +271,17 @@ copy-time rehash makes them unnecessary.</p>
271
271
  <h3>Resource use</h3>
272
272
 
273
273
  <p>The data is stored in a sparsetable, so space use is the same as
274
- for sparsetable. Time use is also determined in large part by the
275
- sparsetable implementation. However, there is also an extra probing
276
- cost in hashtables, which depends in large part on the "too full"
277
- value. It should be rare to need more than 4-5 probes per lookup, and
278
- usually significantly less will suffice.</p>
274
+ for sparsetable. However, by default the sparse_hash_set
275
+ implementation tries to keep about half the table buckets empty, to
276
+ keep lookup-chains short. Since sparsehashmap has about 2 bits
277
+ overhead per bucket (or 2.5 bits on 64-bit systems), sparse_hash_map
278
+ has about 4-5 bits overhead per hashtable item.</p>
279
+
280
+ <p>Time use is also determined in large part by the sparsetable
281
+ implementation. However, there is also an extra probing cost in
282
+ hashtables, which depends in large part on the "too full" value. It
283
+ should be rare to need more than 4-5 probes per lookup, and usually
284
+ significantly less will suffice.</p>
279
285
 
280
286
  <p>A note on growing and shrinking the hashtable: all hashtable
281
287
  implementations use the most memory when growing a hashtable, since
@@ -172,7 +172,7 @@ compatible with the tr1 class <code>unordered_map</code>.
172
172
  <TD VAlign=top>
173
173
  The <A href="http://www.sgi.com/tech/stl/HashFunction.html">hash function</A> used by the
174
174
  hash_map. This is also defined as <tt>sparse_hash_map::hasher</tt>.
175
- <br><b>Note:</b> Hashtable performance depends heavliy on the choice of
175
+ <br><b>Note:</b> Hashtable performance depends heavily on the choice of
176
176
  hash function. See <A HREF="performance.html#hashfn">the performance
177
177
  page</A> for more information.
178
178
  </TD>
@@ -201,8 +201,19 @@ compatible with the tr1 class <code>unordered_map</code>.
201
201
  <tt>Alloc</tt>
202
202
  </TD>
203
203
  <TD VAlign=top>
204
- <b>Ignored</b>; this is included only for API-compatibility
205
- with SGI's (and tr1's) STL implementation.
204
+ The STL allocator to use. By default, uses the provided allocator
205
+ <code>libc_allocator_with_realloc</code>, which likely gives better
206
+ performance than other STL allocators due to its built-in support
207
+ for <code>realloc</code>, which this container takes advantage of.
208
+ If you use an allocator other than the default, note that this
209
+ container imposes an additional requirement on the STL allocator
210
+ type beyond those in [lib.allocator.requirements]: it does not
211
+ support allocators that define alternate memory models. That is,
212
+ it assumes that <code>pointer</code>, <code>const_pointer</code>,
213
+ <code>size_type</code>, and <code>difference_type</code> are just
214
+ <code>T*</code>, <code>const T*</code>, <code>size_t</code>, and
215
+ <code>ptrdiff_t</code>, respectively. This is also defined as
216
+ <tt>sparse_hash_map::allocator_type</tt>.
206
217
  </TD>
207
218
  <TD VAlign=top>
208
219
  </TD>
@@ -665,7 +676,7 @@ None.
665
676
 
666
677
  <TR>
667
678
  <TD VAlign=top>
668
- <tt>float max_load_factor(size_t new_grow)</tt>
679
+ <tt>void max_load_factor(float new_grow)</tt>
669
680
  </TD>
670
681
  <TD VAlign=top>
671
682
  <tt>Unordered Associative Container</tt> (tr1)
@@ -691,7 +702,7 @@ None.
691
702
 
692
703
  <TR>
693
704
  <TD VAlign=top>
694
- <tt>float min_load_factor(size_t new_grow)</tt>
705
+ <tt>void min_load_factor(float new_grow)</tt>
695
706
  </TD>
696
707
  <TD VAlign=top>
697
708
  <tt>sparse_hash_map</tt>
@@ -785,6 +796,20 @@ None.
785
796
  </TD>
786
797
  </TR>
787
798
 
799
+ <TR>
800
+ <TD VAlign=top>
801
+ <tt>allocator_type get_allocator() const</tt>
802
+ </TD>
803
+ <TD VAlign=top>
804
+ <tt>Unordered Associative Container</tt> (tr1)
805
+ </TD>
806
+ <TD VAlign=top>
807
+ Returns the <tt>allocator_type</tt> object used by the
808
+ <tt>sparse_hash_map</tt>: either the one passed in to the
809
+ constructor, or a default <tt>Alloc</tt> instance.
810
+ </TD>
811
+ </TR>
812
+
788
813
  <TR>
789
814
  <TD VAlign=top>
790
815
  <tt>sparse_hash_map()</tt>
@@ -845,6 +870,22 @@ None.
845
870
  </TD>
846
871
  </TR>
847
872
 
873
+ <TR>
874
+ <TD VAlign=top>
875
+ <tt>sparse_hash_map(size_type n, const hasher&amp; h, const
876
+ key_equal&amp; k, const allocator_type&amp; a)</tt>
877
+ </TD>
878
+ <TD VAlign=top>
879
+ <tt>Unordered Associative Container</tt> (tr1)
880
+ </TD>
881
+ <TD VAlign=top>
882
+ Creates an empty <tt>sparse_hash_map</tt> that's optimized for up
883
+ to <tt>n</tt> items, using <tt>h</tt> as the hash function,
884
+ <tt>k</tt> as the key equal function, and <tt>a</tt> as the
885
+ allocator object.
886
+ </TD>
887
+ </TR>
888
+
848
889
  <TR>
849
890
  <TD VAlign=top>
850
891
  <pre>template &lt;class <A
@@ -917,6 +958,25 @@ hasher&amp; h, const key_equal&amp; k) </pre> <A href="#2">[2]</A>
917
958
  </TD>
918
959
  </TR>
919
960
 
961
+ <TR>
962
+ <TD VAlign=top>
963
+ <pre>template &lt;class <A
964
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
965
+ sparse_hash_map(InputIterator f, InputIterator l, size_type n, const
966
+ hasher&amp; h, const key_equal&amp; k, const allocator_type&amp; a) </pre>
967
+ <A href="#2">[2]</A>
968
+ </TD>
969
+ <TD VAlign=top>
970
+ <tt>Unordered Associative Container</tt> (tr1)
971
+ </TD>
972
+ <TD VAlign=top>
973
+ Creates a hash_map with a copy of a range that's optimized for
974
+ holding up to <tt>n</tt> items, using <tt>h</tt> as the hash
975
+ function, <tt>k</tt> as the key equal function, and <tt>a</tt> as
976
+ the allocator object.
977
+ </TD>
978
+ </TR>
979
+
920
980
  <TR>
921
981
  <TD VAlign=top>
922
982
  <tt>sparse_hash_map(const hash_map&amp;)</tt>
@@ -162,7 +162,7 @@ compatible with the tr1 class <code>unordered_set</code>.
162
162
  <TD VAlign=top>
163
163
  The <A href="http://www.sgi.com/tech/stl/HashFunction.html">hash function</A> used by the
164
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
165
+ <br><b>Note:</b> Hashtable performance depends heavily on the choice of
166
166
  hash function. See <A HREF="performance.html#hashfn">the performance
167
167
  page</A> for more information.
168
168
  </TD>
@@ -191,8 +191,19 @@ compatible with the tr1 class <code>unordered_set</code>.
191
191
  <tt>Alloc</tt>
192
192
  </TD>
193
193
  <TD VAlign=top>
194
- <b>Ignored</b>; this is included only for API-compatibility
195
- with SGI's (and tr1's) STL implementation.
194
+ The STL allocator to use. By default, uses the provided allocator
195
+ <code>libc_allocator_with_realloc</code>, which likely gives better
196
+ performance than other STL allocators due to its built-in support
197
+ for <code>realloc</code>, which this container takes advantage of.
198
+ If you use an allocator other than the default, note that this
199
+ container imposes an additional requirement on the STL allocator
200
+ type beyond those in [lib.allocator.requirements]: it does not
201
+ support allocators that define alternate memory models. That is,
202
+ it assumes that <code>pointer</code>, <code>const_pointer</code>,
203
+ <code>size_type</code>, and <code>difference_type</code> are just
204
+ <code>T*</code>, <code>const T*</code>, <code>size_t</code>, and
205
+ <code>ptrdiff_t</code>, respectively. This is also defined as
206
+ <tt>sparse_hash_set::allocator_type</tt>.
196
207
  </TD>
197
208
  <TD VAlign=top>
198
209
  </TD>
@@ -613,7 +624,7 @@ None.
613
624
 
614
625
  <TR>
615
626
  <TD VAlign=top>
616
- <tt>float max_load_factor(size_t new_grow)</tt>
627
+ <tt>void max_load_factor(float new_grow)</tt>
617
628
  </TD>
618
629
  <TD VAlign=top>
619
630
  <tt>Unordered Associative Container</tt> (tr1)
@@ -639,7 +650,7 @@ None.
639
650
 
640
651
  <TR>
641
652
  <TD VAlign=top>
642
- <tt>float min_load_factor(size_t new_grow)</tt>
653
+ <tt>void min_load_factor(float new_grow)</tt>
643
654
  </TD>
644
655
  <TD VAlign=top>
645
656
  <tt>sparse_hash_set</tt>
@@ -733,6 +744,20 @@ None.
733
744
  </TD>
734
745
  </TR>
735
746
 
747
+ <TR>
748
+ <TD VAlign=top>
749
+ <tt>allocator_type get_allocator() const</tt>
750
+ </TD>
751
+ <TD VAlign=top>
752
+ <tt>Unordered Associative Container</tt> (tr1)
753
+ </TD>
754
+ <TD VAlign=top>
755
+ Returns the <tt>allocator_type</tt> object used by the
756
+ <tt>sparse_hash_set</tt>: either the one passed in to the
757
+ constructor, or a default <tt>Alloc</tt> instance.
758
+ </TD>
759
+ </TR>
760
+
736
761
  <TR>
737
762
  <TD VAlign=top>
738
763
  <tt>sparse_hash_set()</tt>
@@ -793,6 +818,22 @@ None.
793
818
  </TD>
794
819
  </TR>
795
820
 
821
+ <TR>
822
+ <TD VAlign=top>
823
+ <tt>sparse_hash_set(size_type n, const hasher&amp; h, const
824
+ key_equal&amp; k, const allocator_type&amp; a)</tt>
825
+ </TD>
826
+ <TD VAlign=top>
827
+ <tt>Unordered Associative Container</tt> (tr1)
828
+ </TD>
829
+ <TD VAlign=top>
830
+ Creates an empty <tt>sparse_hash_set</tt> that's optimized for up
831
+ to <tt>n</tt> items, using <tt>h</tt> as the hash function,
832
+ <tt>k</tt> as the key equal function, and <tt>a</tt> as the
833
+ allocator object.
834
+ </TD>
835
+ </TR>
836
+
796
837
  <TR>
797
838
  <TD VAlign=top>
798
839
  <pre>template &lt;class <A
@@ -865,6 +906,25 @@ hasher&amp; h, const key_equal&amp; k) </pre> <A href="#1">[2]</A>
865
906
  </TD>
866
907
  </TR>
867
908
 
909
+ <TR>
910
+ <TD VAlign=top>
911
+ <pre>template &lt;class <A
912
+ href="http://www.sgi.com/tech/stl/InputIterator.html">InputIterator</A>&gt;
913
+ sparse_hash_set(InputIterator f, InputIterator l, size_type n, const
914
+ hasher&amp; h, const key_equal&amp; k, const allocator_type&amp; a) </pre>
915
+ <A href="#2">[2]</A>
916
+ </TD>
917
+ <TD VAlign=top>
918
+ <tt>Unordered Associative Container</tt> (tr1)
919
+ </TD>
920
+ <TD VAlign=top>
921
+ Creates a hash_set with a copy of a range that's optimized for
922
+ holding up to <tt>n</tt> items, using <tt>h</tt> as the hash
923
+ function, <tt>k</tt> as the key equal function, and <tt>a</tt> as
924
+ the allocator object.
925
+ </TD>
926
+ </TR>
927
+
868
928
  <TR>
869
929
  <TD VAlign=top>
870
930
  <tt>sparse_hash_set(const hash_set&amp;)</tt>