minor changes

This commit is contained in:
Michele Caini
2017-12-01 08:43:22 +01:00
parent ab887f30e4
commit ab20372093
3 changed files with 14 additions and 16 deletions

View File

@@ -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;
}

View File

@@ -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));
}
}

View File

@@ -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));