>From: "Pavol Droba" <[EMAIL PROTECTED]> > > The prerequisite I haven't mentioned is that if you wan to use a structure to > map to such a buffer, it has to have 1 byte aligmnent. Most of the compilers > 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. Regards, Terje _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost