#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 57 of file type-erasure.hpp.
Inheritance diagram for BasicVTable:
Collaboration diagram for BasicVTable:Classes | |
| struct | optional_function |
| struct | optional_function< R(Args...) const, VTable > |
| struct | optional_function< R(Args...), VTable > |
| struct | required_function |
| struct | required_function< R(Args...) const > |
| 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 , 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. | |
Public Member Functions | |
| BasicVTable ()=default | |
| template<class T > | |
| BasicVTable (std::in_place_t, T &) noexcept | |
Public Attributes | |
| required_function_t< void(void *storage) const > | 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_function |
Collaboration diagram for BasicVTable::optional_function< class, VTable >:| 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 82 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 87 of file type-erasure.hpp.
|
default |
|
inlinenoexcept |
Definition at line 101 of file type-erasure.hpp.
| required_function_t<void(void *storage) const> copy = nullptr |
Copy-construct a new instance into storage.
Definition at line 90 of file type-erasure.hpp.
| required_function_t<void(void *storage)> move = nullptr |
Move-construct a new instance into storage.
Definition at line 92 of file type-erasure.hpp.
| required_function_t<void()> destroy = nullptr |
Destruct the given instance.
Definition at line 94 of file type-erasure.hpp.
The original type of the stored object.
Definition at line 96 of file type-erasure.hpp.