On Sunday, 21 August 2016 at 23:57:27 UTC, brian wrote:

On Sunday, 21 August 2016 at 23:37:38 UTC, Adam D. Ruppe wrote:
testStruct[int] testStructArray;
That's not actually an array per se, that is a key/value map where the keys are ints.
I understand it's a map, but does my syntax not define an Associative Array?? https://dlang.org/spec/hash-map.html That's kinda what I wanted because I want to be able to look up the Structs by the value of int.

Terminology wise, we distinguish between associative arrays (AA) and arrays. The former should never simply be called 'array', otherwise people will assume you are referring to either or both of foo[] (dynamic array/slice) or foo[N] (where N is an integer constant, a static array). Change your title to 'Creating an AA of user-defined structs' and the misunderstanding goes away.

Reply via email to