Class Subspace :: sus :: boxed :: Dyn

template <class DynC, class ConcreteT>
class Dyn
{ ... };

A type erasure of a type satisfying a concept, which can be used as a reference without heap allocation or templates. Returned from dyn.

This type is similar to Box<DynC> for purposes of type erasure but does not require heap allocation, and it converts directly to a reference to the erased type.

Use dyn to convert to a DynC reference instead of constructing this type directly.

See DynConcept for more on type erasure of concept-satisfying types.

Static Methods

Dyn(ConcreteT& concrete)
requires
!std::is_const_v<DynC>
Dyn(ConcreteT&& concrete)
requires
!std::is_const_v<DynC>

Construct a Dyn<DynC, T> from a mutable reference to T, which will vend a mutable reference DynC&.

Dyn(const ConcreteT& concrete)
requires
std::is_const_v<DynC>

Construct a Dyn<const DynC, T> from a reference to T, which will vend a const reference const DynC&.

Dyn(Dyn<DynC, ConcreteT>&&)
deleted

Dyn can not be moved.

Dyn only exists as a temporary to convert a concrete reference to a concept type to into a type-erased reference.

Conversions

Converts the reference to ConcreteT into a DynC reference.

operator DynC() &
requires
!std::is_const_v<DynC>
operator DynC() &&
requires
!std::is_const_v<DynC>
operator DynC() &&
requires
!std::is_const_v<DynC>

Operators

auto operator=(Dyn<DynC, ConcreteT>&&) -> Dyn<DynC, ConcreteT>&
deleted

Dyn can not be moved.

Dyn only exists as a temporary to convert a concrete reference to a concept type to into a type-erased reference.