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
6
#pragma once
7
8
#include "
builder.hpp
"
9
10
namespace
flecs {
11
namespace
_ {
12
13
// Utility to derive event type from function
14
template
<
typename
Func,
typename
U =
int
>
15
struct
event_from_func
;
16
17
// Specialization for observer callbacks with a single argument
18
template
<
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
24
template
<
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
29
template
<
typename
Func>
30
using
event_from_func_t =
typename
event_from_func<Func>::type
;
31
32
}
33
}
builder.hpp
Event builder.
flecs::_::event_from_func
Definition
decl.hpp:15
flecs::arity
Definition
function_traits.hpp:105