Boost logo

Boost :

From: Schoenborn, Oliver (Oliver.Schoenborn_at_[hidden])
Date: 2002-06-14 07:52:16


> From: "Markus Schöpflin" <markus.schoepflin_at_[hidden]>
> > Peter Dimov wrote:
> > >
> > > From: "Markus Schöpflin" <markus.schoepflin_at_[hidden]>
> >
> > [snip]
> >
> > > > 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
> > >
> >
> > Hmm, I just hacked my copy of scoped_ptr.hpp and added
> >
> > explicit scoped_ptr(std::auto_ptr<T> &p): ptr(p.release()) {}
> >
> > and it works as expected, taking away ownership from
> auto_ptr and giving
> > it to scoped_ptr.
> >
> > Is this something my compiler (MSVC6SP5) allows as an extenstion?
>
> Yes, this is a Microsoft extension. VC 7 doesn't even warn. Odd.

Strange because this also works with g++ 3.04.
Oliver


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