#include <alpaqa/util/type-erasure.hpp>
Struct that stores the size of a polymorphic object, as well as pointers to functions to copy, move or destroy the object.
Inherit from this struct to add useful functions.
Definition at line 56 of file type-erasure.hpp.
Inheritance diagram for BasicVTable:
Collaboration diagram for BasicVTable:Classes | |
| struct | optional_const_function |
| struct | optional_const_function< R(Args...), VTable > |
| struct | optional_function |
| struct | optional_function< R(Args...), VTable > |
| struct | required_const_function |
| struct | required_const_function< R(Args...)> |
| struct | required_function |
| struct | required_function< R(Args...)> |
Public Types | |
| template<class F > | |
| using | required_function_t = typename required_function< F >::type |
A required function includes a void pointer to self, in addition to the arguments of F. | |
| template<class F > | |
| using | required_const_function_t = typename required_const_function< F >::type |
A required function includes a void pointer to self, in addition to the arguments of F. | |
| template<class F , class VTable = BasicVTable> | |
| using | optional_function_t = typename optional_function< F, VTable >::type |
An optional function includes a void pointer to self, the arguments of F, and an additional reference to the VTable, so that it can be implemented in terms of other functions. | |
| template<class F , class VTable = BasicVTable> | |
| using | optional_const_function_t = typename optional_const_function< F, VTable >::type |
An optional function includes a void pointer to self, the arguments of F, and an additional reference to the VTable, so that it can be implemented in terms of other functions. | |
Public Member Functions | |
| BasicVTable ()=default | |
| template<class T > | |
| BasicVTable (std::in_place_t, T &) noexcept | |
Public Attributes | |
| required_const_function_t< void(void *storage)> | copy = nullptr |
| Copy-construct a new instance into storage. | |
| required_function_t< void(void *storage)> | move = nullptr |
| Move-construct a new instance into storage. | |
| required_function_t< void()> | destroy = nullptr |
| Destruct the given instance. | |
| const std::type_info * | type = &typeid(void) |
| The original type of the stored object. | |
| struct alpaqa::util::BasicVTable::optional_const_function |
Collaboration diagram for BasicVTable::optional_const_function< class, VTable >:| struct alpaqa::util::BasicVTable::optional_function |
Collaboration diagram for BasicVTable::optional_function< class, VTable >:| struct alpaqa::util::BasicVTable::required_const_function |
Collaboration diagram for BasicVTable::required_const_function< class >:| struct alpaqa::util::BasicVTable::required_function |
Collaboration diagram for BasicVTable::required_function< class >:A required function includes a void pointer to self, in addition to the arguments of F.
Definition at line 85 of file type-erasure.hpp.
A required function includes a void pointer to self, in addition to the arguments of F.
For const-qualified member functions.
Definition at line 89 of file type-erasure.hpp.
| using optional_function_t = typename optional_function<F, VTable>::type |
An optional function includes a void pointer to self, the arguments of F, and an additional reference to the VTable, so that it can be implemented in terms of other functions.
Definition at line 94 of file type-erasure.hpp.
An optional function includes a void pointer to self, the arguments of F, and an additional reference to the VTable, so that it can be implemented in terms of other functions.
For const-qualified member functions.
Definition at line 98 of file type-erasure.hpp.
|
default |
|
inlinenoexcept |
Definition at line 113 of file type-erasure.hpp.
| required_const_function_t<void(void *storage)> copy = nullptr |
Copy-construct a new instance into storage.
Definition at line 102 of file type-erasure.hpp.
| required_function_t<void(void *storage)> move = nullptr |
Move-construct a new instance into storage.
Definition at line 104 of file type-erasure.hpp.
| required_function_t<void()> destroy = nullptr |
Destruct the given instance.
Definition at line 106 of file type-erasure.hpp.
The original type of the stored object.
Definition at line 108 of file type-erasure.hpp.