diff --git a/TODO b/TODO index c412f1da1..75e6947c0 100644 --- a/TODO +++ b/TODO @@ -4,7 +4,6 @@ * add examples (and credits) from @alanjfs :) WIP: -* any: avoid operations when trivially-* * runtime events (emitter) * iterator based try_emplace vs try_insert for perf reasons * registry: remove reference to basic_sparse_set @@ -12,7 +11,6 @@ WIP: * custom allocators all over WIP: -* customizable any_vtable, sfinae-friendly definition and op::custom for user-def * resource, forward the id to the loader from the cache and if constexpr the call to load, update doc and describe customization points * add user data to type_info * write documentation for custom storages and views!! diff --git a/src/entt/core/any.hpp b/src/entt/core/any.hpp index 5496b2e45..0c7e66f6e 100644 --- a/src/entt/core/any.hpp +++ b/src/entt/core/any.hpp @@ -50,7 +50,7 @@ class basic_any { const Type *element = nullptr; if constexpr(in_situ) { - element = (value.mode == policy::owner) ? ENTT_LAUNDER(reinterpret_cast(&value.storage)) : static_cast(value.instance); + element = value.owner() ? ENTT_LAUNDER(reinterpret_cast(&value.storage)) : static_cast(value.instance); } else { element = static_cast(value.instance); } @@ -63,7 +63,7 @@ class basic_any { break; case operation::move: if constexpr(in_situ) { - if(value.mode == policy::owner) { + if(value.owner()) { return new(&static_cast(const_cast(other))->storage) Type{std::move(*const_cast(element))}; } } @@ -204,7 +204,7 @@ public: /*! @brief Frees the internal storage, whatever it means. */ ~basic_any() { - if(vtable && mode == policy::owner) { + if(vtable && owner()) { vtable(operation::destroy, *this, nullptr); } } @@ -337,7 +337,7 @@ public: /*! @brief Destroys contained object */ void reset() { - if(vtable && mode == policy::owner) { + if(vtable && owner()) { vtable(operation::destroy, *this, nullptr); }