Creating an array of user-defined structs

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 21 17:03:52 PDT 2016


On Sunday, 21 August 2016 at 23:57:27 UTC, brian wrote:
> I understand it's a map, but does my syntax not define an 
> Associative Array??

yeah, it is. If that's what you want, good!

> So I wanted something dynamic.

OK, then you should use pointers so you can have several 
references to the same object in different maps (so you can have 
one for ID, one for name, etc.).

Just make it

testStruct*[int] testStructArray;

and then try compiling the rest basically as it is, newing the 
struct, it should work.


More information about the Digitalmars-d-learn mailing list