ソースを参照

view: try to get around a bug in MSVC

Michele Caini 5 年 前
コミット
c4ba8f96e6
1 ファイル変更10 行追加1 行削除
  1. 10 1
      src/entt/entity/view.hpp

+ 10 - 1
src/entt/entity/view.hpp

@@ -68,8 +68,17 @@ class basic_view<Entity, exclude_t<Exclude...>, Component...> {
     /*! @brief A registry is allowed to create views. */
     friend class basic_registry<Entity>;
 
+    // I could have used std::conditional_t ...
     template<typename Comp>
-    using pool_type = std::conditional_t<std::is_const_v<Comp>, const storage<Entity, std::remove_const_t<Comp>>, storage<Entity, Comp>>;
+    struct pool { using type = storage<Entity, Comp>; };
+
+    // ... if only MSVC didn't have a bug ...
+    template<typename Comp>
+    struct pool<const Comp> { using type = const storage<Entity, std::remove_const_t<Comp>>; };
+
+    // ... that forces me to do the same in a worse way! :(
+    template<typename Comp>
+    using pool_type = typename pool<Comp>::type;
 
     template<typename Comp>
     using component_iterator = decltype(std::declval<pool_type<Comp>>().begin());