From 32a83ecf504fd0480597bfa5af8f2a7555c05607 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Tue, 9 Jul 2024 09:23:18 +0200 Subject: [PATCH] view: that's why the if was there :) right --- src/entt/entity/view.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/entt/entity/view.hpp b/src/entt/entity/view.hpp index dc58db34f..c01154069 100644 --- a/src/entt/entity/view.hpp +++ b/src/entt/entity/view.hpp @@ -1008,8 +1008,10 @@ public: } } else if constexpr(std::is_invocable_vbegin())>) { if constexpr(Get::storage_policy == deletion_policy::swap_and_pop || Get::storage_policy == deletion_policy::swap_only) { - for(auto last = storage()->end(), first = last - base_type::size(); first != last; ++first) { - func(*first); + if(const auto len = base_type::size(); len != 0u) { + for(auto last = storage()->end(), first = last - len; first != last; ++first) { + func(*first); + } } } else { static_assert(Get::storage_policy == deletion_policy::in_place, "Unexpected storage policy");