On Sun, Nov 24, 2002 at 06:30:46PM +0100, Dirk Gerrits wrote:
> Pavol Droba wrote:
>
> > Hi,
> >
> > I have developed a simple cast function which I found very useful.
> > Here it is:
> >
> > template< typename T >
> > inline T offset_cast( void* p, unsigned int offset=0 )
> > {
> > return reinterpret_cast< T >( static_cast( p )+offset );
> > }
> >
> > template< typename T >
> > inline T offset_cast( const void* p, unsigned int offset=0 )
> > {
> > return reinterpret_cast< T >( static_cast( p )+offset );
> > }
>
> Why only unsigned offsets?
That was what I needed, but there is no reason why not to support negative
offset as well.
Pavol
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost