19#define FLECS_PLACEMENT_NEW(_ptr, _type) ::new(flecs::_::placement_new_tag, _ptr) _type
20#define FLECS_NEW(_type) FLECS_PLACEMENT_NEW(ecs_os_malloc(sizeof(_type)), _type)
21#define FLECS_DELETE(_ptr) \
24 flecs::_::destruct_obj(_ptr); \
33#define FLECS_MOV(...) \
34 static_cast<flecs::remove_reference_t<decltype(__VA_ARGS__)>&&>(__VA_ARGS__)
36#define FLECS_FWD(...) \
37 static_cast<decltype(__VA_ARGS__)&&>(__VA_ARGS__)
48template<
class Ty>
inline void destruct_obj(Ty* _ptr) { _ptr->~Ty(); }
49template<
class Ty>
inline void free_obj(
void* _ptr) {
51 destruct_obj(
static_cast<Ty*
>(_ptr));
61#ifndef flecs_static_assert
62#define flecs_static_assert(cond, str) static_assert(cond, str)
73template <
bool V,
typename T,
typename F>
74using conditional_t =
typename std::conditional<V, T, F>::type;
77using decay_t =
typename std::decay<T>::type;
79template <
bool V,
typename T =
void>
80using enable_if_t =
typename std::enable_if<V, T>::type;
83using remove_pointer_t =
typename std::remove_pointer<T>::type;
86using remove_reference_t =
typename std::remove_reference<T>::type;
89using underlying_type_t =
typename std::underlying_type<T>::type;
95using std::is_reference;
96using std::is_volatile;
102using is_const_p = is_const< remove_pointer_t<T> >;
106template<
class Src,
class Dst>
107using transcribe_const_t = conditional_t<is_const<Src>::value, Dst
const, Dst>;
109template<
class Src,
class Dst>
110using transcribe_volatile_t = conditional_t<is_volatile<Src>::value, Dst
volatile, Dst>;
112template<
class Src,
class Dst>
113using transcribe_cv_t = transcribe_const_t< Src, transcribe_volatile_t< Src, Dst> >;
115template<
class Src,
class Dst>
116using transcribe_pointer_t = conditional_t<is_pointer<Src>::value, Dst*, Dst>;
118template<
class Src,
class Dst>
119using transcribe_cvp_t = transcribe_cv_t< Src, transcribe_pointer_t< Src, Dst> >;
131using if_t = enable_if_t<V, int>;
134using if_not_t = enable_if_t<false == V, int>;
142 static const bool value =
false;
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.