18#define FLECS_PLACEMENT_NEW(_ptr, _type) ::new(flecs::_::placement_new_tag, _ptr) _type
19#define FLECS_NEW(_type) FLECS_PLACEMENT_NEW(ecs_os_malloc(sizeof(_type)), _type)
20#define FLECS_DELETE(_ptr) \
23 flecs::_::destruct_obj(_ptr); \
32#define FLECS_MOV(...) \
33 static_cast<flecs::remove_reference_t<decltype(__VA_ARGS__)>&&>(__VA_ARGS__)
35#define FLECS_FWD(...) \
36 static_cast<decltype(__VA_ARGS__)&&>(__VA_ARGS__)
45struct placement_new_tag_t{};
47constexpr placement_new_tag_t placement_new_tag{};
49template<
class Ty>
inline void destruct_obj(Ty* _ptr) { _ptr->~Ty(); }
51template<
class Ty>
inline void free_obj(
void* _ptr) {
53 destruct_obj(
static_cast<Ty*
>(_ptr));
63#ifndef flecs_static_assert
64#define flecs_static_assert(cond, str) static_assert(cond, str)
67inline void*
operator new(size_t, flecs::_::placement_new_tag_t,
void* _ptr)
noexcept {
return _ptr; }
68inline void operator delete(
void*, flecs::_::placement_new_tag_t,
void*)
noexcept { }
79 template <
typename T,
typename F>
using type = F;
85 template <
typename T,
typename F>
using type = T;
88using std::conditional_t;
90using std::enable_if_t;
91using std::remove_pointer_t;
92using std::remove_reference_t;
93using std::underlying_type_t;
98using std::is_reference;
99using std::is_volatile;
102using std::is_trivially_constructible;
103using std::is_trivially_move_assignable;
104using std::is_trivially_copy_assignable;
105using std::is_trivially_copy_constructible;
106using std::is_trivially_move_constructible;
107using std::is_trivially_copyable;
108using std::is_move_assignable;
109using std::is_move_constructible;
110using std::is_copy_constructible;
111using std::is_trivially_destructible;
112using std::is_empty_v;
113using std::is_const_v;
114using std::is_pointer_v;
115using std::is_reference_v;
116using std::is_volatile_v;
119using std::is_base_of_v;
120using std::is_trivially_constructible_v;
121using std::is_trivially_destructible_v;
122using std::is_trivially_copyable_v;
123using std::is_trivially_move_constructible_v;
124using std::is_trivially_copy_constructible_v;
125using std::is_trivially_move_assignable_v;
126using std::is_trivially_copy_assignable_v;
127using std::is_default_constructible_v;
128using std::is_move_constructible_v;
129using std::is_copy_constructible_v;
130using std::is_move_assignable_v;
131using std::is_copy_assignable_v;
132using std::is_destructible_v;
139template<
class Src,
class Dst>
143template<
class Src,
class Dst>
147template<
class Src,
class Dst>
151template<
class Src,
class Dst>
155template<
class Src,
class Dst>
168using if_t = enable_if_t<V, int>;
180 static const bool value =
false;
197#if defined(__GNUC__) || defined(_WIN32)
199inline const char* type_name() {
200 static const size_t len = ECS_FUNC_TYPE_LEN(
const char*, type_name, ECS_FUNC_NAME);
201 static char result[len + 1] = {};
202 static const size_t front_len = ECS_FUNC_NAME_FRONT(
const char*, type_name);
203 static const char* cppTypeName = ecs_cpp_get_type_name(result, ECS_FUNC_NAME, len, front_len);
207#error "implicit component registration not supported"
Compile-time enum reflection utilities.
Compile-time utilities to inspect properties of functions.
String utility that doesn't implicitly allocate memory.
Wrapper around ecs_strbuf_t that provides a simple stringstream-like API.
F type
Select the second type.
T type
Select the first type.
Compile-time conditional type selector (faster alternative to std::conditional).
enable_if_t< false==V, int > if_not_t
Convenience enable_if alias for negated conditions.
enable_if_t< V, int > if_t
Convenience enable_if alias using int as default type.
conditional_t< is_volatile< Src >::value, Dst volatile, Dst > transcribe_volatile_t
Apply volatile from source type to destination type.
transcribe_cv_t< Src, transcribe_pointer_t< Src, Dst > > transcribe_cvp_t
Apply const, volatile, and pointer from source type to destination type.
is_const< remove_pointer_t< T > > is_const_p
Determine constness even if T is a pointer type.
conditional_t< is_const< Src >::value, Dst const, Dst > transcribe_const_t
Apply const from source type to destination type.
conditional_t< is_pointer< Src >::value, Dst *, Dst > transcribe_pointer_t
Apply pointer from source type to destination type.
transcribe_const_t< Src, transcribe_volatile_t< Src, Dst > > transcribe_cv_t
Apply const and volatile from source type to destination type.