any/poly: avoid using aligned_storage_t (deprecated - close #919)

This commit is contained in:
Michele Caini
2022-09-05 15:32:49 +02:00
parent ee88cf16d1
commit 70b8bd27b8
3 changed files with 6 additions and 9 deletions

View File

@@ -53,11 +53,10 @@ class basic_any {
using operation = internal::any_operation;
using policy = internal::any_policy;
using storage_type = std::aligned_storage_t<Len + !Len, Align>;
using vtable_type = const void *(const operation, const basic_any &, const void *);
template<typename Type>
static constexpr bool in_situ = Len && alignof(Type) <= Align && sizeof(Type) <= Len && std::is_nothrow_move_constructible_v<Type>;
static constexpr bool in_situ = Len && alignof(Type) <= Align && sizeof(Type) <= Len &&std::is_nothrow_move_constructible_v<Type>;
template<typename Type>
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;

View File

@@ -1,13 +1,12 @@
#ifndef ENTT_CORE_FWD_HPP
#define ENTT_CORE_FWD_HPP
#include <cstdint>
#include <type_traits>
#include <cstddef>
#include "../config/config.h"
namespace entt {
template<std::size_t Len = sizeof(double[2]), std::size_t = alignof(typename std::aligned_storage_t<Len + !Len>)>
template<std::size_t Len = sizeof(double[2]), std::size_t = alignof(double[2])>
class basic_any;
/*! @brief Alias declaration for type identifiers. */

View File

@@ -1,12 +1,11 @@
#ifndef ENTT_POLY_FWD_HPP
#define ENTT_POLY_FWD_HPP
#include <cstdint>
#include <type_traits>
#include <cstddef>
namespace entt {
template<typename, std::size_t Len = sizeof(double[2]), std::size_t = alignof(typename std::aligned_storage_t<Len + !Len>)>
template<typename, std::size_t Len = sizeof(double[2]), std::size_t = alignof(double[2])>
class basic_poly;
/**