ΒΆtemplate <class DynC, class ConcreteT>
constexpr Dyn<DynC, ConcreteT> dyn(
    ConcreteT& t) noexcept

Description

Type erases a reference to a type `T & ` which satisfies a concept `C`, into a reference `DynC & ` that also satisfies `C` but without templates. Use `dyn <DynC >(x)` to convert a mutable reference to `x` into `DynC & ` and `dyn <const DynC>(x)` to convert a const or mutable reference to `x` into `const Dyn & `. Type erasure into `DynC` allows calling a method that receives a `DynC` reference, such as `const DynC & `, without requiring a heap allocation into a `Box <DynC >`. See [`DynConcept`]($sus::boxed::DynConcept) for more on type erasure of concept-satisfying types.

Declared at: sus/boxed/dyn.h:415

Templates

DynC
ConcreteT

Parameters

ConcreteT& t