|
Boost : |
From: David B. Held (dheld_at_[hidden])
Date: 2002-10-09 04:19:46
"Daniel Frey" <daniel.frey_at_[hidden]> wrote in message
news:3DA3EE01.2F19EED0_at_aixigo.de...
> > [...]
> > operator const ptr< const T >&() const
> > {
> > [Bad ugly reinterpret_cast-version snipped]
> > [Insert your favorite static_cast-version here :)]
> > }
> >
> I'm interested to hear whether this solves the original problem. If it
> doesn't, please let me know, as this would mean that my own
> pointer-classes might have an unsolved problem, too. :)
This doesn't really do much for me. shared_ptr<> already has
implicit conversion to shared_ptr<T const>, and the static_cast<>
version can't avoid the creation of temporaries, so you may as well
pay for the copy. And you still have to explicitly declare ptr<T const>
in the function declaration. So I don't see any benefit over
shared_ptr<> here.
Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk