diff options
author | Dennis Kormalev <denk@google.com> | 2024-04-24 14:05:14 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-04-24 14:06:05 -0700 |
commit | 08b21bd037990c18d44fda1691211e73835bf214 (patch) | |
tree | dcc50e661487803c63501710f3cc3fd965651f43 /absl/container/flat_hash_map.h | |
parent | b0160ba46be86c3728b5e72a194c34f166740af1 (diff) | |
download | abseil-08b21bd037990c18d44fda1691211e73835bf214.tar.gz abseil-08b21bd037990c18d44fda1691211e73835bf214.tar.bz2 abseil-08b21bd037990c18d44fda1691211e73835bf214.zip |
Add public aliases for default hash/eq types in hash-based containers
Generic user code sometimes wants to provide more flexibility for its
own users and provide type arguments that are used as Hash/Eq in
underlying containers.
However, there is no sensible publicly available default value for it
yet.
This CL fixes this issue and provides publicly visible aliases that such
user code can use.
PiperOrigin-RevId: 627844757
Change-Id: I4c393007244ad8d998da02883c623eae1715c0df
Diffstat (limited to 'absl/container/flat_hash_map.h')
-rw-r--r-- | absl/container/flat_hash_map.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/absl/container/flat_hash_map.h b/absl/container/flat_hash_map.h index a33c794f..aa2c5c8c 100644 --- a/absl/container/flat_hash_map.h +++ b/absl/container/flat_hash_map.h @@ -31,16 +31,15 @@ #define ABSL_CONTAINER_FLAT_HASH_MAP_H_ #include <cstddef> -#include <new> +#include <memory> #include <type_traits> #include <utility> #include "absl/algorithm/container.h" #include "absl/base/macros.h" +#include "absl/container/hash_container_defaults.h" #include "absl/container/internal/container_memory.h" -#include "absl/container/internal/hash_function_defaults.h" // IWYU pragma: export #include "absl/container/internal/raw_hash_map.h" // IWYU pragma: export -#include "absl/memory/memory.h" namespace absl { ABSL_NAMESPACE_BEGIN @@ -119,9 +118,8 @@ struct FlatHashMapPolicy; // if (result != ducks.end()) { // std::cout << "Result: " << result->second << std::endl; // } -template <class K, class V, - class Hash = absl::container_internal::hash_default_hash<K>, - class Eq = absl::container_internal::hash_default_eq<K>, +template <class K, class V, class Hash = DefaultHashContainerHash<K>, + class Eq = DefaultHashContainerEq<K>, class Allocator = std::allocator<std::pair<const K, V>>> class flat_hash_map : public absl::container_internal::raw_hash_map< absl::container_internal::FlatHashMapPolicy<K, V>, |