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> &&
            (!detail::te_mutable_target<U> || detail::te_owning<T> ||
             detail::te_mutable_bound<T>)
static
decltype(auto)
cast(boost::type_erasure::any<C, T>& 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. Supports mutable references (e.g. Dog&), except through the const any reference (any<Concept, const _self&>). U cannot be an rvalue reference: moving the value out must go through an explicit rvalue‐reference parameter. The disallowed 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

A mutable reference to the any method argument.

Created with MrDocs