Browse Source

registry: minor changes

Michele Caini 5 years ago
parent
commit
b8266e1169
1 changed files with 2 additions and 5 deletions
  1. 2 5
      src/entt/entity/registry.hpp

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

@@ -885,11 +885,8 @@ public:
     template<typename... Component>
     void clear() {
         if constexpr(sizeof...(Component) == 0) {
-            for(auto pos = entities.size(); pos; --pos) {
-                if(const auto entt = entities[pos - 1]; (to_integral(entt) & traits_type::entity_mask) == (pos - 1)) {
-                    destroy(entt);
-                }
-            }
+            // useless this-> used to suppress a warning with clang
+            each([this](const auto entity) { this->destroy(entity); });
         } else {
             ([this](auto *cpool) {
                 cpool->remove(*this, cpool->basic_sparse_set<entity_type>::begin(), cpool->basic_sparse_set<entity_type>::end());