Accessing members through pointers to structs (also, CTFE associative arrays)
Ali via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Dec 13 13:36:16 PST 2016
On Tuesday, 13 December 2016 at 21:33:11 UTC, Ali Çehreli wrote:
> 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
Ahh true!! Cheers. Now about that second part of my problem ....
>
> Ali
> "the real one :o)"
Haha :)
More information about the Digitalmars-d-learn
mailing list