registry: minor changes

This commit is contained in:
Michele Caini
2019-12-25 18:15:26 +01:00
parent b2d0e7fae2
commit 23069d76eb
2 changed files with 5 additions and 6 deletions

1
TODO
View File

@@ -23,5 +23,4 @@
* review and suppress warnings, if any
* extract only the type within type_info, hash its name (more portable)
* registry
- ::get -> use std::forward/forward_as_tuple and remove one of them (also try_get and the others)
- ::group improve, reduce code

View File

@@ -513,7 +513,7 @@ public:
return generate();
} else {
const entity_type entt = generate();
return std::tuple<entity_type, decltype(assign<Component>({}))...>{entt, assign<Component>(entt)...};
return std::tuple_cat(std::make_tuple(entt), std::forward_as_tuple(assign<Component>(entt)...));
}
}
@@ -714,7 +714,7 @@ public:
if constexpr(sizeof...(Component) == 1) {
return (assure<Component>().get(entity), ...);
} else {
return std::tuple<decltype(get<Component>({}))...>{get<Component>(entity)...};
return std::forward_as_tuple(get<Component>(entity)...);
}
}
@@ -726,7 +726,7 @@ public:
if constexpr(sizeof...(Component) == 1) {
return (assure<Component>().get(entity), ...);
} else {
return std::tuple<decltype(get<Component>({}))...>{get<Component>(entity)...};
return std::forward_as_tuple(get<Component>(entity)...);
}
}
@@ -780,7 +780,7 @@ public:
if constexpr(sizeof...(Component) == 1) {
return (assure<Component>().try_get(entity), ...);
} else {
return std::tuple<decltype(try_get<Component>({}))...>{try_get<Component>(entity)...};
return std::make_tuple(try_get<Component>(entity)...);
}
}
@@ -790,7 +790,7 @@ public:
if constexpr(sizeof...(Component) == 1) {
return (assure<Component>().try_get(entity), ...);
} else {
return std::tuple<decltype(try_get<Component>({}))...>{try_get<Component>(entity)...};
return std::make_tuple(try_get<Component>(entity)...);
}
}