Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Function template runtime_pointer_cast

boost::typeindex::runtime_pointer_cast — Safely converts pointers to classes up, down, and sideways along the inheritance hierarchy.

Synopsis

// In header: <boost/type_index/runtime_cast/pointer_cast.hpp>


template<typename T, typename U> T const * runtime_pointer_cast(U const * u);

Description

Template Parameters:

T

The desired target type to return a pointer to.

U

A complete class type of the source instance, u.

Returns:

If there exists a valid conversion from U const* to T const*, returns a T const* that points to an address suitably offset from u. If no such conversion exists, returns NULL.


PrevUpHomeNext