Skip to content
Flecs
v4.1
Search
Ctrl K
include
flecs
addons
cpp
mixins
event
decl.hpp
Go to the documentation of this file.
1
/**
2
* @file addons/cpp/mixins/event/decl.hpp
3
* @brief Event declarations.
4
*/
5
6
#pragma once
7
8
9
10
namespace
flecs {
11
12
struct
event_builder
;
13
template
<
typename
E>
14
struct
event_builder_typed
;
15
namespace
_
{
16
17
// Utility to derive event type from function.
18
template
<
typename
Func,
typename
U =
int
>
19
struct
event_from_func
;
20
21
// Specialization for observer callbacks with a single argument.
22
template
<
typename
Func>
23
struct
event_from_func
<Func,
if_t
<
arity
<Func>::value == 1>> {
24
using
type = decay_t<first_arg_t<Func>>;
25
};
26
27
// Specialization for observer callbacks with an initial entity src argument.
28
template
<
typename
Func>
29
struct
event_from_func
<Func,
if_t
<
arity
<Func>::value == 2>> {
30
using
type = decay_t<second_arg_t<Func>>;
31
};
32
33
template
<
typename
Func>
34
using
event_from_func_t =
typename
event_from_func<Func>::type
;
35
36
}
37
}
flecs::_
Int to enum.
Definition
component.hpp:18
flecs::_::event_from_func
Definition
decl.hpp:19
flecs::arity
Trait to get the number of arguments of a callable.
Definition
function_traits.hpp:119
flecs::event_builder_typed
Typed event builder.
Definition
builder.hpp:97
flecs::event_builder
Untyped event builder.
Definition
builder.hpp:91
flecs::if_t
enable_if_t< V, int > if_t
Convenience enable_if alias using int as default type.
Definition
utils.hpp:168
Esc
↑
↓
to navigate
↵
to open
Esc
to close