Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2002-08-21 05:13:54


"Larry Evans" <jcampbell3_at_[hidden]> wrote:

[...]

> But surely the smart pointer conversions should mirror the
> dumb pointer conversions, and clearly, as the test shows,
> this is not the case. Unless you're referring to my latest
> code which gets the correct values but also prints
> the ambiguous message. So which are you saying is correct,
> you're latest ptr.hpp which doesn't mirror dumb pointer
> conversion, or mine which does but gives the ambiguous
> message?

Thanks for pointing this one out; I was blinded with the main constructor (U
*). I've uploaded a new version of ptr.hpp and your inherit2.cpp outputs:

Btm typeid=0
Mid<left> typeid=1
Mid<right> typeid=2
Top typeid=3
inherit2_test for ptr
dpB->b=10
dpB->Mid<left>::m=7
dpB->Mid<left>::t=6
dpB->Mid<right>::m=9
dpB->Mid<right>::t=8
going up left branch:
Mid<left>::m=7
:spT->t=6
going up right branch:
Mid<right>::m=9
:spT->t=8

Philippe A. Bouchard

PS: Do not declare ptr_base<Top, __false_type>::s_id as const because it
will become a compile-time constant and complex expressions initializing it
will be silently discarded (looks like a flaw in the standards; I have to
investigate).


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk