Michele Caini 8 лет назад
Родитель
Сommit
ab20372093
3 измененных файлов с 14 добавлено и 16 удалено
  1. 0 2
      src/entt/entity/registry.hpp
  2. 12 12
      src/entt/entity/view.hpp
  3. 2 2
      src/entt/process/scheduler.hpp

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

@@ -106,7 +106,6 @@ class Registry {
 
     template<typename Component>
     Pool<Component> & pool() noexcept {
-        assert(managed<Component>());
         return const_cast<Pool<Component> &>(const_cast<const Registry *>(this)->pool<Component>());
     }
 
@@ -417,7 +416,6 @@ public:
         }
 
         tags[ttype].reset(new Attaching<Tag>{entity, { std::forward<Args>(args)... }});
-        tags[ttype]->entity = entity;
 
         return static_cast<Attaching<Tag> *>(tags[ttype].get())->tag;
     }

+ 12 - 12
src/entt/entity/view.hpp

@@ -203,9 +203,9 @@ public:
      * @param func A valid function object.
      */
     template<typename Func>
-    void each(Func &&func) {
+    void each(Func func) {
         for(auto entity: *this) {
-            std::forward<Func>(func)(entity, get<Component>(entity)...);
+            func(entity, get<Component>(entity)...);
         }
     }
 
@@ -225,9 +225,9 @@ public:
      * @param func A valid function object.
      */
     template<typename Func>
-    void each(Func &&func) const {
+    void each(Func func) const {
         for(auto entity: *this) {
-            std::forward<Func>(func)(entity, get<Component>(entity)...);
+            func(entity, get<Component>(entity)...);
         }
     }
 
@@ -472,9 +472,9 @@ public:
      * @param func A valid function object.
      */
     template<typename Func>
-    void each(Func &&func) {
+    void each(Func func) {
         for(auto entity: *this) {
-            std::forward<Func>(func)(entity, get<First>(entity), get<Other>(entity)...);
+            func(entity, get<First>(entity), get<Other>(entity)...);
         }
     }
 
@@ -494,9 +494,9 @@ public:
      * @param func A valid function object.
      */
     template<typename Func>
-    void each(Func &&func) const {
+    void each(Func func) const {
         for(auto entity: *this) {
-            std::forward<Func>(func)(entity, get<First>(entity), get<Other>(entity)...);
+            func(entity, get<First>(entity), get<Other>(entity)...);
         }
     }
 
@@ -727,9 +727,9 @@ public:
      * @param func A valid function object.
      */
     template<typename Func>
-    void each(Func &&func) {
+    void each(Func func) {
         for(auto entity: *this) {
-            std::forward<Func>(func)(entity, get(entity));
+            func(entity, get(entity));
         }
     }
 
@@ -748,9 +748,9 @@ public:
      * @param func A valid function object.
      */
     template<typename Func>
-    void each(Func &&func) const {
+    void each(Func func) const {
         for(auto entity: *this) {
-            std::forward<Func>(func)(entity, get(entity));
+            func(entity, get(entity));
         }
     }
 

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

@@ -114,7 +114,7 @@ class Scheduler final {
             using Proc = typename decltype(next)::type;
 
             if(handler) {
-                auto proc = typename ProcessHandler::instance_type{ new Proc{std::forward<decltype(args)>(args)...}, &Scheduler::deleter<Proc> };
+                auto proc = typename ProcessHandler::instance_type{new Proc{std::forward<decltype(args)>(args)...}, &Scheduler::deleter<Proc>};
                 handler->next.reset(new ProcessHandler{std::move(proc), &Scheduler::update<Proc>, &Scheduler::abort<Proc>, nullptr});
                 handler = handler->next.get();
             }
@@ -197,7 +197,7 @@ public:
     auto attach(Args&&... args) {
         static_assert(std::is_base_of<Process<Proc, Delta>, Proc>::value, "!");
 
-        auto proc = typename ProcessHandler::instance_type{ new Proc{std::forward<Args>(args)...}, &Scheduler::deleter<Proc> };
+        auto proc = typename ProcessHandler::instance_type{new Proc{std::forward<Args>(args)...}, &Scheduler::deleter<Proc>};
         ProcessHandler handler{std::move(proc), &Scheduler::update<Proc>, &Scheduler::abort<Proc>, nullptr};
         handlers.push_back(std::move(handler));