Re: [patch] std::unique_ptr improvements

2013-01-03 Thread Lawrence Crowl
On 1/1/13, Geoffrey Romer wrote: > AFAICT there's no way to distinguish between safe and unsafe > conversions of user-defined pointers, because that's a property > of the pointer implementation, not the type itself. My PR errs on > the side of trusting the implementation to provide only correct >

Re: [patch] std::unique_ptr improvements

2013-01-01 Thread Lawrence Crowl
On 1/1/13, Jonathan Wakely wrote: > On 1 January 2013 20:40, Lawrence Crowl wrote: >> That was pilot error on my part. However, I've been having trouble >> when the argument to the constructor or reset has a conversion >> operator. The code does distinquish between a safe conversion to >> base a

Re: [patch] std::unique_ptr improvements

2013-01-01 Thread Jonathan Wakely
On 1 January 2013 20:40, Lawrence Crowl wrote: > > That was pilot error on my part. However, I've been having trouble > when the argument to the constructor or reset has a conversion > operator. The code does distinquish between a safe conversion to > base and an unsafe conversion to derived. > >

Re: [patch] std::unique_ptr improvements

2013-01-01 Thread Lawrence Crowl
On 12/28/12, Jonathan Wakely wrote: > On 28 December 2012 01:51, Lawrence Crowl wrote: >> I'm not getting errors when converting from derived to base. >> E.g. the following compiles, when it should not. >> >> std::unique_ptr acb_ad(new derived[3]); > > I get an error: > > shm$ cat up.cc > #include

Re: [patch] std::unique_ptr improvements

2012-12-28 Thread Jonathan Wakely
On 28 December 2012 01:51, Lawrence Crowl wrote: > > I'm not getting errors when converting from derived to base. > E.g. the following compiles, when it should not. > > std::unique_ptr acb_ad(new derived[3]); I get an error: shm$ cat up.cc #include struct base { }; struct derived : base { virtua

Re: [patch] std::unique_ptr improvements

2012-12-27 Thread Lawrence Crowl
On 12/20/12, Jonathan Wakely wrote: > This patch started when I noticed that it's not possibly to construct > a shared_ptr from unique_ptr, then I discovered we don't > use D::pointer if it exists, and there were a number of other > non-conformance issues with our std::unique_ptr. I ended up > fi

[patch] std::unique_ptr improvements

2012-12-20 Thread Jonathan Wakely
This patch started when I noticed that it's not possibly to construct a shared_ptr from unique_ptr, then I discovered we don't use D::pointer if it exists, and there were a number of other non-conformance issues with our std::unique_ptr. I ended up fixing them by implementing Geoffrey's proposed r