class
ConstructibleTraitDescribes how a reflected type may be constructed and destructed.
Public types
-
template<typename T>class Builder
- Builder for ConstructibleTrait.
-
using Destructor = memory::
Function<void(void*instance) const > - Function pointer to the destructor of a type.
-
using DefaultConstructor = memory::
Function<void(void*instance) const > - Function pointer to the default constructor of a type.
-
using CopyConstructor = memory::
Function<void(void*instance, const void*other) const > - Function pointer to the copy constructor of a type.
-
using MoveConstructor = memory::
Function<void(void*instance, void*other) const > - Function pointer to the move constructor of a type.
Public static functions
Constructors, destructors, conversion operators
- ConstructibleTrait(std::size_t size, std::size_t alignment, Destructor destructor)
- Constructs.
Public functions
- auto withDefaultConstructor(DefaultConstructor defaultConstructor) && -> ConstructibleTrait&&
- Sets the default constructor of the type.
- auto withCopyConstructor(CopyConstructor copyConstructor) && -> ConstructibleTrait&&
- Sets the copy constructor of the type.
- auto withMoveConstructor(MoveConstructor moveConstructor) && -> ConstructibleTrait&&
- Sets the move constructor of the type.
- auto size() const -> std::size_t
- Returns the size of the type in bytes.
- auto alignment() const -> std::size_t
- Returns the alignment of the type in bytes.
- auto hasDefaultConstruct() const -> bool
- Checks if default construction is supported.
- auto hasCopyConstruct() const -> bool
- Checks if copy construction is supported.
- auto hasMoveConstruct() const -> bool
- Checks if move construction is supported.
- void destruct(void* instance) const
- Destructs an instance of the type.
- void defaultConstruct(void* instance) const
- Default constructs an instance of the type.
- void copyConstruct(void* instance, const void* other) const
- Copy constructs an instance of the type.
- void moveConstruct(void* instance, void* other) const
- Move constructs an instance of the type.
- auto destructor() const -> Destructor
- Gets the destructor of the type.
- auto defaultConstructor() const -> DefaultConstructor
- Gets the default constructor of the type.
- auto copyConstructor() const -> CopyConstructor
- Gets the copy constructor of the type.
- auto moveConstructor() const -> MoveConstructor
- Gets the move constructor of the type.
Function documentation
cubos:: core:: reflection:: ConstructibleTrait:: ConstructibleTrait(std::size_t size,
std::size_t alignment,
Destructor destructor)
Constructs.
Parameters | |
---|---|
size | Size of the type in bytes. |
alignment | Alignment of the type in bytes (must be a power of two). |
destructor | Destructor of the type. |
ConstructibleTrait&& cubos:: core:: reflection:: ConstructibleTrait:: withDefaultConstructor(DefaultConstructor defaultConstructor) &&
Sets the default constructor of the type.
Parameters | |
---|---|
defaultConstructor | Function pointer to the default constructor of the type. |
Returns | Trait. |
Aborts if the default constructor has already been set.
ConstructibleTrait&& cubos:: core:: reflection:: ConstructibleTrait:: withCopyConstructor(CopyConstructor copyConstructor) &&
Sets the copy constructor of the type.
Parameters | |
---|---|
copyConstructor | Function pointer to the copy constructor of the type. |
Returns | Trait. |
Aborts if the copy constructor has already been set.
ConstructibleTrait&& cubos:: core:: reflection:: ConstructibleTrait:: withMoveConstructor(MoveConstructor moveConstructor) &&
Sets the move constructor of the type.
Parameters | |
---|---|
moveConstructor | Function pointer to the move constructor of the type. |
Returns | Trait. |
Aborts if the copy constructor has already been set.
std::size_t cubos:: core:: reflection:: ConstructibleTrait:: size() const
Returns the size of the type in bytes.
Returns | Size of the type in bytes. |
---|
std::size_t cubos:: core:: reflection:: ConstructibleTrait:: alignment() const
Returns the alignment of the type in bytes.
Returns | Alignment of the type in bytes. |
---|
bool cubos:: core:: reflection:: ConstructibleTrait:: hasDefaultConstruct() const
Checks if default construction is supported.
Returns | Whether the operation is supported. |
---|
bool cubos:: core:: reflection:: ConstructibleTrait:: hasCopyConstruct() const
Checks if copy construction is supported.
Returns | Whether the operation is supported. |
---|
bool cubos:: core:: reflection:: ConstructibleTrait:: hasMoveConstruct() const
Checks if move construction is supported.
Returns | Whether the operation is supported. |
---|
void cubos:: core:: reflection:: ConstructibleTrait:: destruct(void* instance) const
Destructs an instance of the type.
Parameters | |
---|---|
instance | Pointer to the instance to destruct. |
void cubos:: core:: reflection:: ConstructibleTrait:: defaultConstruct(void* instance) const
Default constructs an instance of the type.
Parameters | |
---|---|
instance | Pointer to the location to construct the instance at. |
void cubos:: core:: reflection:: ConstructibleTrait:: copyConstruct(void* instance,
const void* other) const
Copy constructs an instance of the type.
Parameters | |
---|---|
instance | Pointer to the location to construct the instance at. |
other | Pointer to the instance to copy construct from. |
void cubos:: core:: reflection:: ConstructibleTrait:: moveConstruct(void* instance,
void* other) const
Move constructs an instance of the type.
Parameters | |
---|---|
instance | Pointer to the location to construct the instance at. |
other | Pointer to the instance to move construct from. |
Destructor cubos:: core:: reflection:: ConstructibleTrait:: destructor() const
Gets the destructor of the type.
Returns | Destructor of the type. |
---|
DefaultConstructor cubos:: core:: reflection:: ConstructibleTrait:: defaultConstructor() const
Gets the default constructor of the type.
Returns | Default constructor of the type. |
---|
CopyConstructor cubos:: core:: reflection:: ConstructibleTrait:: copyConstructor() const
Gets the copy constructor of the type.
Returns | Copy constructor of the type. |
---|
MoveConstructor cubos:: core:: reflection:: ConstructibleTrait:: moveConstructor() const
Gets the move constructor of the type.
Returns | Move constructor of the type. |
---|