Any way to move in @disabled this(this) type in to a wrapping template?

Paul Backus snarwin at gmail.com
Thu Jul 25 22:31:24 UTC 2019


On Thursday, 25 July 2019 at 21:58:06 UTC, aliak wrote:
> Haha. Ironic. Thanks, again :)
>
> Though, if you use auto ref, and you check if it's mutable and 
> not copyable and then move, then that means you could 
> potentially be applying move to an object on behalf of the 
> clients
>
> auto a = MyUnmovableType()
> auto b = LibraryType(a);
> writeln(a); // ??
>
> If this is a problem, I guess a __traits(isRef, parameter) 
> check along with mutable and copyable could help. Then if 
> client want it moved they could call move explicitly.

Yeah, that's why you use core.lifetime.forward instead of 
directly calling move--it checks all of this stuff for you.


More information about the Digitalmars-d-learn mailing list