|
Boost : |
From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2002-06-17 03:59:54
Peter Dimov wrote:
>
> 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
-------------------------------------------^^^^^^^^^
Just spotted this, it should of course read auto_ptr!
> > 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.
>
Hmm, I did some further thinking on this and I simply can't see the
difference between the current shared_ptr, which offers a conversion from
auto_ptr and my suggestion for scoped_ptr.
Could you enlighten me, Peter? Or anybody else?
TIA, Markus
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk