BloombergLP::bsls::PointerCastUtil::cast

Return the specified from value cast to TO_TYPE, casting it in two steps, first to an integer type the size of a pointer and then to the target type. This function is intended to be used to cast between function and data pointers, as doing such a cast directly was once illegal. The behavior is undefined unless both FROM_TYPE and TO_TYPE are not larger than the intermediate integer type.

Synopsis

Declared in <bsls_pointercastutil.h>

template<
    class TO_TYPE,
    class FROM_TYPE>
static
TO_TYPE
cast(FROM_TYPE from);