boost::openmethod::virtual_traits<std::shared_ptr<Class> const&, Registry>::cast :: Boost.OpenMethod

# boost::openmethod::virtual_traits<std::shared_ptr<Class> const&, Registry>::cast

Cast to another type.

## Synopsis

Declared in `<boost/openmethod/interop/std_shared_ptr.hpp>`

    template<class Other>
    static
    decltype(auto)
    cast(std::shared_ptr<Class> const& obj);

## Description

Cast to a `std::shared_ptr` to another type. If possible, use `std::static_pointer_cast`. Otherwise, use `std::dynamic_pointer_cast`.

## Return Value

A `std::shared_ptr` to the same object, cast to `Derived::element_type`.

## Template Parameters

Name | Description
--- | ---
Derived | A lvalue reference type to a `std::shared_ptr`.

## Parameters

Name | Description
--- | ---
obj | A reference to a `const shared_ptr<Class>`.

Created with MrDocs