Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-06-12 10:49:05


From: "Markus Schöpflin" <markus.schoepflin_at_[hidden]>
> Hello there,
>
> pardon me in advance if this is a FAQ but why is there no
> costructor for scoped_ptr that takes a smart_ptr as an
> argument?

I don't know. :-)

> Assuming, you have a funktion
>
> std::auto_ptr<Obj> create_obj();
>
> this would allow you to write
>
> std::scoped_ptr<Obj> p(create_obj());

No, unfortunately it will not. The constructor will take a non-const
reference to auto_ptr, and those cannot be bound to rvalues. std::auto_ptr
uses an interesting (and obscure) technique to allow

std::auto_ptr<Obj> p(create_obj());

and I'm not sure that we need to enable this functionality for scoped_ptr.


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