Opportunities for D
Sean Kelly via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jul 10 07:53:51 PDT 2014
On Wednesday, 9 July 2014 at 21:47:47 UTC, Andrei Alexandrescu
wrote:
> On 7/9/14, 1:51 PM, Walter Bright wrote:
>> On 7/9/2014 1:35 PM, Andrei Alexandrescu wrote:
>>> Hmmm... how about using u after that?
>>
>> Using u after that would either cause an exception to be
>> thrown, or
>> they'd get T.init as a value. I tend to favor the latter, but
>> of course
>> those decisions would have to be made as part of the design of
>> Unique.
>
> That semantics would reenact the auto_ptr disaster so probably
> wouldn't be a good choice. -- Andrei
The problem with auto_ptr is that people rarely used it for what
it was designed for. Probably because it was the only smart
pointer in the STL. As I'm sure you're aware, the purpose of
auto_ptr is to explicitly define ownership transfer of heap data.
For that it's pretty much perfect, and I use it extensively. It
looks like unique_ptr is pretty much the same, but with a
facelift. Underneath it still performs destructive copies,
unless I've misread the docs.
More information about the Digitalmars-d
mailing list