diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index c78ac44c7..6ef1048f5 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -643,30 +643,14 @@ public: /** * @brief Destroys all the entities in a range. - * @tparam It Type of forward iterator. + * @tparam It Type of input iterator. * @param first An iterator to the first element of the range to generate. * @param last An iterator past the last element of the range to generate. */ template void destroy(It first, It last) { - ENTT_ASSERT(std::all_of(first, last, [this](const auto entity) { return valid(entity); })); - - for(auto pos = pools.size(); pos; --pos) { - if(auto &pdata = pools[pos-1]; pdata.pool) { - std::for_each(first, last, [&pdata, this](const auto entity) { - if(pdata.pool->has(entity)) { - pdata.remove(*this, entity); - } - }); - } - }; - - // just a way to protect users from listeners that attach components - ENTT_ASSERT(std::all_of(first, last, [this](const auto entity) { return orphan(entity); })); - - std::for_each(first, last, [this](const auto entity) { - release(entity); - }); + // useless this-> used to suppress a warning with clang + std::for_each(first, last, [this](const auto entity) { this->destroy(entity); }); } /** @@ -1412,7 +1396,7 @@ public: * components.
* This is particularly well suited to plugin systems and mods in general. * - * @tparam It Type of forward iterator. + * @tparam It Type of input iterator. * @param first An iterator to the first element of the range of components. * @param last An iterator past the last element of the range of components. * @return A newly created runtime view. diff --git a/test/entt/entity/registry.cpp b/test/entt/entity/registry.cpp index 8e78c882a..46d959350 100644 --- a/test/entt/entity/registry.cpp +++ b/test/entt/entity/registry.cpp @@ -987,15 +987,6 @@ TEST(Registry, DestroyByComponents) { ASSERT_TRUE(registry.valid(e1)); ASSERT_TRUE(registry.valid(e2)); - { - const auto view = registry.view(); - registry.destroy(view.begin(), view.end()); - } - - ASSERT_FALSE(registry.valid(e0)); - ASSERT_TRUE(registry.valid(e1)); - ASSERT_TRUE(registry.valid(e2)); - { const auto view = registry.view(); registry.destroy(view.begin(), view.end());