Michele Caini 6 years ago
parent
commit
e2b676d54c

+ 1 - 0
TODO

@@ -17,6 +17,7 @@
 * any-of rule for views/groups (eg entity has A and any of B/C/D)
   - get -> all, exclude -> none
 * review prepare after clone and the others have been removed
+* remove copy-ctor/op from sparse set and storage (it doesn't make much sense)
 
 * WIP:
  - deprecate clone, stamp, snapshot, loader, ...

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

@@ -6,7 +6,6 @@
 #include <cstddef>
 #include <cstdint>
 #include <utility>
-#include <algorithm>
 #include <type_traits>
 #include "../config/config.h"
 #include "../core/type_traits.hpp"
@@ -409,7 +408,10 @@ public:
     template<typename Func>
     void each(Func func) const {
         static_assert(std::is_invocable_v<Func, entity_type>);
-        std::for_each(begin(), end(), std::move(func));
+
+        for(const auto entity: *this) {
+            func(entity);
+        }
     }
 
     /**

+ 3 - 1
src/entt/entity/runtime_view.hpp

@@ -247,7 +247,9 @@ public:
      */
     template<typename Func>
     void each(Func func) const {
-        std::for_each(begin(), end(), func);
+        for(const auto entity: *this) {
+            func(entity);
+        }
     }
 
 private:

+ 2 - 2
src/entt/process/scheduler.hpp

@@ -281,9 +281,9 @@ public:
         decltype(handlers) exec;
         exec.swap(handlers);
 
-        std::for_each(exec.begin(), exec.end(), [immediately](auto &handler) {
+        for(auto &&handler: exec) {
             handler.abort(handler, immediately);
-        });
+        }
 
         std::move(handlers.begin(), handlers.end(), std::back_inserter(exec));
         handlers.swap(exec);

+ 16 - 11
src/entt/signal/emitter.hpp

@@ -63,9 +63,13 @@ class emitter {
 
         void clear() ENTT_NOEXCEPT override {
             if(publishing) {
-                auto func = [](auto &&element) { element.first = true; };
-                std::for_each(once_list.begin(), once_list.end(), func);
-                std::for_each(on_list.begin(), on_list.end(), func);
+                for(auto &&element: once_list) {
+                    element.first = true;
+                }
+
+                for(auto &&element: on_list) {
+                    element.first = true;
+                }
             } else {
                 once_list.clear();
                 on_list.clear();
@@ -94,14 +98,15 @@ class emitter {
             container_type swap_list;
             once_list.swap(swap_list);
 
-            auto func = [&event, &ref](auto &&element) {
-                return element.first ? void() : element.second(event, ref);
-            };
-
             publishing = true;
 
-            std::for_each(on_list.rbegin(), on_list.rend(), func);
-            std::for_each(swap_list.rbegin(), swap_list.rend(), func);
+            for(auto &&element: on_list) {
+                element.first ? void() : element.second(event, ref);
+            }
+
+            for(auto &&element: swap_list) {
+                element.first ? void() : element.second(event, ref);
+            }
 
             publishing = false;
 
@@ -284,9 +289,9 @@ public:
      * results in undefined behavior.
      */
     void clear() ENTT_NOEXCEPT {
-        std::for_each(pools.begin(), pools.end(), [](auto &&cpool) {
+        for(auto &&cpool: pools) {
             cpool->clear();
-        });
+        }
     }
 
     /**