|
@@ -583,6 +583,7 @@ public:
|
|
|
*/
|
|
*/
|
|
|
template<typename Type, typename... Args>
|
|
template<typename Type, typename... Args>
|
|
|
decltype(auto) emplace(const entity_type entt, Args &&...args) {
|
|
decltype(auto) emplace(const entity_type entt, Args &&...args) {
|
|
|
|
|
+ ENTT_ASSERT(valid(entt), "Invalid entity");
|
|
|
return assure<Type>().emplace(entt, std::forward<Args>(args)...);
|
|
return assure<Type>().emplace(entt, std::forward<Args>(args)...);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -599,6 +600,7 @@ public:
|
|
|
*/
|
|
*/
|
|
|
template<typename Type, typename It>
|
|
template<typename Type, typename It>
|
|
|
void insert(It first, It last, const Type &value = {}) {
|
|
void insert(It first, It last, const Type &value = {}) {
|
|
|
|
|
+ ENTT_ASSERT(std::all_of(first, last, [this](const auto entt) { return valid(entt); }), "Invalid entity");
|
|
|
assure<Type>().insert(std::move(first), std::move(last), value);
|
|
assure<Type>().insert(std::move(first), std::move(last), value);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -616,6 +618,7 @@ public:
|
|
|
*/
|
|
*/
|
|
|
template<typename Type, typename EIt, typename CIt, typename = std::enable_if_t<std::is_same_v<typename std::iterator_traits<CIt>::value_type, Type>>>
|
|
template<typename Type, typename EIt, typename CIt, typename = std::enable_if_t<std::is_same_v<typename std::iterator_traits<CIt>::value_type, Type>>>
|
|
|
void insert(EIt first, EIt last, CIt from) {
|
|
void insert(EIt first, EIt last, CIt from) {
|
|
|
|
|
+ ENTT_ASSERT(std::all_of(first, last, [this](const auto entt) { return valid(entt); }), "Invalid entity");
|
|
|
assure<Type>().insert(first, last, from);
|
|
assure<Type>().insert(first, last, from);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -636,6 +639,7 @@ public:
|
|
|
if(auto &cpool = assure<Type>(); cpool.contains(entt)) {
|
|
if(auto &cpool = assure<Type>(); cpool.contains(entt)) {
|
|
|
return cpool.patch(entt, [&args...](auto &...curr) { ((curr = Type{std::forward<Args>(args)...}), ...); });
|
|
return cpool.patch(entt, [&args...](auto &...curr) { ((curr = Type{std::forward<Args>(args)...}), ...); });
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ ENTT_ASSERT(valid(entt), "Invalid entity");
|
|
|
return cpool.emplace(entt, std::forward<Args>(args)...);
|
|
return cpool.emplace(entt, std::forward<Args>(args)...);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -899,6 +903,7 @@ public:
|
|
|
if(auto &cpool = assure<Type>(); cpool.contains(entt)) {
|
|
if(auto &cpool = assure<Type>(); cpool.contains(entt)) {
|
|
|
return cpool.get(entt);
|
|
return cpool.get(entt);
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ ENTT_ASSERT(valid(entt), "Invalid entity");
|
|
|
return cpool.emplace(entt, std::forward<Args>(args)...);
|
|
return cpool.emplace(entt, std::forward<Args>(args)...);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|