diff options
Diffstat (limited to 'absl/types/any.h')
-rw-r--r-- | absl/types/any.h | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/absl/types/any.h b/absl/types/any.h index 16bda79cc7f3..7eed5197913f 100644 --- a/absl/types/any.h +++ b/absl/types/any.h @@ -80,6 +80,7 @@ ABSL_NAMESPACE_END #include <typeinfo> #include <utility> +#include "absl/base/internal/fast_type_id.h" #include "absl/base/macros.h" #include "absl/meta/type_traits.h" #include "absl/types/bad_any_cast.h" @@ -95,26 +96,6 @@ ABSL_NAMESPACE_END namespace absl { ABSL_NAMESPACE_BEGIN -namespace any_internal { - -template <typename Type> -struct TypeTag { - constexpr static char dummy_var = 0; -}; - -template <typename Type> -constexpr char TypeTag<Type>::dummy_var; - -// FastTypeId<Type>() evaluates at compile/link-time to a unique pointer for the -// passed in type. These are meant to be good match for keys into maps or -// straight up comparisons. -template<typename Type> -constexpr inline const void* FastTypeId() { - return &TypeTag<Type>::dummy_var; -} - -} // namespace any_internal - class any; // swap() @@ -423,11 +404,11 @@ class any { using NormalizedType = typename std::remove_cv<typename std::remove_reference<T>::type>::type; - return any_internal::FastTypeId<NormalizedType>(); + return base_internal::FastTypeId<NormalizedType>(); } const void* GetObjTypeId() const { - return obj_ ? obj_->ObjTypeId() : any_internal::FastTypeId<void>(); + return obj_ ? obj_->ObjTypeId() : base_internal::FastTypeId<void>(); } // `absl::any` nonmember functions // |