boost::openmethod::virtual_traits<boost::type_erasure::any<C, T> const&, 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> &&
            (!detail::te_mutable_target<U> || detail::te_mutable_bound<T>)
static
decltype(auto)
cast(boost::type_erasure::any<C, T> const& arg);

Description

Extracts the bound value 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. Since the any is const, U can be a mutable reference only for the mutable any reference (any<Concept, _self&>), whose referent stays mutable through a const any. Rvalue references are never allowed; 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. const Dog&, Dog).

Parameters

Name

Description

arg

A reference to a const any method argument.

Created with MrDocs