review: as_group

This commit is contained in:
Michele Caini
2019-05-27 22:05:16 +02:00
parent 6578838587
commit 7cf4721efa
2 changed files with 8 additions and 8 deletions

View File

@@ -77,17 +77,13 @@ struct as_group {
/**
* @brief Conversion function from a registry to a group.
*
* @note
* Unfortunately, only full owning groups are supported because of an issue
* with msvc that doesn't manage to correctly deduce types.
*
* @tparam Get Types of components observed by the group.
* @tparam Owned Types of components owned by the group.
* @return A newly created group.
*/
template<typename... Owned>
operator entt::basic_group<Entity, get_t<>, Owned...>() const {
return reg.template group<Owned...>();
template<typename Get, typename... Owned>
operator entt::basic_group<Entity, Get, Owned...>() const {
return reg.template group<Owned...>(Get{});
}
private:

View File

@@ -20,6 +20,10 @@ TEST(Helper, AsGroup) {
([](entt::group<entt::get_t<>, double, float>) {})(entt::as_group{registry});
([](entt::group<entt::get_t<>, const double, float>) {})(entt::as_group{registry});
([](entt::group<entt::get_t<>, const double, const float>) {})(entt::as_group{cregistry});
([](entt::group<entt::get_t<int>, char>) {})(entt::as_group{registry});
([](entt::group<entt::get_t<const int>, char>) {})(entt::as_group{registry});
([](entt::group<entt::get_t<const int>, const char>) {})(entt::as_group{cregistry});
}
TEST(Helper, Dependency) {