
on Fri Nov 06 2009, Gottlob Frege <gottlobfrege-AT-gmail.com> wrote:
Didn't check, but I think this case (flex_string) was probably doing some kind of small buffer optimization. Regardless, consider something like boost optional. Doesn't it hold a non-allocated buffer for the optional T? The type of the buffer is probably char []. I haven't tried it, but can you static_cast that to T? Via an intermediate cast to void * or something?
Yes, exactly that way; and it's well-defined.
(And do we know if static_cast would solve the original warnings? This is orthogonal to whether we should ever use reinterpret_cast, of course.)
I have no idea; that's compiler specific, but I've never seen a warning about a static_cast. -- Dave Abrahams Meet me at BoostCon: http://www.boostcon.com BoostPro Computing http://www.boostpro.com