diff options
author | Abseil Team <absl-team@google.com> | 2020-04-01 07:32:27 -0700 |
---|---|---|
committer | Andy Getz <durandal@google.com> | 2020-04-01 15:19:51 -0400 |
commit | 62f05b1f57ad660e9c09e02ce7d591dcc4d0ca08 (patch) | |
tree | 10a1a50cbca0f6c1d26bab3d5278999979a565b7 /absl/types | |
parent | fba8a316c30690097de5d6127ad307d84a1b74ca (diff) |
Export of internal Abseil changes
--
3e6352709da9a529e608eabff862a12bfaecb587 by Gennadiy Rozental <rogeeff@google.com>:
Replace local copy of FastTypeId with one shared in absl/base/internal.
PiperOrigin-RevId: 304181357
--
c89ea428f732226f4dceb508cd6ba3955a1e49e1 by Andy Getzendanner <durandal@google.com>:
Typo fix: add a missing colon.
PiperOrigin-RevId: 304064210
--
de2ee7a96bdc7193ffcceb6a2fd6bf464955cbe7 by Samuel Benzaquen <sbenza@google.com>:
Reduce the overhead of the registration token by using an empty struct instead
of bool.
PiperOrigin-RevId: 304054311
--
222f05d24fb1df7e815946543a7dc78847c83f92 by Derek Mauro <dmauro@google.com>:
Turn off hashtablez in opensource builds.
Hashtablez is an unsupported, internal-only feature for collecting
information about hashtable usage and performance. By turning it off
in builds where it is unsupported, we get just a little more performance.
PiperOrigin-RevId: 304035460
GitOrigin-RevId: 3e6352709da9a529e608eabff862a12bfaecb587
Change-Id: I0bfe9b5df808a7e35c154b39e6c80e68b0da2b70
Diffstat (limited to 'absl/types')
-rw-r--r-- | absl/types/BUILD.bazel | 1 | ||||
-rw-r--r-- | absl/types/CMakeLists.txt | 1 | ||||
-rw-r--r-- | absl/types/any.h | 25 |
3 files changed, 5 insertions, 22 deletions
diff --git a/absl/types/BUILD.bazel b/absl/types/BUILD.bazel index f2ea9f39..c64417cc 100644 --- a/absl/types/BUILD.bazel +++ b/absl/types/BUILD.bazel @@ -35,6 +35,7 @@ cc_library( ":bad_any_cast", "//absl/base:config", "//absl/base:core_headers", + "//absl/base:fast_type_id", "//absl/meta:type_traits", "//absl/utility", ], diff --git a/absl/types/CMakeLists.txt b/absl/types/CMakeLists.txt index c7c88250..1b4d453b 100644 --- a/absl/types/CMakeLists.txt +++ b/absl/types/CMakeLists.txt @@ -24,6 +24,7 @@ absl_cc_library( absl::bad_any_cast absl::config absl::core_headers + absl::fast_type_id absl::type_traits absl::utility PUBLIC diff --git a/absl/types/any.h b/absl/types/any.h index 16bda79c..7eed5197 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 // |