Flecs v4.0
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
impl.hpp
Go to the documentation of this file.
1
6#pragma once
7
8namespace flecs {
9
10template <typename E>
11inline E entity_view::to_constant() const {
12 const E* ptr = this->get<E>();
13 ecs_assert(ptr != NULL, ECS_INVALID_PARAMETER, "entity is not a constant");
14 return ptr[0];
15}
16
17template <typename E, if_t< is_enum<E>::value >>
18inline flecs::entity world::to_entity(E constant) const {
19 const auto& et = enum_type<E>(world_);
20 return flecs::entity(world_, et.entity(constant));
21}
22
23}
#define ecs_assert(condition, error_code,...)
Assert.
Definition log.h:352
E to_constant() const
Convert entity to enum constant.
Definition impl.hpp:11
flecs::entity to_entity(E constant) const
Convert enum constant to entity.
Entity.
Definition entity.hpp:30