diff --git a/src/entt/entity/view.hpp b/src/entt/entity/view.hpp index 3bc8d118a..dc6a8f50d 100644 --- a/src/entt/entity/view.hpp +++ b/src/entt/entity/view.hpp @@ -822,21 +822,19 @@ public: */ template void each(Func func) const { - if constexpr(is_applicable_veach().begin())>) { - if(view) { + if(view) { + if constexpr(is_applicable_veach().begin())>) { for(const auto pack: view->each()) { std::apply(func, pack); } - } - } else if constexpr(Get::traits_type::page_size == 0u) { - for(size_type pos{}, last = size(); pos < last; ++pos) { - func(); - } - } else { - if(view) { + } else if constexpr(std::is_invocable_vbegin())>) { for(auto &&component: *view) { func(component); } + } else { + for(size_type pos = view->size(); pos; --pos) { + func(); + } } } }