10template<
typename Signature>
23template<
typename R,
typename A>
34 template<
typename Fn,
typename = std::enable_if_t<!std::is_same_v<std::decay_t<Fn>, EntityMapping>>>
37 , m_call([](
void* c, A from) -> R {
return (*
static_cast<Fn*
>(c))(from); })
39 ~EntityMapping() =
default;
41 EntityMapping(
const EntityMapping& other) =
default;
42 EntityMapping& operator=(
const EntityMapping& other) =
default;
44 EntityMapping(EntityMapping && other) =
default;
45 EntityMapping& operator=(EntityMapping && other) =
default;
54 return from ? m_call(m_carrier, from) : R{};
58 void* m_carrier =
nullptr;
59 R (*m_call)(
void*, A) =
nullptr;
65using EntityResolver = EntityMapping<EntityId(uint32_t)>;
70using EntityNamer = EntityMapping<uint32_t(EntityId)>;
EntityMapping(Fn &fn) noexcept
Wrap fn, the carrier's mapping.
Definition entity_mapping.h:35
R operator()(A from) const
Map one reference.
Definition entity_mapping.h:53