generate unique variable names?
K.K. via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Oct 7 18:16:49 PDT 2014
Is there a way to generate variable names using strings? What I'm
trying to do in this particular case is use a for loop, to
generate variables (then probably put them in an array in the
end) that represent images. So the name is pretty much "image" +
the image padding + iterator number. So image001, image002, etc.
So visually (though not real syntax):
auto "imageName" ~ "imagePadding" ~ i = new
Imagefromfile(userDefinedLocation);
The problem is I can't figure out how to actually create the
unique variable. I was thinking of trying to use 'new' some how,
but still not sure.
Thanks in advance for any help!
More information about the Digitalmars-d-learn
mailing list