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)
75 template <
typename T,
typename F>
using type = F;
79 template <
typename T,
typename F>
using type = T;
84template <
bool C,
typename T,
typename F>
88using decay_t =
typename std::decay<T>::type;
90template <
bool V,
typename T =
void>
91using enable_if_t =
typename std::enable_if<V, T>::type;
94using remove_pointer_t =
typename std::remove_pointer<T>::type;
97using remove_reference_t =
typename std::remove_reference<T>::type;
100using underlying_type_t =
typename std::underlying_type<T>::type;
102using std::is_base_of;
105using std::is_pointer;
106using std::is_reference;
107using std::is_volatile;
112#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 9)
119 struct is_trivially_constructible {
120 static const bool value = __is_pod(T);
124 struct is_trivially_move_assignable {
125 static const bool value = __is_pod(T);
129 struct is_trivially_copy_assignable {
130 static const bool value = __is_pod(T);
134 struct is_trivially_copy_constructible {
135 static const bool value = __is_pod(T);
139 struct is_trivially_move_constructible {
140 static const bool value = __is_pod(T);
144 struct is_trivially_copyable {
145 static const bool value = __is_pod(T);
151using std::is_trivially_constructible;
152using std::is_trivially_move_assignable;
153using std::is_trivially_copy_assignable;
154using std::is_trivially_copy_constructible;
155using std::is_trivially_move_constructible;
156using std::is_trivially_copyable;
160using std::is_move_assignable;
161using std::is_move_constructible;
162using std::is_copy_constructible;
163using std::is_trivially_destructible;
167using is_const_p = is_const< remove_pointer_t<T> >;
171template<
class Src,
class Dst>
172using transcribe_const_t = conditional_t<is_const<Src>::value, Dst
const, Dst>;
174template<
class Src,
class Dst>
175using transcribe_volatile_t = conditional_t<is_volatile<Src>::value, Dst
volatile, Dst>;
177template<
class Src,
class Dst>
178using transcribe_cv_t = transcribe_const_t< Src, transcribe_volatile_t< Src, Dst> >;
180template<
class Src,
class Dst>
181using transcribe_pointer_t = conditional_t<is_pointer<Src>::value, Dst*, Dst>;
183template<
class Src,
class Dst>
184using transcribe_cvp_t = transcribe_cv_t< Src, transcribe_pointer_t< Src, Dst> >;
196using if_t = enable_if_t<V, int>;
199using if_not_t = enable_if_t<false == V, int>;
207 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.