diff options
Diffstat (limited to 'absl/container/internal/common.h')
-rw-r--r-- | absl/container/internal/common.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/absl/container/internal/common.h b/absl/container/internal/common.h index a02cd5c3..5037d803 100644 --- a/absl/container/internal/common.h +++ b/absl/container/internal/common.h @@ -22,7 +22,7 @@ #include "absl/types/optional.h" namespace absl { -inline namespace lts_2019_08_08 { +ABSL_NAMESPACE_BEGIN namespace container_internal { template <class, class = void> @@ -56,7 +56,7 @@ class node_handle_base { public: using allocator_type = Alloc; - constexpr node_handle_base() {} + constexpr node_handle_base() = default; node_handle_base(node_handle_base&& other) noexcept { *this = std::move(other); } @@ -109,16 +109,15 @@ class node_handle_base { allocator_type* alloc() { return std::addressof(*alloc_); } private: - absl::optional<allocator_type> alloc_; - mutable absl::aligned_storage_t<sizeof(slot_type), alignof(slot_type)> - slot_space_; + absl::optional<allocator_type> alloc_ = {}; + alignas(slot_type) mutable unsigned char slot_space_[sizeof(slot_type)] = {}; }; // For sets. template <typename Policy, typename PolicyTraits, typename Alloc, typename = void> class node_handle : public node_handle_base<PolicyTraits, Alloc> { - using Base = typename node_handle::node_handle_base; + using Base = node_handle_base<PolicyTraits, Alloc>; public: using value_type = typename PolicyTraits::value_type; @@ -138,7 +137,7 @@ template <typename Policy, typename PolicyTraits, typename Alloc> class node_handle<Policy, PolicyTraits, Alloc, absl::void_t<typename Policy::mapped_type>> : public node_handle_base<PolicyTraits, Alloc> { - using Base = typename node_handle::node_handle_base; + using Base = node_handle_base<PolicyTraits, Alloc>; public: using key_type = typename Policy::key_type; @@ -168,6 +167,11 @@ struct CommonAccess { } template <typename Node> + static void Destroy(Node* node) { + node->destroy(); + } + + template <typename Node> static void Reset(Node* node) { node->reset(); } @@ -192,7 +196,7 @@ struct InsertReturnType { }; } // namespace container_internal -} // inline namespace lts_2019_08_08 +ABSL_NAMESPACE_END } // namespace absl #endif // ABSL_CONTAINER_INTERNAL_CONTAINER_H_ |