|
Boost : |
From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2002-08-21 15:00:03
"Larry Evans" <jcampbell3_at_[hidden]> wrote:
> Larry Evans wrote:
[...]
> > SmartPtr<Mid<left> > spOM( spB );
> > SmartPtr<Top> spOT( spOM );
> > just before:
> > cout<<":spT->t="<<spT->t<<endl;
> > in print_t<right>. You should see the wrong value for spT->t. It will
> > give the value for the left branch. This is because the value for:
> >
> > ptr_base<Top,...>::s_offset[a_p.get_typeid()]
[...]
> OOPS. It is reset by spOT(spOM), not spOM(spB).
Check mate.
I see no other alternative but to have:
sizeof(ptr_base<T, __true_type>) = sizeof(T *);
sizeof(ptr_base<T, __false_type>) = sizeof(ptr_header *) + sizeof(T *);
thru placement operator new (size_t, rc_type const &).
Philippe A. Bouchard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk