diff --git a/src/entt/entity/storage.hpp b/src/entt/entity/storage.hpp index fc7920832..9b0e5dd83 100644 --- a/src/entt/entity/storage.hpp +++ b/src/entt/entity/storage.hpp @@ -266,8 +266,8 @@ class basic_storage: public basic_sparse_set(it.index())); - entt::uninitialized_construct_using_allocator(to_address(elem), get_allocator(), std::forward(args)...); + auto *elem = to_address(assure_at_least(static_cast(it.index()))); + entt::uninitialized_construct_using_allocator(elem, get_allocator(), std::forward(args)...); } ENTT_CATCH { base_type::pop(it, it + 1u);