guanaqo 1.0.0-alpha.24
Utilities for scientific software
Loading...
Searching...
No Matches
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize > Class Template Reference

#include <guanaqo/type-erasure.hpp>

Detailed Description

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
class guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >

Class for polymorphism through type erasure.

Saves the entire vtable, and uses small buffer optimization.

Definition at line 235 of file type-erasure.hpp.

Collaboration diagram for guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >:

Classes

struct  Deallocator
 Deallocates the storage when destroyed. More...

Public Types

using allocator_type = Allocator

Public Member Functions

 TypeErased () noexcept(noexcept(allocator_type()) &&noexcept(VTable()))=default
 Default constructor.
template<class Alloc>
 TypeErased (std::allocator_arg_t, const Alloc &alloc)
 Default constructor (allocator aware).
 TypeErased (const TypeErased &other)
 Copy constructor.
 TypeErased (const TypeErased &other, const allocator_type &alloc)
 Copy constructor (allocator aware).
 TypeErased (std::allocator_arg_t, const allocator_type &alloc, const TypeErased &other)
 Copy constructor (allocator aware).
TypeErasedoperator= (const TypeErased &other)
 Copy assignment.
 TypeErased (TypeErased &&other) noexcept
 Move constructor.
 TypeErased (TypeErased &&other, const allocator_type &alloc) noexcept
 Move constructor (allocator aware).
 TypeErased (std::allocator_arg_t, const allocator_type &alloc, TypeErased &&other) noexcept
 Move constructor (allocator aware).
TypeErasedoperator= (TypeErased &&other) noexcept
 Move assignment.
 ~TypeErased ()
 Destructor.
template<class T, class Alloc>
 TypeErased (std::allocator_arg_t, const Alloc &alloc, T &&d)
 Main constructor that type-erases the given argument.
template<class T, class Alloc, class... Args>
 TypeErased (std::allocator_arg_t, const Alloc &alloc, std::in_place_type_t< T >, Args &&...args)
 Main constructor that type-erases the object constructed from the given argument.
template<class T>
 TypeErased (T &&d)
 Main constructor that type-erases the given argument.
template<class T, class... Args>
 TypeErased (std::in_place_type_t< T >, Args &&...args)
 Main constructor that type-erases the object constructed from the given argument.
 operator bool () const noexcept
 Check if this wrapper wraps an object.
bool owns_referenced_object () const noexcept
 Check if this wrapper owns the storage of the wrapped object, or whether it simply stores a reference to an object that was allocated elsewhere.
bool referenced_object_is_const () const noexcept
 Check if the wrapped object is const.
allocator_type get_allocator () const noexcept
 Get a copy of the allocator.
const std::type_info & type () const noexcept
 Query the contained type.
template<class T>
T & as () &
 Convert the type-erased object to the given type.
template<class T>
T & as () const &
 Convert the type-erased object to the given type.
template<class T>
T && as () &&
 Convert the type-erased object to the given type.
void * get_pointer () const
 Get a type-erased pointer to the wrapped object.
const void * get_const_pointer () const
 Get a type-erased pointer to the wrapped object.

Static Public Member Functions

template<class Ret, class T, class Alloc, class... Args>
static Ret make (std::allocator_arg_t tag, const Alloc &alloc, Args &&...args)
 Construct a type-erased wrapper of type Ret for an object of type T, initialized in-place with the given arguments.
template<class Ret, class T, class... Args>
static Ret make (Args &&...args)
 Construct a type-erased wrapper of type Ret for an object of type T, initialized in-place with the given arguments.

Static Public Attributes

static constexpr size_t small_buffer_size = SmallBufferSize

Protected Member Functions

template<class T, class... Args>
void construct_inplace (Args &&...args)
 Ensure storage and construct the type-erased object of type T in-place.
template<class Ret, class... FArgs, class... Args>
decltype(auto) call (Ret(*f)(const void *, FArgs...), Args &&...args) const
 Call the vtable function f with the given arguments args, implicitly passing the self pointer and vtable reference if necessary.
template<class Ret, class... FArgs, class... Args>
decltype(auto) call (Ret(*f)(void *, FArgs...), Args &&...args)
 Call the vtable function f with the given arguments args, implicitly passing the self pointer and vtable reference if necessary.
template<class Ret>
decltype(auto) call (Ret(*f)(const void *)) const
 Call the vtable function f with the given arguments args, implicitly passing the self pointer and vtable reference if necessary.
template<class Ret>
decltype(auto) call (Ret(*f)(void *))
 Call the vtable function f with the given arguments args, implicitly passing the self pointer and vtable reference if necessary.
template<class Ret>
decltype(auto) call (Ret(*f)(const void *, const VTable &)) const
 Call the vtable function f with the given arguments args, implicitly passing the self pointer and vtable reference if necessary.
template<class Ret>
decltype(auto) call (Ret(*f)(void *, const VTable &))
 Call the vtable function f with the given arguments args, implicitly passing the self pointer and vtable reference if necessary.

Static Protected Member Functions

static bool size_indicates_ownership (size_t size)
static bool size_indicates_const (size_t size)

Protected Attributes

void * self = nullptr
 Pointer to the stored object.
size_t size = invalid_size
 Size required to store the object.
VTable vtable

Static Protected Attributes

static constexpr size_t invalid_size
static constexpr size_t mut_ref_size
static constexpr size_t const_ref_size

Private Types

using allocator_traits = std::allocator_traits<allocator_type>
using buffer_type = std::array<std::byte, small_buffer_size>

Private Member Functions

Deallocator allocate (size_t size)
 Ensure that storage is available, either by using the small buffer if it is large enough, or by calling the allocator.
void deallocate ()
 Deallocate the memory without invoking the destructor.
void cleanup ()
 Destroy the type-erased object (if not empty), and deallocate the memory if necessary.
template<bool CopyAllocator>
void do_copy_assign (const TypeErased &other)

Private Attributes

buffer_type small_buffer
allocator_type allocator

Static Private Attributes

template<class T>
static constexpr auto no_child_of_ours
 True if T is not a child class of TypeErased.

Friends

template<std::derived_from< TypeErased > Child>
void derived_from_TypeErased_helper (const Child &) noexcept

Member Typedef Documentation

◆ allocator_type

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
using guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::allocator_type = Allocator

Definition at line 238 of file type-erasure.hpp.

◆ allocator_traits

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
using guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::allocator_traits = std::allocator_traits<allocator_type>
private

Definition at line 241 of file type-erasure.hpp.

◆ buffer_type

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
using guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::buffer_type = std::array<std::byte, small_buffer_size>
private

Definition at line 242 of file type-erasure.hpp.

Constructor & Destructor Documentation

◆ TypeErased() [1/12]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::TypeErased ( ) &&
defaultnoexcept

Default constructor.

Here is the caller graph for this function:

◆ TypeErased() [2/12]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class Alloc>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::TypeErased ( std::allocator_arg_t ,
const Alloc & alloc )
inline

Default constructor (allocator aware).

Definition at line 278 of file type-erasure.hpp.

Here is the call graph for this function:

◆ TypeErased() [3/12]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::TypeErased ( const TypeErased< VTable, Allocator, SmallBufferSize > & other)
inline

Copy constructor.

Definition at line 281 of file type-erasure.hpp.

Here is the call graph for this function:

◆ TypeErased() [4/12]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::TypeErased ( const TypeErased< VTable, Allocator, SmallBufferSize > & other,
const allocator_type & alloc )
inline

Copy constructor (allocator aware).

Definition at line 288 of file type-erasure.hpp.

Here is the call graph for this function:

◆ TypeErased() [5/12]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::TypeErased ( std::allocator_arg_t ,
const allocator_type & alloc,
const TypeErased< VTable, Allocator, SmallBufferSize > & other )
inline

Copy constructor (allocator aware).

Definition at line 293 of file type-erasure.hpp.

Here is the call graph for this function:

◆ TypeErased() [6/12]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::TypeErased ( TypeErased< VTable, Allocator, SmallBufferSize > && other)
inlinenoexcept

Move constructor.

Definition at line 310 of file type-erasure.hpp.

Here is the call graph for this function:

◆ TypeErased() [7/12]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::TypeErased ( TypeErased< VTable, Allocator, SmallBufferSize > && other,
const allocator_type & alloc )
inlinenoexcept

Move constructor (allocator aware).

Definition at line 333 of file type-erasure.hpp.

Here is the call graph for this function:

◆ TypeErased() [8/12]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::TypeErased ( std::allocator_arg_t ,
const allocator_type & alloc,
TypeErased< VTable, Allocator, SmallBufferSize > && other )
inlinenoexcept

Move constructor (allocator aware).

Definition at line 370 of file type-erasure.hpp.

Here is the call graph for this function:

◆ ~TypeErased()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::~TypeErased ( )
inline

Destructor.

Definition at line 431 of file type-erasure.hpp.

Here is the call graph for this function:

◆ TypeErased() [9/12]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class T, class Alloc>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::TypeErased ( std::allocator_arg_t ,
const Alloc & alloc,
T && d )
inlineexplicit

Main constructor that type-erases the given argument.

Definition at line 436 of file type-erasure.hpp.

Here is the call graph for this function:

◆ TypeErased() [10/12]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class T, class Alloc, class... Args>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::TypeErased ( std::allocator_arg_t ,
const Alloc & alloc,
std::in_place_type_t< T > ,
Args &&... args )
inlineexplicit

Main constructor that type-erases the object constructed from the given argument.

Definition at line 443 of file type-erasure.hpp.

Here is the call graph for this function:

◆ TypeErased() [11/12]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class T>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::TypeErased ( T && d)
inlineexplicit

Main constructor that type-erases the given argument.

Requirement prevents this constructor from taking precedence over the copy and move constructors.

Definition at line 453 of file type-erasure.hpp.

Here is the call graph for this function:

◆ TypeErased() [12/12]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class T, class... Args>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::TypeErased ( std::in_place_type_t< T > ,
Args &&... args )
inlineexplicit

Main constructor that type-erases the object constructed from the given argument.

Definition at line 459 of file type-erasure.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ size_indicates_ownership()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
bool guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::size_indicates_ownership ( size_t size)
inlinestaticnodiscardprotected

Definition at line 259 of file type-erasure.hpp.

Here is the caller graph for this function:

◆ size_indicates_const()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
bool guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::size_indicates_const ( size_t size)
inlinestaticnodiscardprotected

Definition at line 262 of file type-erasure.hpp.

Here is the caller graph for this function:

◆ operator=() [1/2]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
TypeErased & guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::operator= ( const TypeErased< VTable, Allocator, SmallBufferSize > & other)
inline

Copy assignment.

Definition at line 298 of file type-erasure.hpp.

Here is the call graph for this function:

◆ operator=() [2/2]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
TypeErased & guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::operator= ( TypeErased< VTable, Allocator, SmallBufferSize > && other)
inlinenoexcept

Move assignment.

Definition at line 375 of file type-erasure.hpp.

Here is the call graph for this function:

◆ make() [1/2]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class Ret, class T, class Alloc, class... Args>
Ret guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::make ( std::allocator_arg_t tag,
const Alloc & alloc,
Args &&... args )
inlinestatic

Construct a type-erased wrapper of type Ret for an object of type T, initialized in-place with the given arguments.

Definition at line 467 of file type-erasure.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ make() [2/2]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class Ret, class T, class... Args>
Ret guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::make ( Args &&... args)
inlinestatic

Construct a type-erased wrapper of type Ret for an object of type T, initialized in-place with the given arguments.

Definition at line 477 of file type-erasure.hpp.

Here is the call graph for this function:

◆ operator bool()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::operator bool ( ) const
inlineexplicitnoexcept

Check if this wrapper wraps an object.

False for default-constructed objects.

Definition at line 484 of file type-erasure.hpp.

◆ owns_referenced_object()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
bool guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::owns_referenced_object ( ) const
inlinenodiscardnoexcept

Check if this wrapper owns the storage of the wrapped object, or whether it simply stores a reference to an object that was allocated elsewhere.

Definition at line 489 of file type-erasure.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ referenced_object_is_const()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
bool guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::referenced_object_is_const ( ) const
inlinenodiscardnoexcept

Check if the wrapped object is const.

Definition at line 494 of file type-erasure.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_allocator()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
allocator_type guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::get_allocator ( ) const
inlinenoexcept

Get a copy of the allocator.

Definition at line 499 of file type-erasure.hpp.

◆ type()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
const std::type_info & guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::type ( ) const
inlinenodiscardnoexcept

Query the contained type.

Definition at line 502 of file type-erasure.hpp.

Here is the caller graph for this function:

◆ as() [1/3]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class T>
T & guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::as ( ) &
inlinenodiscard

Convert the type-erased object to the given type.

Exceptions
guanaqo::bad_type_erased_typeIf T does not match the stored type.

Definition at line 511 of file type-erasure.hpp.

Here is the call graph for this function:

◆ as() [2/3]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class T>
T & guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::as ( ) const &
inlinenodiscard

Convert the type-erased object to the given type.

Exceptions
guanaqo::bad_type_erased_typeIf T does not match the stored type.

Definition at line 521 of file type-erasure.hpp.

Here is the call graph for this function:

◆ as() [3/3]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class T>
T && guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::as ( ) &&
inlinenodiscard

Convert the type-erased object to the given type.

Exceptions
guanaqo::bad_type_erased_typeIf T does not match the stored type.

Definition at line 528 of file type-erasure.hpp.

Here is the call graph for this function:

◆ get_pointer()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
void * guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::get_pointer ( ) const
inlinenodiscard

Get a type-erased pointer to the wrapped object.

Exceptions
guanaqo::bad_type_erased_constnessIf the wrapped object is const.
See also
get_const_pointer()

Definition at line 540 of file type-erasure.hpp.

Here is the call graph for this function:

◆ get_const_pointer()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
const void * guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::get_const_pointer ( ) const
inlinenodiscard

Get a type-erased pointer to the wrapped object.

Definition at line 546 of file type-erasure.hpp.

◆ allocate()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
Deallocator guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::allocate ( size_t size)
inlineprivate

Ensure that storage is available, either by using the small buffer if it is large enough, or by calling the allocator.

Returns a RAII wrapper that deallocates the storage unless released.

Definition at line 572 of file type-erasure.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deallocate()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
void guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::deallocate ( )
inlineprivate

Deallocate the memory without invoking the destructor.

Definition at line 584 of file type-erasure.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanup()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
void guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::cleanup ( )
inlineprivate

Destroy the type-erased object (if not empty), and deallocate the memory if necessary.

Definition at line 596 of file type-erasure.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_copy_assign()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<bool CopyAllocator>
void guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::do_copy_assign ( const TypeErased< VTable, Allocator, SmallBufferSize > & other)
inlineprivate

Definition at line 606 of file type-erasure.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ construct_inplace()

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class T, class... Args>
void guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::construct_inplace ( Args &&... args)
inlineprotected

Ensure storage and construct the type-erased object of type T in-place.

Definition at line 631 of file type-erasure.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ call() [1/6]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class Ret, class... FArgs, class... Args>
decltype(auto) guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::call ( Ret(* )(const void *, FArgs...),
Args &&... args ) const
inlineprotected

Call the vtable function f with the given arguments args, implicitly passing the self pointer and vtable reference if necessary.

Definition at line 662 of file type-erasure.hpp.

◆ call() [2/6]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class Ret, class... FArgs, class... Args>
decltype(auto) guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::call ( Ret(* )(void *, FArgs...),
Args &&... args )
inlineprotected

Call the vtable function f with the given arguments args, implicitly passing the self pointer and vtable reference if necessary.

Definition at line 674 of file type-erasure.hpp.

Here is the call graph for this function:

◆ call() [3/6]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class Ret>
decltype(auto) guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::call ( Ret(* )(const void *)) const
inlineprotected

Call the vtable function f with the given arguments args, implicitly passing the self pointer and vtable reference if necessary.

Definition at line 688 of file type-erasure.hpp.

◆ call() [4/6]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class Ret>
decltype(auto) guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::call ( Ret(* )(void *))
inlineprotected

Call the vtable function f with the given arguments args, implicitly passing the self pointer and vtable reference if necessary.

Definition at line 695 of file type-erasure.hpp.

Here is the call graph for this function:

◆ call() [5/6]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class Ret>
decltype(auto) guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::call ( Ret(* )(const void *, const VTable &)) const
inlineprotected

Call the vtable function f with the given arguments args, implicitly passing the self pointer and vtable reference if necessary.

Definition at line 704 of file type-erasure.hpp.

◆ call() [6/6]

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class Ret>
decltype(auto) guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::call ( Ret(* )(void *, const VTable &))
inlineprotected

Call the vtable function f with the given arguments args, implicitly passing the self pointer and vtable reference if necessary.

Definition at line 712 of file type-erasure.hpp.

Here is the call graph for this function:

◆ derived_from_TypeErased_helper

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<std::derived_from< TypeErased > Child>
void derived_from_TypeErased_helper ( const Child & )
friend
See also
derived_from_TypeErased

Definition at line 550 of file type-erasure.hpp.

Member Data Documentation

◆ small_buffer_size

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
size_t guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::small_buffer_size = SmallBufferSize
staticconstexpr

Definition at line 237 of file type-erasure.hpp.

◆ small_buffer

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
buffer_type guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::small_buffer
private

Definition at line 243 of file type-erasure.hpp.

◆ allocator

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
allocator_type guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::allocator
private

Definition at line 244 of file type-erasure.hpp.

◆ no_child_of_ours

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
template<class T>
auto guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::no_child_of_ours
staticconstexprprivate
Initial value:
=
!std::is_base_of_v<TypeErased, std::remove_cvref_t<T>>

True if T is not a child class of TypeErased.

Definition at line 249 of file type-erasure.hpp.

◆ invalid_size

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
size_t guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::invalid_size
staticconstexprprotected
Initial value:
=
static_cast<size_t>(0xDEAD'BEEF'DEAD'BEEF)

Definition at line 253 of file type-erasure.hpp.

◆ mut_ref_size

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
size_t guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::mut_ref_size
staticconstexprprotected
Initial value:
=
static_cast<size_t>(0xFFFF'FFFF'FFFF'FFFF)

Definition at line 255 of file type-erasure.hpp.

◆ const_ref_size

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
size_t guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::const_ref_size
staticconstexprprotected
Initial value:
=
static_cast<size_t>(0xFFFF'FFFF'FFFF'FFFE)

Definition at line 257 of file type-erasure.hpp.

◆ self

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
void* guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::self = nullptr
protected

Pointer to the stored object.

Definition at line 267 of file type-erasure.hpp.

◆ size

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
size_t guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::size = invalid_size
protected

Size required to store the object.

Definition at line 269 of file type-erasure.hpp.

◆ vtable

template<class VTable = BasicVTable, class Allocator = std::allocator<std::byte>, size_t SmallBufferSize = default_te_buffer_size<VTable, Allocator>()>
VTable guanaqo::TypeErased< VTable, Allocator, SmallBufferSize >::vtable
protected

Definition at line 270 of file type-erasure.hpp.


The documentation for this class was generated from the following file: