How does one initialize an array defined as

A[B][C] arr;

dynamically? (A,B,C are types, for example, int[int][string])

I want to store an array, indexed by strings, of ints, indexed by ints.

For example, What I want is a hash map that maps integers to integers so I can do something like

myval = arr[3243];  // has O(1) lookup

But then I want to be able to extend this to use strings to subgroup the arrays:


myval1 = arr["Group1"][3243];  // has O(1) lookup
myval2 = arr["Group2"][3243];  // has O(1) lookup


so my arr definition is

int[int][string] arr;

Or, another way to see it, is I want the Key's to be strings and the values to be int[int].

But when I try to access the value of the value I get an exception, I believe, because I haven't initialized the value. (because if I do a simple assign to the value it then works, but I'm trying to check if the value exists in the first place)

I've also tried playing around with something like int[string[int]] and reversing the order(IIRC the order has to be backwards in the definition).

Reply via email to