| Index: base/containers/hash_tables.h
|
| diff --git a/base/containers/hash_tables.h b/base/containers/hash_tables.h
|
| index 8da7b6726852d2c762c6c2ff9ad5035d7450e5ba..428334fc8a0b0ca87d5c89052d1e39132944ea11 100644
|
| --- a/base/containers/hash_tables.h
|
| +++ b/base/containers/hash_tables.h
|
| @@ -40,12 +40,19 @@ struct hash<std::pair<Type1, Type2>> {
|
|
|
| namespace base {
|
|
|
| +#if defined(_LIBCPP_COUNTING_ALLOCATOR)
|
| +#define HASH_CONTAINER_ALLOCATOR(group, type...) \
|
| + std::counting_allocator<type, std::allocation_group::group>
|
| +#else
|
| +#define HASH_CONTAINER_ALLOCATOR(group, type...) std::allocator<type>
|
| +#endif
|
| +
|
| // Use std::unordered_map instead.
|
| template <class Key,
|
| class T,
|
| class Hash = BASE_HASH_NAMESPACE::hash<Key>,
|
| class Pred = std::equal_to<Key>,
|
| - class Alloc = std::allocator<std::pair<const Key, T>>>
|
| + class Alloc = HASH_CONTAINER_ALLOCATOR(unordered_map, std::pair<const Key, T>)>
|
| using hash_map = std::unordered_map<Key, T, Hash, Pred, Alloc>;
|
|
|
| // Use std::unordered_multimap instead.
|
| @@ -53,23 +60,25 @@ template <class Key,
|
| class T,
|
| class Hash = BASE_HASH_NAMESPACE::hash<Key>,
|
| class Pred = std::equal_to<Key>,
|
| - class Alloc = std::allocator<std::pair<const Key, T>>>
|
| + class Alloc = HASH_CONTAINER_ALLOCATOR(unordered_multimap, std::pair<const Key, T>)>
|
| using hash_multimap = std::unordered_multimap<Key, T, Hash, Pred, Alloc>;
|
|
|
| // Use std::unordered_multiset instead.
|
| template <class Key,
|
| class Hash = BASE_HASH_NAMESPACE::hash<Key>,
|
| class Pred = std::equal_to<Key>,
|
| - class Alloc = std::allocator<Key>>
|
| + class Alloc = HASH_CONTAINER_ALLOCATOR(unordered_multiset, Key)>
|
| using hash_multiset = std::unordered_multiset<Key, Hash, Pred, Alloc>;
|
|
|
| // Use std::unordered_set instead.
|
| template <class Key,
|
| class Hash = BASE_HASH_NAMESPACE::hash<Key>,
|
| class Pred = std::equal_to<Key>,
|
| - class Alloc = std::allocator<Key>>
|
| + class Alloc = HASH_CONTAINER_ALLOCATOR(unordered_set, Key)>
|
| using hash_set = std::unordered_set<Key, Hash, Pred, Alloc>;
|
|
|
| +#undef HASH_CONTAINER_ALLOCATOR
|
| +
|
| } // namespace base
|
|
|
| #endif // BASE_CONTAINERS_HASH_TABLES_H_
|
|
|