D's equivalent to C++'s std::move?
Atila Neves via Digitalmars-d
digitalmars-d at puremagic.com
Thu Feb 11 06:29:43 PST 2016
On Thursday, 11 February 2016 at 00:32:11 UTC, Matt Elkins wrote:
> On Wednesday, 10 February 2016 at 20:42:29 UTC, w0rp wrote:
>> [...]
>
> Maybe this is what you are referring to, but the primary use I
> get out of move semantics (in general, not language-specific)
> has little to do with performance-on-copy. It is for handling
> resources which logically aren't copyable, which have a unique
> owner at all times and which should be cleaned up as soon as
> unique owner falls out of scope. This situation occurs a lot
> for me, and RAII plus move semantics are pretty close to ideal
> for handling it. Yes, it can be approximated with reference
> counting, but reference counting has its own downsides.
>
> [...]
@disable this(this) should be enough, no?
Atila
More information about the Digitalmars-d
mailing list