$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-02-16 13:57:18
Ulrich Eckhardt wrote:
> Greetings!
> Firstly, this is not a regression, the behaviour was present in 1.30, too.
> I have attached a simple program that should demonstrate the
> behaviour, but the core is these lines, with foo being derived from
> enable_shared_from_this:
>
> // 1
> std::auto_ptr<foo> g(new foo);
> boost::shared_ptr<foo> f(g);
> // 2
> std::auto_ptr<foo> g(new foo);
> boost::shared_ptr<foo const> f(g);
> // 3
> std::auto_ptr<foo const> g(new foo);
> boost::shared_ptr<foo const> f(g);
>
> In all three cases, I'd expect to be able to call shared_from_this().
> However, only the first two cases really work.
I've now modified the CVS version of shared_ptr to handle these cases. With
the modifications in place, your example now prints:
plain foo
failed
const failed
shared_ptr<foo>
works
const works
shared_ptr<foo const>
const works
shared_ptr<foo> from auto_ptr<foo>
works
const works
shared_ptr<foo const> from auto_ptr<foo>
const works
shared_ptr<foo const> from auto_ptr<foo const>
const works
Thank you for the suggestion. :-)