Просмотр исходного кода

snapshot: check on member type class

Michele Caini 2 лет назад
Родитель
Сommit
e0a1ef7c1b
1 измененных файлов с 2 добавлено и 0 удалено
  1. 2 0
      src/entt/entity/snapshot.hpp

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

@@ -460,6 +460,8 @@ public:
      */
     template<typename Type, auto... Member, typename Archive>
     basic_continuous_loader &get([[maybe_unused]] Archive &archive, const id_type id = type_hash<Type>::value()) {
+        static_assert((std::is_same_v<member_class_t<decltype(Member)>, Type> && ...), "Wrong class type");
+
         auto &storage = reg->template storage<Type>(id);
 
         if constexpr(std::is_same_v<Type, entity_type>) {