Function Subspace :: sus :: boxed :: dyn
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
for more on type erasure of
concept-satisfying types.