|
Boost : |
From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2003-02-07 11:22:15
David B. Held wrote:
[...]
>> 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. ;)
When I think about it, maybe I should rework offset.hpp so that arithmetics
to members is even cleaner.
> friend inline pointer_type get_impl(shifted_storage const& sp)
> { return &sp.pointee_->m_object; }
>
> friend inline stored_type& get_impl_ref(shifted_storage& sp)
> { return sp.pointee_; }
[...]
> stored_type pointee_;
I'll change pointee_ to a pointer_type but I'll keep stored_type of type
shifted_object<T> *. The get_impl_* functions seem to be the main interface
between *_storage and *_ptr. I'm starting to understand now.
>> [...]
>> 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.
>
> Dave
Euh, I think casts from shifted_ptr<T> will only work when applied to a
shared_ptr<T, shifted_storage> or something like that?
Philippe
P.S.: I'm working on it in my spare time, so please excuse me if I do not
reply fast enough.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk