entity: added debug asserts to to_entity

This commit is contained in:
Michele Caini
2020-07-12 16:45:00 +02:00
parent b7763b3887
commit 2fa59fc43c

View File

@@ -139,6 +139,8 @@ void invoke(basic_registry<Entity> &reg, const Entity entt) {
*/
template<typename Entity, typename Component>
Entity to_entity(const basic_registry<Entity> &reg, const Component &component) {
ENTT_ASSERT(!(reg.template raw<Component>() > &component));
ENTT_ASSERT(&component < (reg.template raw<Component>() + reg.template size<Component>()));
return *(reg.template data<Component>() + (&component - reg.template raw<Component>()));
}