diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index 8e1ec9290..fb92c860e 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -72,8 +72,8 @@ class basic_registry { decltype(auto) assign(basic_registry ®istry, const Entity entt, Args &&... args) { if constexpr(std::is_empty_v) { storage::construct(entt); - construction.publish(entt, registry, Component{std::forward(args)...}); - return Component{}; + construction.publish(entt, registry, Component{}); + return Component{std::forward(args)...}; } else { auto &component = storage::construct(entt, std::forward(args)...); construction.publish(entt, registry, component); diff --git a/src/entt/entity/snapshot.hpp b/src/entt/entity/snapshot.hpp index ff1a0f84a..db6178862 100644 --- a/src/entt/entity/snapshot.hpp +++ b/src/entt/entity/snapshot.hpp @@ -135,25 +135,7 @@ public: */ template const basic_snapshot & component(Archive &archive) const { - if constexpr(sizeof...(Component) == 1) { - const auto sz = reg->template size(); - const auto *entities = reg->template data(); - - archive(typename traits_type::entity_type(sz)); - - for(std::remove_const_t pos{}; pos < sz; ++pos) { - const auto entt = entities[pos]; - - if constexpr(std::is_empty_v) { - archive(entt); - } else { - archive(entt, reg->template get(entt)); - } - }; - } else { - (component(archive), ...); - } - + (component(archive, reg->template data(), reg->template data() + reg->template size()), ...); return *this; }