On Sunday, 22 December 2013 at 13:19:48 UTC, Benjamin Thaut wrote:
When working with C-libraries in D I often wish for a
equivalent of the C++11 unique_ptr. Unfortunately this is not
possible in D. Consider the following source code:
http://dpaste.dzfl.pl/6e71c815
Is error 1 a bug? Because there should cleary not be any copy
at this point.
Should we implement moving of u so that error 2 goes away? The
compiler could move u into the function and move back out
afterwards, but that would mean that the contents of u would be
invalid for the duration of the function call (unsafe?)
Kind Regards
Benjamin Thaut
Is std.typecons.Unique[1] not the equivalent of unique_ptr?
[1]: http://dlang.org/phobos/std_typecons.html#.Unique
Regards,
Kelet