From 7e0e3a21969ce27406791b19d2b5c19ef4f7f3ff Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Thu, 6 Mar 2025 10:00:59 +0100 Subject: [PATCH] snapshot: use start_from with entity storage --- src/entt/entity/snapshot.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/entt/entity/snapshot.hpp b/src/entt/entity/snapshot.hpp index 0d266a1c0..6ee54c304 100644 --- a/src/entt/entity/snapshot.hpp +++ b/src/entt/entity/snapshot.hpp @@ -231,6 +231,7 @@ public: if constexpr(std::is_same_v) { typename traits_type::entity_type count{}; + entity_type placeholder{}; storage.reserve(length); archive(count); @@ -238,8 +239,10 @@ public: for(entity_type entity = null; length; --length) { archive(entity); storage.generate(entity); + placeholder = (entity > placeholder) ? entity : placeholder; } + storage.start_from(traits_type::next(placeholder)); storage.free_list(count); } else { auto &other = reg->template storage();