#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.
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 |
struct alpaqa::util::BasicVTable::required_function |
A required function includes a void pointer to self, in addition to the arguments of F
.
Definition at line 81 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 86 of file type-erasure.hpp.
|
default |
|
inlinenoexcept |
Definition at line 100 of file type-erasure.hpp.
required_function_t<void(void *storage) const> copy = nullptr |
Copy-construct a new instance into storage.
Definition at line 89 of file type-erasure.hpp.
required_function_t<void(void *storage)> move = nullptr |
Move-construct a new instance into storage.
Definition at line 91 of file type-erasure.hpp.
required_function_t<void()> destroy = nullptr |
Destruct the given instance.
Definition at line 93 of file type-erasure.hpp.
The original type of the stored object.
Definition at line 95 of file type-erasure.hpp.