boost::openmethod::virtual_traits<virtual_any<Any, Registry> const&, Registry>::cast

Cast to a type.

Synopsis

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

template<typename U>
static
decltype(auto)
cast(virtual_any<Any, Registry> const& arg);

Description

If U is the virtual_any itself (by any reference category), returns arg unchanged. Otherwise, extracts the stored value using virtual_traits<const Any&, Registry>::cast, and registers U, stripped of reference and cv‐qualifiers, in Registry as a class derived from Any. Since the any is not modifiable, U cannot be a mutable reference.

Return Value

The value stored in 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 virtual_any method argument.

Created with MrDocs