ソースを参照

review: as_group

Michele Caini 6 年 前
コミット
7cf4721efa
2 ファイル変更8 行追加8 行削除
  1. 4 8
      src/entt/entity/helper.hpp
  2. 4 0
      test/entt/entity/helper.cpp

+ 4 - 8
src/entt/entity/helper.hpp

@@ -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:

+ 4 - 0
test/entt/entity/helper.cpp

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