assert (has) on replace for empty components

This commit is contained in:
Michele Caini
2019-05-15 23:07:24 +02:00
parent 9f8e9a1916
commit 30f71b2ed6

View File

@@ -121,6 +121,7 @@ class basic_registry {
template<typename... Args>
decltype(auto) replace(basic_registry &registry, const Entity entt, Args &&... args) {
if constexpr(std::is_empty_v<Component>) {
assert((storage<Entity, Component>::has(entt)));
on_replace.publish(registry, entt, Component{});
return Component{std::forward<Args>(args)...};
} else {