diff --git a/TODO b/TODO index 250de552e..4476c21d6 100644 --- a/TODO +++ b/TODO @@ -44,4 +44,5 @@ TODO: * built-in no-pagination storage - no_pagination page size as limits::max * meta_any ownership construction and from_void * sparse_set shrink_to_fit argument for sparse array shrink policy (none, empty, deep, whatever) +* any cdynamic to support const ownership construction * track meta context on meta elements diff --git a/src/entt/core/any.hpp b/src/entt/core/any.hpp index a26f7d29d..2c1923160 100644 --- a/src/entt/core/any.hpp +++ b/src/entt/core/any.hpp @@ -109,9 +109,9 @@ class basic_any { template void initialize([[maybe_unused]] Args &&...args) { - using plain_type = std::remove_cv_t>; - if constexpr(!std::is_void_v) { + using plain_type = std::remove_cv_t>; + info = &type_id(); vtable = basic_vtable; @@ -178,10 +178,10 @@ public: */ template explicit basic_any(std::in_place_t, Type *value) - : instance{value} { + : instance{} { static_assert(!std::is_const_v && !std::is_void_v, "Non-const non-void pointer required"); - if(instance != nullptr) { + if(value != nullptr) { initialize(*value); mode = any_policy::dynamic; }