boost::openmethod::virtual_traits<virtual_any<Any, Registry>&, 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>& arg);

Description

If U is the virtual_any itself (by mutable reference), returns arg unchanged. Otherwise, extracts the stored value using virtual_traits<Any&, Registry>::cast, and registers U, stripped of reference and cv‐qualifiers, in Registry as a class derived from Any. Supports mutable references (e.g. Dog&); modifications through the result are visible through the virtual_any.

Return Value

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

Created with MrDocs