Flecs: include/flecs/addons/cpp/utils/utils.hpp File Reference
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.1 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
utils.hpp File Reference

Flecs STL (FTL?). More...

`#include "array.hpp"`
`#include "string.hpp"`
`#include "enum.hpp"`
`#include "stringstream.hpp"`
`#include "function_traits.hpp"`
Include dependency graph for utils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
struct | flecs::condition< false >
| Specialization of condition for false. More...
struct | flecs::condition< true >
| Specialization of condition for true. More...
class | flecs::is_same

## Namespaces
namespace | flecs::_
| Int to enum.

## Macros
#define | FLECS_PLACEMENT_NEW(_ptr, _type)
#define | FLECS_NEW(_type)
#define | FLECS_DELETE(_ptr)
#define | FLECS_MOV(...)
#define | FLECS_FWD(...)
#define | flecs_static_assert(cond, str)

## Typedefs
template<typename T>
using | flecs::is_const_p = is_const< remove_pointer_t<T> >
| Determine constness even if T is a pointer type.
template<class Src, class Dst>
using | flecs::transcribe_const_t = conditional_t<is_const<Src>::value, Dst const, Dst>
| Apply const from source type to destination type.
template<class Src, class Dst>
using | flecs::transcribe_volatile_t = conditional_t<is_volatile<Src>::value, Dst volatile, Dst>
| Apply volatile from source type to destination type.
template<class Src, class Dst>
using | flecs::transcribe_cv_t = transcribe_const_t< Src, transcribe_volatile_t< Src, Dst> >
| Apply const and volatile from source type to destination type.
template<class Src, class Dst>
using | flecs::transcribe_pointer_t = conditional_t<is_pointer<Src>::value, Dst*, Dst>
| Apply pointer from source type to destination type.
template<class Src, class Dst>
using | flecs::transcribe_cvp_t = transcribe_cv_t< Src, transcribe_pointer_t< Src, Dst> >
| Apply const, volatile, and pointer from source type to destination type.
template<bool V>
using | flecs::if_t = enable_if_t<V, int>
| Convenience enable_if alias using int as default type.
template<bool V>
using | flecs::if_not_t = enable_if_t<false == V, int>
| Convenience enable_if alias for negated conditions.

## Functions
void * | operator new (size_t, flecs::_::placement_new_tag_t, void *_ptr) noexcept
void | operator delete (void *, flecs::_::placement_new_tag_t, void *) noexcept

## Detailed Description

Flecs STL (FTL?).

Minimalistic utilities that allow for STL-like functionality without having to depend on the actual STL.

Definition in file utils.hpp.

## Macro Definition Documentation

## ◆ FLECS_DELETE

#define FLECS_DELETE | ( |  | _ptr | ) |

Value:
do { \
if (_ptr) { \
flecs::_::destruct_obj(_ptr); \
ecs_os_free(_ptr); \
} \
} while (false)

Definition at line 20 of file utils.hpp.

## ◆ FLECS_FWD

#define FLECS_FWD | ( |  | ... | ) |

Value:
static_cast<decltype(__VA_ARGS__)&&>(__VA_ARGS__)

Definition at line 35 of file utils.hpp.

## ◆ FLECS_MOV

#define FLECS_MOV | ( |  | ... | ) |

Value:
static_cast<flecs::remove_reference_t<decltype(__VA_ARGS__)>&&>(__VA_ARGS__)

Definition at line 32 of file utils.hpp.

## ◆ FLECS_NEW

#define FLECS_NEW | ( |  | _type | ) |

Value:
FLECS_PLACEMENT_NEW(ecs_os_malloc(sizeof(_type)), _type)

Definition at line 19 of file utils.hpp.

## ◆ FLECS_PLACEMENT_NEW

#define FLECS_PLACEMENT_NEW | ( |  | _ptr,
|  |  | _type )

Value:
::new(flecs::_::placement_new_tag, _ptr) _type

Definition at line 18 of file utils.hpp.

## ◆ flecs_static_assert

#define flecs_static_assert | ( |  | cond,
|  |  | str )

Value:
static_assert(cond, str)

Definition at line 64 of file utils.hpp.

## Typedef Documentation

## ◆ if_not_t

template<bool V>

using flecs::if_not_t = enable_if_t<false == V, int>

Convenience enable_if alias for negated conditions.

Definition at line 172 of file utils.hpp.

## ◆ if_t

template<bool V>

using flecs::if_t = enable_if_t<V, int>

Convenience enable_if alias using int as default type.

This enables writing code that's a bit less cluttered when the templates are used in a template declaration:

    enable_if_t<true>* = nullptr

vs: if_t<true> = 0

Definition at line 168 of file utils.hpp.

## ◆ is_const_p

template<typename T>

using flecs::is_const_p = is_const< remove_pointer_t<T> >

Determine constness even if T is a pointer type.

Definition at line 136 of file utils.hpp.

## ◆ transcribe_const_t

template<class Src, class Dst>

using flecs::transcribe_const_t = conditional_t<is_const<Src>::value, Dst const, Dst>

Apply const from source type to destination type.

Definition at line 140 of file utils.hpp.

## ◆ transcribe_cv_t

template<class Src, class Dst>

using flecs::transcribe_cv_t = transcribe_const_t< Src, transcribe_volatile_t< Src, Dst> >

Apply const and volatile from source type to destination type.

Definition at line 148 of file utils.hpp.

## ◆ transcribe_cvp_t

template<class Src, class Dst>

using flecs::transcribe_cvp_t = transcribe_cv_t< Src, transcribe_pointer_t< Src, Dst> >

Apply const, volatile, and pointer from source type to destination type.

Definition at line 156 of file utils.hpp.

## ◆ transcribe_pointer_t

template<class Src, class Dst>

using flecs::transcribe_pointer_t = conditional_t<is_pointer<Src>::value, Dst*, Dst>

Apply pointer from source type to destination type.

Definition at line 152 of file utils.hpp.

## ◆ transcribe_volatile_t

template<class Src, class Dst>

using flecs::transcribe_volatile_t = conditional_t<is_volatile<Src>::value, Dst volatile, Dst>

Apply volatile from source type to destination type.

Definition at line 144 of file utils.hpp.

## Function Documentation

## ◆ operator delete()

void operator delete | ( | void * | ,
|  | flecs::_::placement_new_tag_t | ,
|  | void * | )
| inlinenoexcept

Definition at line 68 of file utils.hpp.

## ◆ operator new()

void * operator new | ( | size_t | ,
|  | flecs::_::placement_new_tag_t | ,
|  | void * | _ptr )
| inlinenoexcept

Definition at line 67 of file utils.hpp.