Browse Source

any: destruction support to in_situ-as-dynamic values

Michele Caini 1 year ago
parent
commit
bf66a6cf0e
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/entt/core/any.hpp

+ 1 - 1
src/entt/core/any.hpp

@@ -98,7 +98,7 @@ class basic_any {
             break;
             break;
         case operation::destroy:
         case operation::destroy:
             if constexpr(in_situ<Type>) {
             if constexpr(in_situ<Type>) {
-                elem->~Type();
+                (value.mode == any_policy::embedded) ? elem->~Type() : (delete elem);
             } else if constexpr(std::is_array_v<Type>) {
             } else if constexpr(std::is_array_v<Type>) {
                 delete[] elem;
                 delete[] elem;
             } else {
             } else {