From ffdc7893fe20a029ae8a09fda5099df7149ddab1 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 19 Jun 2023 10:44:42 +0200 Subject: [PATCH] registry: drop ::assign (deprecated function) --- src/entt/entity/registry.hpp | 24 ------------------------ test/entt/entity/registry.cpp | 7 +++++-- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index 49c1592c0..ffeb21e5f 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -510,30 +510,6 @@ public: entities.insert(std::move(first), std::move(last)); } - /** - * @brief Assigns identifiers to an empty registry. - * - * This function is intended for use in conjunction with `data`, `size` and - * `released`.
- * Don't try to inject ranges of randomly generated entities nor the _wrong_ - * head for the list of destroyed entities. There is no guarantee that a - * registry will continue to work properly in this case. - * - * @warning - * There must be no entities still alive for this to work properly. - * - * @tparam It Type of input iterator. - * @param first An iterator to the first element of the range of entities. - * @param last An iterator past the last element of the range of entities. - * @param destroyed The number of released entities. - */ - template - [[deprecated("use .storage().push(first, last) and .storage().in_use(len) instead")]] void assign(It first, It last, const size_type destroyed) { - ENTT_ASSERT(!entities.in_use(), "Non-empty registry"); - entities.push(first, last); - entities.in_use(entities.size() - destroyed); - } - /** * @brief Destroys an entity and releases its identifier. * diff --git a/test/entt/entity/registry.cpp b/test/entt/entity/registry.cpp index 1941848e9..ff4336582 100644 --- a/test/entt/entity/registry.cpp +++ b/test/entt/entity/registry.cpp @@ -2002,8 +2002,11 @@ TEST(Registry, AssignEntities) { registry.destroy(entities[2]); entt::registry other; - const auto *data = registry.storage().data(); - other.assign(data, data + registry.storage().size(), registry.storage().size() - registry.storage().in_use()); + auto &src = registry.storage(); + auto &dst = other.storage(); + + dst.push(src.rbegin(), src.rend()); + dst.in_use(src.in_use()); ASSERT_EQ(registry.storage().size(), other.storage().size()); ASSERT_TRUE(other.valid(entities[0]));