Index: base/containers/small_map.h |
diff --git a/base/containers/small_map.h b/base/containers/small_map.h |
index db27b88127c89b5b30c4484d754af4f6f731e585..f3056c0fbfe84a17423564feecf15ccd3527e21a 100644 |
--- a/base/containers/small_map.h |
+++ b/base/containers/small_map.h |
@@ -11,7 +11,6 @@ |
#include <string> |
#include <utility> |
-#include "base/containers/hash_tables.h" |
#include "base/logging.h" |
#include "base/memory/manual_constructor.h" |
@@ -47,9 +46,9 @@ namespace base { |
// you should consider on of the other options. |
// |
// base::small_map will pick up the comparator from the underlying map type. In |
-// std::map (and in MSVC additionally hash_map) only a "less" operator is |
-// defined, which requires us to do two comparisons per element when doing the |
-// brute-force search in the simple array. |
+// std::map a "less" operator is defined, which requires us to do two |
+// comparisons per element when doing the brute-force search in the simple |
+// array. |
// |
// We define default overrides for the common map types to avoid this |
// double-compare, but you should be aware of this if you use your own |
@@ -68,10 +67,10 @@ namespace base { |
// allocated with the small_map object rather than separately on |
// the heap. Once the map grows beyond this size, the map type |
// will be used instead. |
-// EqualKey: A functor which tests two keys for equality. If the wrapped |
-// map type has a "key_equal" member (hash_map does), then that will |
-// be used by default. If the wrapped map type has a strict weak |
-// ordering "key_compare" (std::map does), that will be used to |
+// EqualKey: A functor which tests two keys for equality. If the wrapped |
+// map type has a "key_equal" member (unordered_map does), then that |
+// will be used by default. If the wrapped map type has a strict |
+// weak ordering "key_compare" (std::map does), that will be used to |
// implement equality by default. |
// MapInit: A functor that takes a ManualConstructor<NormalMap>* and uses it to |
// initialize the map. This functor will be called at most once per |
@@ -142,20 +141,9 @@ struct select_equal_key { |
// Provide overrides to use operator== for key compare for the "normal" map and |
// hash map types. If you override the default comparator or allocator for a |
-// map or hash_map, or use another type of map, this won't get used. |
-// |
-// If we switch to using std::unordered_map for base::hash_map, then the |
-// hash_map specialization can be removed. |
-template <typename KeyType, typename ValueType> |
-struct select_equal_key< std::map<KeyType, ValueType>, false> { |
- struct equal_key { |
- bool operator()(const KeyType& left, const KeyType& right) { |
- return left == right; |
- } |
- }; |
-}; |
+// map or unordered_map, or use another type of map, this won't get used. |
template <typename KeyType, typename ValueType> |
-struct select_equal_key< base::hash_map<KeyType, ValueType>, false> { |
+struct select_equal_key<std::map<KeyType, ValueType>, false> { |
struct equal_key { |
bool operator()(const KeyType& left, const KeyType& right) { |
return left == right; |
@@ -164,7 +152,7 @@ struct select_equal_key< base::hash_map<KeyType, ValueType>, false> { |
}; |
// Partial template specialization handles case where M::key_equal exists, e.g., |
-// hash_map<>. |
+// unordered_map<>. |
template <typename M> |
struct select_equal_key<M, true> { |
typedef typename M::key_equal equal_key; |
@@ -562,7 +550,7 @@ class small_map { |
} |
private: |
- int size_; // negative = using hash_map |
+ int size_; // negative = using map |
Łukasz Anforowicz
2017/04/24 18:46:10
nit: s/using map/using |map_| instead of |array_|.
|
MapInit functor_; |