Filling an associated array of associated arrays

Jamie notme at gmail.com
Tue Jan 14 23:23:51 UTC 2020


I'm trying to initialise an associated array of associated arrays 
with values, taking the same approach I would for an associated 
array:

string[string][string] table = [
     "info" : [
         "equation" : "H2 + I2 <=> 2HI",
         "type" : "elementary",
         ],
     "frc" : [
         "A" : "1.2e9",
         "n" : "1.2e9",
         "C" : "1.2e9",
         ],
     ];

But I'm getting the error `Not an associative array initializer'.
Is there a way to do this in the fashion that I'm trying?

I can declare it like

string[string][string] table;
table["info"]["equation"] = "H2 + I2 <=> 2HI";
table["info"]["type"] = "elementary";

But don't see why the first way wouldn't work.



More information about the Digitalmars-d-learn mailing list