Просмотр исходного кода

view: that's why the if was there :) right

Michele Caini 1 год назад
Родитель
Сommit
32a83ecf50
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      src/entt/entity/view.hpp

+ 4 - 2
src/entt/entity/view.hpp

@@ -1008,8 +1008,10 @@ public:
             }
         } else if constexpr(std::is_invocable_v<Func, decltype(*storage()->begin())>) {
             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");