Explorar o código

view: constrained storage type

Michele Caini hai 1 ano
pai
achega
7a59e147d2
Modificáronse 2 ficheiros con 3 adicións e 1 borrados
  1. 1 1
      TODO
  2. 2 0
      src/entt/entity/view.hpp

+ 1 - 1
TODO

@@ -43,4 +43,4 @@ TODO:
 * any cdynamic to support const ownership construction
 * track meta context on meta elements
 * safer meta_data/meta_func (no blind indirections)
-* write doc for view::join and decide whether I like it or prefer operator| for consistency :)
+* write doc for view::join and decide whether I like it or prefer operator| for consistency :)

+ 2 - 0
src/entt/entity/view.hpp

@@ -650,6 +650,7 @@ public:
      */
     template<typename OGet>
     [[nodiscard]] auto join(OGet &other) const noexcept {
+        static_assert(std::is_base_of_v<common_type, OGet>, "Unexpected storage type");
         return *this | basic_view<get_t<OGet>, exclude_t<>>{other};
     }
 
@@ -1091,6 +1092,7 @@ public:
      */
     template<typename OGet>
     [[nodiscard]] auto join(OGet &other) const noexcept {
+        static_assert(std::is_base_of_v<common_type, OGet>, "Unexpected storage type");
         return *this | basic_view<get_t<OGet>, exclude_t<>>{other};
     }