Contains minimal information to execute the value semantics operations of a type.
More...
|
detail::ValueSemantics | semantics () const |
| Retuns the type-erased semantics of the type. See valueSemantics().
|
|
std::size_t | sizeOf () const |
| Returns the size of the type.
|
|
const char * | typeName () const |
| Returns the name of the type.
|
|
bool | isPointer () const |
| Checks if the type is a pointer type.
|
|
detail::ValueSemanticsOperationFunction | semantics (detail::ValueSemanticsOperation operation) const |
| Returns the function implementing the given valuesemantics operation for the type.
|
|
void | copyConstruct (void *where, const void *other) const |
| Copy constructs values of the type If the passed arguments are not of the represented type, the behavior is undefined. More...
|
|
void | moveConstruct (void *where, void *other) const |
| Move constructs values of the type If the passed arguments are not of the represented type, the behavior is undefined. More...
|
|
void | copyAssign (void *where, const void *other) const |
| Move assigns values of the type If the passed arguments are not of the represented type, the behavior is undefined. More...
|
|
void | moveAssign (void *where, void *other) const |
| Move assigns values of the type If the passed arguments are not of the represented type, the behavior is undefined. More...
|
|
void | destroy (void *where) const |
| Destroys objects of the type If the passed arguments are not of the represented type, the behavior is undefined. More...
|
|
std::size_t | alignment () const |
| returns the alignment of the type
|
|
Contains minimal information to execute the value semantics operations of a type.
This class stores the alignment and value semantics operations of a type. The value semantics operations are aset of type-erased functions mapping to the different value semantics features (CopyConstructible, DefaultConstructible, etc). This mapping is implemented as a lookup table of function pointers.
std::aligned_storage<sizeof(std::string), alignof(std::string)> stringStorage;
std::string str = "hello, world!";
auto typeInfo = TypeInfo::get<std::string>();
typeInfo.copyConstruct(&stringStorage, &str);
char buffer[64];
typeInfo.copyConstruct(
&str
);