Flecs: include/flecs/addons/cpp/mixins/event/decl.hpp Source File
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.0 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
decl.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "builder.hpp"
9
10namespace flecs {
11namespace _ {
12
13// Utility to derive event type from function
14template <typename Func, typename U = int>
15 struct event_from_func;
16
17// Specialization for observer callbacks with a single argument
18template <typename Func>
19 struct event_from_func<Func, if_t< arity<Func>::value == 1>> {
20 using type = decay_t<first_arg_t<Func>>;
21};
22
23// Specialization for observer callbacks with an initial entity src argument
24template <typename Func>
25 struct event_from_func<Func, if_t< arity<Func>::value == 2>> {
26 using type = decay_t<second_arg_t<Func>>;
27};
28
29template <typename Func>
30using event_from_func_t = typename event_from_func<Func>::type;
31
32}
33}
builder.hpp
Event builder.
flecs::_
Int to enum.
Definition component.hpp:21
flecs::_::event_from_func
Definition decl.hpp:15
flecs::arity
Definition function_traits.hpp:105