From 70b8bd27b8fdf56ea52a156d9eb8dee7eefc7b8e Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 5 Sep 2022 15:32:49 +0200 Subject: [PATCH] any/poly: avoid using aligned_storage_t (deprecated - close #919) --- src/entt/core/any.hpp | 5 ++--- src/entt/core/fwd.hpp | 5 ++--- src/entt/poly/fwd.hpp | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/entt/core/any.hpp b/src/entt/core/any.hpp index c928295c3..e4d856487 100644 --- a/src/entt/core/any.hpp +++ b/src/entt/core/any.hpp @@ -53,11 +53,10 @@ class basic_any { using operation = internal::any_operation; using policy = internal::any_policy; - using storage_type = std::aligned_storage_t; using vtable_type = const void *(const operation, const basic_any &, const void *); template - static constexpr bool in_situ = Len && alignof(Type) <= Align && sizeof(Type) <= Len && std::is_nothrow_move_constructible_v; + static constexpr bool in_situ = Len && alignof(Type) <= Align && sizeof(Type) <= Len &&std::is_nothrow_move_constructible_v; template static const void *basic_vtable([[maybe_unused]] const operation op, [[maybe_unused]] const basic_any &value, [[maybe_unused]] const void *other) { @@ -409,7 +408,7 @@ public: private: union { const void *instance; - storage_type storage; + alignas(Align) std::byte storage[Len + !Len]; }; const type_info *info; vtable_type *vtable; diff --git a/src/entt/core/fwd.hpp b/src/entt/core/fwd.hpp index cec32a050..472ed122d 100644 --- a/src/entt/core/fwd.hpp +++ b/src/entt/core/fwd.hpp @@ -1,13 +1,12 @@ #ifndef ENTT_CORE_FWD_HPP #define ENTT_CORE_FWD_HPP -#include -#include +#include #include "../config/config.h" namespace entt { -template)> +template class basic_any; /*! @brief Alias declaration for type identifiers. */ diff --git a/src/entt/poly/fwd.hpp b/src/entt/poly/fwd.hpp index 1435337c1..f24cdf2e3 100644 --- a/src/entt/poly/fwd.hpp +++ b/src/entt/poly/fwd.hpp @@ -1,12 +1,11 @@ #ifndef ENTT_POLY_FWD_HPP #define ENTT_POLY_FWD_HPP -#include -#include +#include namespace entt { -template)> +template class basic_poly; /**