From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2002-11-24 13:27:42
>From: "Pavol Droba" <droba_at_[hidden]>
> The prerequisite I haven't mentioned is that if you wan to use a structure
> map to such a buffer, it has to have 1 byte aligmnent. Most of the
> allow this kind of specification with pragmas.
> Reinterpret-cast could be avoided like this:
> template< typename T >
> inline T* offset_cast( void* p, unsigned int offset=0 )
> return static_cast<T*>(
> static_cast< void* >( static_cast<unsigned char*> p )+offset )
Yes, but that wouldn't make it any more safe, as it would still depend on
the alignment requirements, etc. that you mention.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk