|
guanaqo
1.0.0-alpha.24
Utilities for scientific software
|
Small-buffer-optimized type erasure with configurable vtables.
Files | |
| file | any-ptr.hpp |
| Non-owning and shared pointer wrappers with type tagging. | |
| file | required-method.hpp |
| Macros to populate type-erased vtables from member functions in guanaqo::TypeErased. | |
| file | type-erasure.hpp |
| Flexible type erasure utilities. | |
Concepts | |
| concept | guanaqo::derived_from_TypeErased |
Classes | |
| class | guanaqo::any_ptr |
| Like std::any, but storing just the pointer, without any dynamic allocation. More... | |
| class | guanaqo::shared_any_ptr |
| Like std::any, but storing a shared_ptr, to allow for move-only types. More... | |
| class | guanaqo::bad_type_erased_type |
| class | guanaqo::bad_type_erased_constness |
| struct | guanaqo::CopyMoveDestroyVTable |
| struct | guanaqo::BasicVTable |
| Struct that stores pointers to functions to copy, move or destroy a polymorphic object. More... | |
| class | guanaqo::TypeErased< VTable, Allocator, SmallBufferSize > |
| Class for polymorphism through type erasure. More... | |
Macros | |
| #define | GUANAQO_TE_REQUIRED_METHOD(vtable, type, member) |
| #define | GUANAQO_TE_OPTIONAL_METHOD(vtable, type, member, instance) |
Typedefs | |
| template<class F> | |
| using | guanaqo::required_function_t = typename detail::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> | |
| using | guanaqo::optional_function_t = typename detail::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. | |
Functions | |
| template<class Class, auto Method, class... ExtraArgs> | |
| constexpr auto | guanaqo::type_erased_wrapped () |
Returns a function that accepts a void pointer, casts it to the class type of the member function Method, launders it, and then invokes Method with it, passing on the arguments to Method. | |
| template<class VTable, class Allocator> | |
| constexpr size_t | guanaqo::default_te_buffer_size () |
| template<class... Types> | |
| constexpr size_t | guanaqo::required_te_buffer_size_for () |
Variables | |
| template<class T> | |
| constexpr CopyMoveDestroyVTable | guanaqo::copy_move_destroy_vtable |
| struct guanaqo::CopyMoveDestroyVTable |
| Class Members | ||
|---|---|---|
| required_function_t< void(void *storage) const > | copy | Copy-construct a new instance into storage. |
| required_function_t< void(void *storage)> | move | Move-construct a new instance into storage. |
| required_function_t< void()> | destroy | Destruct the given instance. |
| #define GUANAQO_TE_REQUIRED_METHOD | ( | vtable, | |
| type, | |||
| member ) |
#include <guanaqo/required-method.hpp>
Definition at line 11 of file required-method.hpp.
| #define GUANAQO_TE_OPTIONAL_METHOD | ( | vtable, | |
| type, | |||
| member, | |||
| instance ) |
#include <guanaqo/required-method.hpp>
Definition at line 20 of file required-method.hpp.
| using guanaqo::required_function_t = typename detail::required_function<F>::type |
#include <guanaqo/type-erasure.hpp>
A required function includes a void pointer to self, in addition to the arguments of F.
Definition at line 92 of file type-erasure.hpp.
| using guanaqo::optional_function_t = typename detail::optional_function<F, VTable>::type |
#include <guanaqo/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.
Definition at line 97 of file type-erasure.hpp.
|
constexpr |
#include <guanaqo/type-erasure.hpp>
Returns a function that accepts a void pointer, casts it to the class type of the member function Method, launders it, and then invokes Method with it, passing on the arguments to Method.
The function can also accept additional arguments at the end, of type ExtraArgs.
Definition at line 207 of file type-erasure.hpp.
|
constexpr |
#include <guanaqo/type-erasure.hpp>
Definition at line 212 of file type-erasure.hpp.
|
constexpr |
#include <guanaqo/type-erasure.hpp>
Definition at line 223 of file type-erasure.hpp.
|
constexpr |
#include <guanaqo/type-erasure.hpp>
Definition at line 109 of file type-erasure.hpp.