Skip to content
Flecs
v4.1
Search
Ctrl K
include
flecs
addons
cpp
utils
signature.hpp
Go to the documentation of this file.
1
/**
2
* @file addons/cpp/utils/signature.hpp
3
* @brief Compile-time utilities for deriving query attributes from a parameter pack.
4
*/
5
6
#pragma once
7
8
namespace
flecs {
9
namespace
_
{
10
11
template
<
typename
T>
12
constexpr
flecs::inout_kind_t
type_to_inout() {
13
return
is_const_p<T>::value ?
flecs::In
:
14
(is_reference<T>::value ?
flecs::InOut
:
flecs::InOutDefault
);
15
}
16
17
template
<
typename
T>
18
constexpr
flecs::oper_kind_t
type_to_oper() {
19
return
is_pointer<T>::value ?
flecs::Optional
:
flecs::And
;
20
}
21
22
template
<
typename
... Components,
typename
Builder>
23
void
populate_signature(
flecs::world_t
*world, Builder *
builder
) {
24
(void)world;
25
(void)
builder
;
26
(
builder
->with(_::type<remove_pointer_t<Components>>::id(world))
27
.inout(type_to_inout<Components>()).oper(type_to_oper<Components>()), ...);
28
}
29
30
}
// namespace _
31
}
// namespace flecs
flecs::oper_kind_t
oper_kind_t
Operator kind.
Definition
c_types.hpp:49
flecs::world_t
ecs_world_t world_t
World type.
Definition
c_types.hpp:18
flecs::inout_kind_t
inout_kind_t
Inout kind.
Definition
c_types.hpp:39
flecs::And
@ And
And operator.
Definition
c_types.hpp:50
flecs::Optional
@ Optional
Optional operator.
Definition
c_types.hpp:53
flecs::In
@ In
In.
Definition
c_types.hpp:44
flecs::InOutDefault
@ InOutDefault
InOutDefault.
Definition
c_types.hpp:40
flecs::InOut
@ InOut
InOut.
Definition
c_types.hpp:43
flecs::_
Int to enum.
Definition
component.hpp:18
flecs::_::builder
Definition
builder.hpp:15
Esc
↑
↓
to navigate
↵
to open
Esc
to close