Associative Array Question
Adam D. Ruppe
destructionator at gmail.com
Fri Jan 1 01:54:01 UTC 2021
On Friday, 1 January 2021 at 01:43:50 UTC, Chris Bare wrote:
> a1[10] = "testing a1";
this actually constructs a new thing since it is a straight x = y
assignment.
> a2[10].name = "testing a2";
But this looks up something first. It doesn't construct a2[10],
it looks it up first to fetch the name member... hence the range
violation since it isn't constructed yet.
> a3[10] = new Project;
and this again will construct since it is a straight x = y again.
So you could also do
a2[10] = Person()
then do the lookup of name
More information about the Digitalmars-d-learn
mailing list