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;
101#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 9)
108 struct is_trivially_constructible {
109 static const bool value = __is_pod(T);
113 struct is_trivially_move_assignable {
114 static const bool value = __is_pod(T);
118 struct is_trivially_copy_assignable {
119 static const bool value = __is_pod(T);
123 struct is_trivially_copy_constructible {
124 static const bool value = __is_pod(T);
128 struct is_trivially_move_constructible {
129 static const bool value = __is_pod(T);
133 struct is_trivially_copyable {
134 static const bool value = __is_pod(T);
140using std::is_trivially_constructible;
141using std::is_trivially_move_assignable;
142using std::is_trivially_copy_assignable;
143using std::is_trivially_copy_constructible;
144using std::is_trivially_move_constructible;
145using std::is_trivially_copyable;
149using std::is_move_assignable;
150using std::is_move_constructible;
151using std::is_copy_constructible;
152using std::is_trivially_destructible;
156using is_const_p = is_const< remove_pointer_t<T> >;
160template<
class Src,
class Dst>
161using transcribe_const_t = conditional_t<is_const<Src>::value, Dst
const, Dst>;
163template<
class Src,
class Dst>
164using transcribe_volatile_t = conditional_t<is_volatile<Src>::value, Dst
volatile, Dst>;
166template<
class Src,
class Dst>
167using transcribe_cv_t = transcribe_const_t< Src, transcribe_volatile_t< Src, Dst> >;
169template<
class Src,
class Dst>
170using transcribe_pointer_t = conditional_t<is_pointer<Src>::value, Dst*, Dst>;
172template<
class Src,
class Dst>
173using transcribe_cvp_t = transcribe_cv_t< Src, transcribe_pointer_t< Src, Dst> >;
185using if_t = enable_if_t<V, int>;
188using if_not_t = enable_if_t<false == V, int>;
196 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.