From 80e86220abe7222d84f926f97f04097d920c8c04 Mon Sep 17 00:00:00 2001 From: madisetti Date: Tue, 19 May 2020 19:21:16 -0400 Subject: [PATCH] Added Absl hash guards --- parallel_hashmap/phmap_fwd_decl.h | 4 ++-- parallel_hashmap/phmap_utils.h | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/parallel_hashmap/phmap_fwd_decl.h b/parallel_hashmap/phmap_fwd_decl.h index 482dbab..f90417d 100644 --- a/parallel_hashmap/phmap_fwd_decl.h +++ b/parallel_hashmap/phmap_fwd_decl.h @@ -21,14 +21,14 @@ #include #include -#if defined(PHMAP_USE_ABSL_HASH) +#if defined(PHMAP_USE_ABSL_HASH) && !defined(ABSL_HASH_HASH_H_) namespace absl { template struct Hash; }; #endif namespace phmap { #if defined(PHMAP_USE_ABSL_HASH) - template using Hash = absl::Hash; + template using Hash = ::absl::Hash; #else template struct Hash; #endif diff --git a/parallel_hashmap/phmap_utils.h b/parallel_hashmap/phmap_utils.h index 0f38efa..72d4e71 100644 --- a/parallel_hashmap/phmap_utils.h +++ b/parallel_hashmap/phmap_utils.h @@ -33,6 +33,13 @@ #include #include "phmap_bits.h" +// --------------------------------------------------------------- +// Absl forward declaration requires global scope. +// --------------------------------------------------------------- +#if defined(PHMAP_USE_ABSL_HASH) && !defined(phmap_fwd_decl_h_guard_) && !defined(ABSL_HASH_HASH_H_) + namespace absl { template struct Hash; }; +#endif + namespace phmap { @@ -132,9 +139,8 @@ public: }; #if defined(PHMAP_USE_ABSL_HASH) && !defined(phmap_fwd_decl_h_guard_) - namespace absl { template struct Hash; }; - template using Hash = absl::Hash; -#else + template using Hash = ::absl::Hash; +#elif !defined(PHMAP_USE_ABSL_HASH) // --------------------------------------------------------------- // phmap::Hash // ---------------------------------------------------------------