boost::openmethod::virtual_traits<boost::type_erasure::any<C, T&>, Registry>::cast

Cast to a type.

Synopsis

Declared in <boost/openmethod/interop/boost_type_erasure.hpp>

template<typename U>
requires !std::is_rvalue_reference_v<U>
static
decltype(auto)
cast(boost::type_erasure::any<C, T&> arg);

Description

Extracts the referent using boost::type_erasure::any_cast, and registers U, stripped of reference and cv‐qualifiers, in Registry as a class derived from the owning any. Supports mutable references (e.g. Dog&); modifications through the result are visible through the referent. U cannot be an rvalue reference ‐ the referent is not owned; the overloads are removed from the overload set.

Return Value

The value bound to arg, cast to U.

Template Parameters

Name

Description

U

The target type (e.g. Dog&, const Dog&, Dog).

Parameters

Name

Description

arg

The any reference method argument.

Created with MrDocs