guanaqo 1.0.0-alpha.27
Utilities for scientific software
Loading...
Searching...
No Matches
type-erasure.hpp File Reference

Detailed Description

Flexible type erasure utilities.

Definition in file type-erasure.hpp.

#include <guanaqo/demangled-typename.hpp>
#include <guanaqo/export.h>
#include <guanaqo/noop-delete.hpp>
#include <guanaqo/type-traits.hpp>
#include <algorithm>
#include <array>
#include <cassert>
#include <cstddef>
#include <exception>
#include <functional>
#include <memory>
#include <new>
#include <stdexcept>
#include <type_traits>
#include <typeinfo>
#include <utility>
Include dependency graph for type-erasure.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  guanaqo::bad_type_erased_type
class  guanaqo::bad_type_erased_constness
struct  guanaqo::detail::required_function< R(Args...)>
struct  guanaqo::detail::required_function< R(Args...) const >
struct  guanaqo::detail::optional_function< R(Args...), VTable >
struct  guanaqo::detail::optional_function< R(Args...) const, VTable >
struct  guanaqo::CopyMoveDestroyVTable
struct  guanaqo::BasicVTable
 Struct that stores pointers to functions to copy, move or destroy a polymorphic object. More...
struct  guanaqo::detail::Launderer< Class, ExtraArgs >
class  guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >
 Class for polymorphism through type erasure. More...
struct  guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::Deallocator
 Deallocates the storage when destroyed. More...

Namespaces

namespace  guanaqo
namespace  guanaqo::detail

Concepts

concept  guanaqo::derived_from_TypeErased

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