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

sparse_set: prepare for yet another option

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

+ 5 - 2
src/entt/entity/sparse_set.hpp

@@ -277,14 +277,17 @@ protected:
      * @param last An iterator past the last element of the range of entities.
      * @param last An iterator past the last element of the range of entities.
      */
      */
     virtual void pop(basic_iterator first, basic_iterator last) {
     virtual void pop(basic_iterator first, basic_iterator last) {
-        if(mode == deletion_policy::swap_and_pop) {
+        switch(mode) {
+        case deletion_policy::swap_and_pop:
             for(; first != last; ++first) {
             for(; first != last; ++first) {
                 swap_and_pop(first);
                 swap_and_pop(first);
             }
             }
-        } else {
+            break;
+        case deletion_policy::in_place:
             for(; first != last; ++first) {
             for(; first != last; ++first) {
                 in_place_pop(first);
                 in_place_pop(first);
             }
             }
+            break;
         }
         }
     }
     }