import std.algorithm; struct Bar { const int a; int b; }
void main() { Bar[1] arr; Bar bar = Bar(1, 2); bar[0].b = 4; move(bar, arr[0]); // ok arr[1] = bar; // fail, why?move(Bar(1, 2), arr[0]); // fail, why source parameter isn't auto ref?
}
Jack Applegame via Digitalmars-d-learn Wed, 06 Jan 2016 14:06:11 -0800
import std.algorithm; struct Bar { const int a; int b; }
void main() { Bar[1] arr; Bar bar = Bar(1, 2); bar[0].b = 4; move(bar, arr[0]); // ok arr[1] = bar; // fail, why?move(Bar(1, 2), arr[0]); // fail, why source parameter isn't auto ref?
}