alpaqa no-casadi-dep
Nonconvex constrained optimization
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
BasicVTable Struct Reference

#include <alpaqa/util/type-erasure.hpp>

Detailed Description

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) constcopy = 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.
 

Class Documentation

◆ alpaqa::util::BasicVTable::optional_function

struct alpaqa::util::BasicVTable::optional_function
+ Collaboration diagram for BasicVTable::optional_function< class, VTable >:

◆ alpaqa::util::BasicVTable::required_function

struct alpaqa::util::BasicVTable::required_function
+ Collaboration diagram for BasicVTable::required_function< class >:

Member Typedef Documentation

◆ required_function_t

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.

◆ optional_function_t

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.

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

Constructor & Destructor Documentation

◆ BasicVTable() [1/2]

BasicVTable ( )
default

◆ BasicVTable() [2/2]

template<class T >
BasicVTable ( std::in_place_t  ,
T  
)
inlinenoexcept

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

Member Data Documentation

◆ copy

Copy-construct a new instance into storage.

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

◆ move

required_function_t<void(void *storage)> move = nullptr

Move-construct a new instance into storage.

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

◆ destroy

Destruct the given instance.

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

◆ type

const std::type_info* type = &typeid(void)

The original type of the stored object.

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


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