Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2002-12-03 18:49:37


Does this have any merit whatsoever?

template <typename T, typename U>
T* dangerous_cast(U* p)
{
    return static_cast<T*>(static_cast<void*>(p));
}

Obviously, you only use it when you know the binary layout of some
object(s) and no other cast produces defined or reliable behaviour.
Of course, I'm not sure this produces either of those either. :(

Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk