From b56cbdd23834a65682c0b46f367f8679e83bc894 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Fri, 18 Sep 2020 15:55:15 -0700 Subject: Abseil LTS 20200923 What's New: * `absl::StatusOr` has been released. See our [blog post](https://abseil.io/blog/2020-091021-status) for more information. * Abseil Flags reflection interfaces have been released. * Abseil Flags memory usage has been significantly optimized. * Abseil now supports a "hardened" build mode. This build mode enables runtime checks that guard against programming errors that may lead to security vulnerabilities. Notable Fixes: * Sanitizer dynamic annotations like `AnnotateRWLockCreate` that are also defined by the compiler sanitizer implementation are no longer also defined by Abseil. * Sanitizer macros are now prefixed with `ABSL_` to avoid naming collisions. * Sanitizer usage is now automatically detected and no longer requires macros like `ADDRESS_SANITIZER` to be defined on the command line. Breaking Changes: * Abseil no longer contains a `dynamic_annotations` library. Users using a supported build system (Bazel or CMake) are unaffected by this, but users manually specifying link libraries may get an error about a missing linker input. Baseline: 7680a5f8efe32de4753baadbd63e74e59d95bac1 Cherry picks: None --- absl/types/any.h | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'absl/types/any.h') diff --git a/absl/types/any.h b/absl/types/any.h index 16bda79c..fc5a0746 100644 --- a/absl/types/any.h +++ b/absl/types/any.h @@ -47,9 +47,9 @@ // this abstraction, make sure that you should not instead be rewriting your // code to be more specific. // -// Abseil expects to release an `absl::variant` type shortly (a C++11 compatible -// version of the C++17 `std::variant), which is generally preferred for use -// over `absl::any`. +// Abseil has also released an `absl::variant` type (a C++11 compatible version +// of the C++17 `std::variant`), which is generally preferred for use over +// `absl::any`. #ifndef ABSL_TYPES_ANY_H_ #define ABSL_TYPES_ANY_H_ @@ -80,6 +80,7 @@ ABSL_NAMESPACE_END #include #include +#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 -struct TypeTag { - constexpr static char dummy_var = 0; -}; - -template -constexpr char TypeTag::dummy_var; - -// FastTypeId() 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 -constexpr inline const void* FastTypeId() { - return &TypeTag::dummy_var; -} - -} // namespace any_internal - class any; // swap() @@ -423,11 +404,11 @@ class any { using NormalizedType = typename std::remove_cv::type>::type; - return any_internal::FastTypeId(); + return base_internal::FastTypeId(); } const void* GetObjTypeId() const { - return obj_ ? obj_->ObjTypeId() : any_internal::FastTypeId(); + return obj_ ? obj_->ObjTypeId() : base_internal::FastTypeId(); } // `absl::any` nonmember functions // -- cgit v1.2.3