Declaring rvalue function arguments
Matt Elkins via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jan 31 10:00:44 PST 2016
On Sunday, 31 January 2016 at 17:55:53 UTC, Matt Elkins wrote:
> Errr, ignore the makeFoo() line. Left that in by accident, has
> no bearing on the issue.
Ok, I think I understand why this doesn't work, at least. The Foo
passed into bar() is, of course, an lvalue itself.
So I can achieve this with a new bar(), like so:
[code]
void bar(Foo foo)
{
import std.algorithm.mutation;
Foo foo1 = move(foo);
}
[/code]
More information about the Digitalmars-d-learn
mailing list