associative array with element type struct ?

Paul phshaffer at gmail.com
Thu Sep 23 22:06:23 UTC 2021


Can I have an associative array with the element type being a 
struct?
..this
26  // simple dual tone key struct
27  struct keytones { ushort rowFreq; ushort colFreq; }
28
29  // keypad associative array
30  keytones[string] keypad;
31  keypad["1"].rowFreq = 697; keypad["1"].colFreq = 1209;

...gets this response from DMD compiler

aaa.d(30): Error: undefined identifier `keypad`
aaa.d(30): Error: declaration `aaa.main.keytones` is already 
defined
aaa.d(27):        `struct` `keytones` is defined here

thanks for any assistance!


More information about the Digitalmars-d-learn mailing list