Accessing members through pointers to structs (also, CTFE associative arrays)
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Dec 13 13:33:11 PST 2016
On 12/13/2016 12:30 PM, Ali wrote:
> foreach (i, room; rooms) {
> data[i].room = &room;
That is the address of the local variable room. You need to use 'ref' there:
foreach (i, ref room; rooms) {
> - Ali
Ali
"the real one :o)"
More information about the Digitalmars-d-learn
mailing list