Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2003-02-06 20:35:48

"Philippe A. Bouchard" <philippeb_at_[hidden]> wrote in message
> First, thanks!

No problem, but it was just to help you get started. You obviously
know more about shifted_ptr than I do, so use your own experience
here. ;)

> [...]
> Great to know there is now some pre-condition like
> checking_policy.

Yup. Customizable checking is nice.

> [...]
> One little thing: the pointee_ must be of type T * because of
> polymorphic objects with multiple inheritance that keep shifting
> the pointer implicitly; and to have a fast operator *.

Ok. Then set it to T*. ;)

> [...]
> > shifted_storage(pointer_type p)
> > : pointee_(static_cast<stored_type>(
> > static_cast<char*>(static_cast<void*>(p)) -
> > sizeof(shifted_header)
> > ))
> > { }
> > // I think the arithmetic above is valid, because we're
> > dealing with // POD types, but IANALL, so take it with a
> > grain of salt
> Maybe it would be better to use 'shifted_address<size_t, size_t>::get()'
> instead of 'static_cast<void*>(p)) - sizeof(shifted_header)' because
> pointer_type does not necessarily point to the beginning of the object.

Sure. That was just filler until you put in the more appropriate code. ;)

> [...]
> It's interesting to know that some checking_policy is provided. It kind
> of open doors to test the validity of the address at run-time.
> Conversions will be interesting also.

You might have to pull some tricks with the Ownership policy, I'm not
sure. For conversions, the pointer casts should work, unless you need
to do some tricks.


Boost list run by bdawes at, gregod at, cpdaniel at, john at