diff options
Diffstat (limited to 'absl/container/node_hash_map.h')
-rw-r--r-- | absl/container/node_hash_map.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/absl/container/node_hash_map.h b/absl/container/node_hash_map.h index cb41543c..acc21542 100644 --- a/absl/container/node_hash_map.h +++ b/absl/container/node_hash_map.h @@ -37,11 +37,15 @@ #define ABSL_CONTAINER_NODE_HASH_MAP_H_ #include <cstddef> +#include <cstdint> +#include <memory> +#include <string> #include <tuple> #include <type_traits> #include <utility> #include "absl/algorithm/container.h" +#include "absl/base/config.h" #include "absl/base/macros.h" #include "absl/container/internal/container_memory.h" #include "absl/container/internal/hash_function_defaults.h" // IWYU pragma: export @@ -623,6 +627,42 @@ struct IsUnorderedContainer< } // namespace container_algorithm_internal +// Explicit template instantiations for common map types in order to decrease +// linker input size. Note that explicitly instantiating node_hash_map itself +// doesn't help because it has no non-alias members. If we need to decrease +// linker input size more, we could potentially (a) add more key/value types, +// e.g. string_view/Cord, (b) instantiate some template member functions, e.g. +// operator[]/find. The EXTERN argument is `extern` for the declaration and +// empty for the definition. +#define ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(TEMPLATE, KEY, VALUE) \ + TEMPLATE class absl::container_internal::raw_hash_map< \ + absl::container_internal::NodeHashMapPolicy<KEY, VALUE>, \ + absl::container_internal::hash_default_hash<KEY>, \ + absl::container_internal::hash_default_eq<KEY>, \ + std::allocator<std::pair<const KEY, VALUE>>>; \ + TEMPLATE class absl::container_internal::raw_hash_set< \ + absl::container_internal::NodeHashMapPolicy<KEY, VALUE>, \ + absl::container_internal::hash_default_hash<KEY>, \ + absl::container_internal::hash_default_eq<KEY>, \ + std::allocator<std::pair<const KEY, VALUE>>>; + +// We use exact-width integer types rather than `int`/`long`/`long long` because +// these are the types recommended in the Google C++ style guide and which are +// commonly used in Google code. +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, int32_t, int32_t); +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, std::string, int32_t); +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, int32_t, std::string); +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, int64_t, int64_t); +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, std::string, int64_t); +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, int64_t, std::string); +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, uint32_t, uint32_t); +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, std::string, uint32_t); +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, uint32_t, std::string); +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, uint64_t, uint64_t); +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, std::string, uint64_t); +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, uint64_t, std::string); +ABSL_INTERNAL_TEMPLATE_NODE_HASH_MAP(extern template, std::string, std::string); + ABSL_NAMESPACE_END } // namespace absl |