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
10namespace flecs {
11namespace _ {
12
13// Utility to derive event type from function
14template <typename Func, typename U = int>
16
17// Specialization for observer callbacks with a single argument
18template <typename Func>
19struct 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>
25struct 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}
Event builder.