#include <alpaqa/problem/ocproblem.hpp>
Nonlinear optimal control problem with finite horizon \( N \).
\[ \newcommand\U{U} \newcommand\D{D} \newcommand\nnu{{n_u}} \newcommand\nnx{{n_x}} \newcommand\nny{{n_y}} \newcommand\xinit{x_\text{init}} \begin{equation}\label{eq:OCP} \tag{OCP}\hspace{-0.8em} \begin{aligned} &\minimize_{u,x} && \sum_{k=0}^{N-1} \ell_k\big(h_k(x^k, u^k)\big) + \ell_N\big(h_N(x^N)\big)\hspace{-0.8em} \\ &\subjto && u^k \in \U \\ &&& c_k(x^k) \in \D \\ &&& c_N(x^N) \in \D_N \\ &&& x^0 = \xinit \\ &&& x^{k+1} = f(x^k, u^k) \quad\quad (0 \le k \lt N) \end{aligned} \end{equation} \]
The function \( f : \R^\nnx \times \R^\nnu \to \R^\nnx \) models the discrete-time, nonlinear dynamics of the system, which starts from an initial state \( \xinit \). The functions \( h_k : \R^\nnx \times \R^\nnu \to \R^{n_h} \) for \( 0 \le k \lt N \) and \( h_N : \R^\nnx \to \R^{n_h^N} \) can be used to represent the (possibly time-varying) output mapping of the system, and the convex functions \( \ell_k : \R^{n_h} \to \R \) and \( \ell_N : \R^{n_h^N} \to \R \) define the stage costs and the terminal cost respectively. Stage constraints and terminal constraints are represented by the functions \( c_k : \R^{n_x} \to \R^{n_c} \) and \( c_N : \R^{n_x} \to \R^{n_c^N} \), and the boxes \( D \) and \( D_N \).
Additional functions for computing Gauss-Newton approximations of the cost Hessian are included as well:
\[ \begin{aligned} q^k &\defeq \tp{\jac_{h_k}^x\!(\barxuk)} \nabla \ell_k(\hhbar^k) \\ r^k &\defeq \tp{\jac_{h_k}^u\!(\barxuk)} \nabla \ell_k(\hhbar^k) \\ \Lambda_k &\defeq \partial^2 \ell_k(\hhbar^k) \\ Q_k &\defeq \tp{\jac_{h_k}^x\!(\barxuk)} \Lambda_k\, \jac_{h_k}^x\!(\barxuk) \\ S_k &\defeq \tp{\jac_{h_k}^u\!(\barxuk)} \Lambda_k\, \jac_{h_k}^x\!(\barxuk) \\ R_k &\defeq \tp{\jac_{h_k}^u\!(\barxuk)} \Lambda_k\, \jac_{h_k}^u\!(\barxuk). \\ \end{aligned} \]
See [3] for more details.
Definition at line 240 of file ocproblem.hpp.
Problem dimensions | |
length_t | get_N () const |
Horizon length. | |
length_t | get_nu () const |
Number of inputs. | |
length_t | get_nx () const |
Number of states. | |
length_t | get_nh () const |
Number of outputs. | |
length_t | get_nh_N () const |
length_t | get_nc () const |
Number of constraints. | |
length_t | get_nc_N () const |
Dim | get_dim () const |
All dimensions. | |
length_t | get_n () const |
Total number of variables. | |
length_t | get_m () const |
Total number of constraints. | |
Projections onto constraint sets | |
void | eval_proj_diff_g (crvec z, rvec e) const |
[Required] Function that evaluates the difference between the given point \( z \) and its projection onto the constraint set \( D \). | |
void | eval_proj_multipliers (rvec y, real_t M) const |
[Required] Function that projects the Lagrange multipliers for ALM. | |
Constraint sets | |
void | get_U (Box &U) const |
Input box constraints \( U \). | |
void | get_D (Box &D) const |
Stage box constraints \( D \). | |
void | get_D_N (Box &D) const |
Terminal box constraints \( D_N \). | |
Dynamics and initial state | |
void | get_x_init (rvec x_init) const |
Initial state \( x_\text{init} \). | |
void | eval_f (index_t timestep, crvec x, crvec u, rvec fxu) const |
Discrete-time dynamics \( x^{k+1} = f_k(x^k, u^k) \). | |
void | eval_jac_f (index_t timestep, crvec x, crvec u, rmat J_fxu) const |
Jacobian of discrete-time dynamics \( \jac_f(x^k, u^k) \). | |
void | eval_grad_f_prod (index_t timestep, crvec x, crvec u, crvec p, rvec grad_fxu_p) const |
Gradient-vector product of discrete-time dynamics \( \nabla f(x^k, u^k)\,p \). | |
Output mapping | |
void | eval_h (index_t timestep, crvec x, crvec u, rvec h) const |
Stage output mapping \( h_k(x^k, u^k) \). | |
void | eval_h_N (crvec x, rvec h) const |
Terminal output mapping \( h_N(x^N) \). | |
Stage and terminal cost | |
real_t | eval_l (index_t timestep, crvec h) const |
Stage cost \( \ell_k(\hbar^k) \). | |
real_t | eval_l_N (crvec h) const |
Terminal cost \( \ell_N(\hbar^N) \). | |
Gauss-Newton approximations | |
void | eval_qr (index_t timestep, crvec xu, crvec h, rvec qr) const |
Cost gradients w.r.t. | |
void | eval_q_N (crvec x, crvec h, rvec q) const |
Terminal cost gradient w.r.t. | |
void | eval_add_Q (index_t timestep, crvec xu, crvec h, rmat Q) const |
Cost Hessian w.r.t. | |
void | eval_add_Q_N (crvec x, crvec h, rmat Q) const |
Terminal cost Hessian w.r.t. | |
void | eval_add_R_masked (index_t timestep, crvec xu, crvec h, crindexvec mask, rmat R, rvec work) const |
Cost Hessian w.r.t. | |
void | eval_add_S_masked (index_t timestep, crvec xu, crvec h, crindexvec mask, rmat S, rvec work) const |
Cost Hessian w.r.t. | |
void | eval_add_R_prod_masked (index_t timestep, crvec xu, crvec h, crindexvec mask_J, crindexvec mask_K, crvec v, rvec out, rvec work) const |
\( out \leftarrow out + R[\mathcal J, \mathcal K]\,v[\mathcal K] \). | |
void | eval_add_S_prod_masked (index_t timestep, crvec xu, crvec h, crindexvec mask_K, crvec v, rvec out, rvec work) const |
\( out \leftarrow out + \tp{S[\mathcal K, \cdot]}\, v[\mathcal K] \). | |
length_t | get_R_work_size () const |
Size of the workspace required by eval_add_R_masked() and eval_add_R_prod_masked(). | |
length_t | get_S_work_size () const |
Size of the workspace required by eval_add_S_masked() and eval_add_S_prod_masked(). | |
Constraints | |
void | eval_constr (index_t timestep, crvec x, rvec c) const |
Stage constraints \( c_k(x^k) \). | |
void | eval_constr_N (crvec x, rvec c) const |
Terminal constraints \( c_N(x^N) \). | |
void | eval_grad_constr_prod (index_t timestep, crvec x, crvec p, rvec grad_cx_p) const |
Gradient-vector product of stage constraints \( \nabla c_k(x^k)\, p \). | |
void | eval_grad_constr_prod_N (crvec x, crvec p, rvec grad_cx_p) const |
Gradient-vector product of terminal constraints \( \nabla c_N(x^N)\, p \). | |
void | eval_add_gn_hess_constr (index_t timestep, crvec x, crvec M, rmat out) const |
Gauss-Newton Hessian of stage constraints \( \tp{\jac_{c_k}}(x^k)\,
\operatorname{diag}(M)\; \jac_{c_k}(x^k) \). | |
void | eval_add_gn_hess_constr_N (crvec x, crvec M, rmat out) const |
Gauss-Newton Hessian of terminal constraints \( \tp{\jac_{c_N}}(x^N)\,
\operatorname{diag}(M)\; \jac_{c_N}(x^N) \). | |
Checks | |
void | check () const |
Check that the problem formulation is well-defined, the dimensions match, etc. | |
Querying specialized implementations | |
bool | provides_get_D () const |
bool | provides_get_D_N () const |
bool | provides_eval_h () const |
bool | provides_eval_h_N () const |
bool | provides_eval_add_Q_N () const |
bool | provides_eval_add_R_prod_masked () const |
bool | provides_eval_add_S_prod_masked () const |
bool | provides_get_R_work_size () const |
bool | provides_get_S_work_size () const |
bool | provides_eval_constr () const |
bool | provides_eval_constr_N () const |
bool | provides_eval_grad_constr_prod () const |
bool | provides_eval_grad_constr_prod_N () const |
bool | provides_eval_add_gn_hess_constr () const |
bool | provides_eval_add_gn_hess_constr_N () const |
Public Types | |
using | VTable = ControlProblemVTable< config_t > |
using | allocator_type = Allocator |
using | Box = typename VTable::Box |
using | Dim = OCPDim< config_t > |
using | TypeErased = util::TypeErased< VTable, allocator_type > |
Public Member Functions | |
TypeErased () noexcept(noexcept(allocator_type()))=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, allocator_type alloc) | |
Copy constructor (allocator aware). | |
TypeErased (TypeErased &&other) noexcept | |
Move constructor. | |
TypeErased (TypeErased &&other, const allocator_type &alloc) noexcept | |
Move constructor (allocator aware). | |
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, te_in_place_t< T >, Args &&...args) | |
Main constructor that type-erases the object constructed from the given argument. | |
template<class T > requires no_child_of_ours<T> | |
TypeErased (T &&d) | |
template<class T , class... Args> | |
TypeErased (te_in_place_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. | |
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 > | |
const T & | as () const & |
Convert the type-erased object to the given type. | |
template<class T > | |
const T && | as () && |
Convert the type-erased object to the given type. | |
Static Public Member Functions | |
template<class T , class... Args> | |
static TypeErasedControlProblem | make (Args &&...args) |
template<class Ret , class T , class Alloc , class... Args> requires std::is_base_of_v<TypeErased, Ret> | |
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. | |
Static Public Attributes | |
static constexpr size_t | small_buffer_size = SmallBufferSize |
Protected Member Functions | |
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. | |
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 > | |
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. | |
Protected Attributes | |
void * | self |
Pointer to the stored object. | |
VTable | vtable |
size_t | size = invalid_size |
Size required to store the object. | |
Static Protected Attributes | |
static constexpr size_t | invalid_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. | |
using VTable = ControlProblemVTable<config_t> |
Definition at line 243 of file ocproblem.hpp.
using allocator_type = Allocator |
Definition at line 244 of file ocproblem.hpp.
using Box = typename VTable::Box |
Definition at line 245 of file ocproblem.hpp.
Definition at line 246 of file ocproblem.hpp.
using TypeErased = util::TypeErased<VTable, allocator_type> |
Definition at line 247 of file ocproblem.hpp.
|
privateinherited |
Definition at line 200 of file type-erasure.hpp.
|
privateinherited |
Definition at line 201 of file type-erasure.hpp.
|
inlinestatic |
Definition at line 257 of file ocproblem.hpp.
|
inline |
Horizon length.
Definition at line 265 of file ocproblem.hpp.
|
inline |
Number of inputs.
Definition at line 267 of file ocproblem.hpp.
|
inline |
Number of states.
Definition at line 269 of file ocproblem.hpp.
|
inline |
Number of outputs.
Definition at line 271 of file ocproblem.hpp.
|
inline |
Definition at line 272 of file ocproblem.hpp.
|
inline |
Number of constraints.
Definition at line 274 of file ocproblem.hpp.
|
inline |
Definition at line 275 of file ocproblem.hpp.
|
inline |
All dimensions.
Definition at line 277 of file ocproblem.hpp.
|
inline |
Total number of variables.
Definition at line 289 of file ocproblem.hpp.
|
inline |
Total number of constraints.
Definition at line 291 of file ocproblem.hpp.
[Required] Function that evaluates the difference between the given point \( z \) and its projection onto the constraint set \( D \).
[in] | z | Slack variable, \( z \in \R^m \) |
[out] | e | The difference relative to its projection, \( e = z - \Pi_D(z) \in \R^m \) |
z
and e
can refer to the same vector. Definition at line 522 of file ocproblem.hpp.
[Required] Function that projects the Lagrange multipliers for ALM.
[in,out] | y | Multipliers, \( y \leftarrow \Pi_Y(y) \in \R^m \) |
[in] | M | The radius/size of the set \( Y \). See ALMParams::max_multiplier. |
Definition at line 523 of file ocproblem.hpp.
|
inline |
Input box constraints \( U \).
Definition at line 524 of file ocproblem.hpp.
|
inline |
Stage box constraints \( D \).
Definition at line 525 of file ocproblem.hpp.
|
inline |
Terminal box constraints \( D_N \).
Definition at line 526 of file ocproblem.hpp.
|
inline |
Initial state \( x_\text{init} \).
Definition at line 527 of file ocproblem.hpp.
Discrete-time dynamics \( x^{k+1} = f_k(x^k, u^k) \).
Definition at line 528 of file ocproblem.hpp.
Jacobian of discrete-time dynamics \( \jac_f(x^k, u^k) \).
Definition at line 529 of file ocproblem.hpp.
Gradient-vector product of discrete-time dynamics \( \nabla f(x^k, u^k)\,p \).
Definition at line 530 of file ocproblem.hpp.
Stage output mapping \( h_k(x^k, u^k) \).
Definition at line 531 of file ocproblem.hpp.
Terminal output mapping \( h_N(x^N) \).
Definition at line 532 of file ocproblem.hpp.
Stage cost \( \ell_k(\hbar^k) \).
Definition at line 533 of file ocproblem.hpp.
|
inline |
Terminal cost \( \ell_N(\hbar^N) \).
Definition at line 534 of file ocproblem.hpp.
Cost gradients w.r.t.
states and inputs \( q^k = \tp{\jac_{h_k}^x\!(\barxuk)} \nabla \ell_k(\hbar^k) \) and \( r^k = \tp{\jac_{h_k}^u\!(\barxuk)} \nabla \ell_k(\hbar^k) \).
Definition at line 535 of file ocproblem.hpp.
Terminal cost gradient w.r.t.
states \( q^N = \tp{\jac_{h_N}(\bar x^N)} \nabla \ell_k(\hbar^N) \).
Definition at line 536 of file ocproblem.hpp.
Cost Hessian w.r.t.
states \( Q_k = \tp{\jac_{h_k}^x\!(\barxuk)}
\partial^2\ell_k(\hbar^k)\, \jac_{h_k}^x\!(\barxuk) \), added to the given matrix Q
. \( Q \leftarrow Q + Q_k \).
Definition at line 537 of file ocproblem.hpp.
Terminal cost Hessian w.r.t.
states \( Q_N = \tp{\jac_{h_N}(\bar x^N)}
\partial^2\ell_N(\hbar^N)\, \jac_{h_N}(\bar x^N) \), added to the given matrix Q
. \( Q \leftarrow Q + Q_N \).
Definition at line 538 of file ocproblem.hpp.
|
inline |
Cost Hessian w.r.t.
inputs \( R_k = \tp{\jac_{h_k}^u\!(\barxuk)}
\partial^2\ell_k(\hbar^k)\, \jac_{h_k}^u\!(\barxuk) \), keeping only rows and columns in the mask \( \mathcal J \), added to the given matrix R
. \( R \leftarrow R + R_k[\mathcal J, \mathcal J] \). The size of work
should be get_R_work_size().
Definition at line 539 of file ocproblem.hpp.
|
inline |
Cost Hessian w.r.t.
inputs and states \( S_k = \tp{\jac_{h_k}^u\!(\barxuk)}
\partial^2\ell_k(\hbar^k)\, \jac_{h_k}^x\!(\barxuk) \), keeping only rows in the mask \( \mathcal J \), added to the given matrix S
. \( S \leftarrow S + S_k[\mathcal J, \cdot] \). The size of work
should be get_S_work_size().
Definition at line 540 of file ocproblem.hpp.
|
inline |
\( out \leftarrow out + R[\mathcal J, \mathcal K]\,v[\mathcal K] \).
Work should contain the contents written to it by a prior call to eval_add_R_masked() in the same point.
Definition at line 541 of file ocproblem.hpp.
|
inline |
\( out \leftarrow out + \tp{S[\mathcal K, \cdot]}\, v[\mathcal K] \).
Work should contain the contents written to it by a prior call to eval_add_S_masked() in the same point.
Definition at line 542 of file ocproblem.hpp.
|
inline |
Size of the workspace required by eval_add_R_masked() and eval_add_R_prod_masked().
Definition at line 543 of file ocproblem.hpp.
|
inline |
Size of the workspace required by eval_add_S_masked() and eval_add_S_prod_masked().
Definition at line 544 of file ocproblem.hpp.
Stage constraints \( c_k(x^k) \).
Definition at line 545 of file ocproblem.hpp.
Terminal constraints \( c_N(x^N) \).
Definition at line 546 of file ocproblem.hpp.
Gradient-vector product of stage constraints \( \nabla c_k(x^k)\, p \).
Definition at line 547 of file ocproblem.hpp.
Gradient-vector product of terminal constraints \( \nabla c_N(x^N)\, p \).
Definition at line 548 of file ocproblem.hpp.
Gauss-Newton Hessian of stage constraints \( \tp{\jac_{c_k}}(x^k)\, \operatorname{diag}(M)\; \jac_{c_k}(x^k) \).
Definition at line 549 of file ocproblem.hpp.
Gauss-Newton Hessian of terminal constraints \( \tp{\jac_{c_N}}(x^N)\, \operatorname{diag}(M)\; \jac_{c_N}(x^N) \).
Definition at line 550 of file ocproblem.hpp.
|
inline |
Check that the problem formulation is well-defined, the dimensions match, etc.
Throws an exception if this is not the case.
Definition at line 551 of file ocproblem.hpp.
|
inline |
Definition at line 452 of file ocproblem.hpp.
|
inline |
Definition at line 453 of file ocproblem.hpp.
|
inline |
Definition at line 454 of file ocproblem.hpp.
|
inline |
Definition at line 455 of file ocproblem.hpp.
|
inline |
Definition at line 456 of file ocproblem.hpp.
|
inline |
Definition at line 457 of file ocproblem.hpp.
|
inline |
Definition at line 458 of file ocproblem.hpp.
|
inline |
Definition at line 459 of file ocproblem.hpp.
|
inline |
Definition at line 460 of file ocproblem.hpp.
|
inline |
Definition at line 461 of file ocproblem.hpp.
|
inline |
Definition at line 462 of file ocproblem.hpp.
|
inline |
Definition at line 463 of file ocproblem.hpp.
|
inline |
Definition at line 464 of file ocproblem.hpp.
|
inline |
Definition at line 465 of file ocproblem.hpp.
|
inline |
Definition at line 466 of file ocproblem.hpp.
|
defaultnoexcept |
Default constructor.
|
inline |
Default constructor (allocator aware).
Definition at line 225 of file type-erasure.hpp.
|
inline |
Copy constructor.
Definition at line 227 of file type-erasure.hpp.
|
inline |
Copy constructor (allocator aware).
Definition at line 233 of file type-erasure.hpp.
|
inlinenoexcept |
Move constructor.
Definition at line 249 of file type-erasure.hpp.
|
inlinenoexcept |
Move constructor (allocator aware).
Definition at line 267 of file type-erasure.hpp.
|
inlineexplicit |
Main constructor that type-erases the given argument.
Definition at line 352 of file type-erasure.hpp.
|
inlineexplicit |
Main constructor that type-erases the object constructed from the given argument.
Definition at line 359 of file type-erasure.hpp.
|
inlineexplicit |
Requirement prevents this constructor from taking precedence over the copy and move constructors.
Definition at line 369 of file type-erasure.hpp.
|
inlineexplicit |
Main constructor that type-erases the object constructed from the given argument.
Definition at line 375 of file type-erasure.hpp.
|
inlineprotected |
Call the vtable function f
with the given arguments args
, implicitly passing the self pointer and vtable reference if necessary.
Definition at line 514 of file type-erasure.hpp.
|
inlineprotected |
Call the vtable function f
with the given arguments args
, implicitly passing the self pointer and vtable reference if necessary.
Definition at line 526 of file type-erasure.hpp.
|
inlineprotected |
Call the vtable function f
with the given arguments args
, implicitly passing the self pointer and vtable reference if necessary.
Definition at line 538 of file type-erasure.hpp.
|
inlineprotected |
Call the vtable function f
with the given arguments args
, implicitly passing the self pointer and vtable reference if necessary.
Definition at line 545 of file type-erasure.hpp.
|
inlineprotected |
Call the vtable function f
with the given arguments args
, implicitly passing the self pointer and vtable reference if necessary.
Definition at line 552 of file type-erasure.hpp.
|
inlineprotected |
Call the vtable function f
with the given arguments args
, implicitly passing the self pointer and vtable reference if necessary.
Definition at line 560 of file type-erasure.hpp.
|
inlinestaticinherited |
Construct a type-erased wrapper of type Ret for an object of type T, initialized in-place with the given arguments.
Definition at line 383 of file type-erasure.hpp.
|
inlineexplicitnoexceptinherited |
Check if this wrapper wraps an object.
False for default-constructed objects.
Definition at line 400 of file type-erasure.hpp.
|
inlinenoexceptinherited |
Get a copy of the allocator.
Definition at line 403 of file type-erasure.hpp.
|
inlinenoexceptinherited |
Query the contained type.
Definition at line 406 of file type-erasure.hpp.
|
inlineinherited |
Convert the type-erased object to the given type.
The type is checked in debug builds only, use with caution.
Definition at line 413 of file type-erasure.hpp.
|
inlineinherited |
Convert the type-erased object to the given type.
The type is checked in debug builds only, use with caution.
Definition at line 420 of file type-erasure.hpp.
|
inlineinherited |
Convert the type-erased object to the given type.
The type is checked in debug builds only, use with caution.
Definition at line 427 of file type-erasure.hpp.
|
inlineprivateinherited |
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 450 of file type-erasure.hpp.
|
inlineprivateinherited |
Deallocate the memory without invoking the destructor.
Definition at line 460 of file type-erasure.hpp.
|
inlineprivateinherited |
Destroy the type-erased object (if not empty), and deallocate the memory if necessary.
Definition at line 470 of file type-erasure.hpp.
|
inlineprivateinherited |
|
inlineprotectedinherited |
Ensure storage and construct the type-erased object of type T in-place.
Definition at line 498 of file type-erasure.hpp.
|
inlineprotectedinherited |
Call the vtable function f
with the given arguments args
, implicitly passing the self pointer and vtable reference if necessary.
Definition at line 552 of file type-erasure.hpp.
|
inlineprotectedinherited |
Call the vtable function f
with the given arguments args
, implicitly passing the self pointer and vtable reference if necessary.
Definition at line 560 of file type-erasure.hpp.
|
protected |
Pointer to the stored object.
Definition at line 215 of file type-erasure.hpp.
|
protected |
Definition at line 218 of file type-erasure.hpp.
|
staticconstexprinherited |
Definition at line 196 of file type-erasure.hpp.
|
privateinherited |
Definition at line 202 of file type-erasure.hpp.
|
privateinherited |
Definition at line 203 of file type-erasure.hpp.
|
staticconstexprprivateinherited |
True if T
is not a child class of TypeErased.
Definition at line 208 of file type-erasure.hpp.
|
staticconstexprprotectedinherited |
Definition at line 212 of file type-erasure.hpp.
|
protectedinherited |
Size required to store the object.
Definition at line 217 of file type-erasure.hpp.