Re: Associative array of dynamic array

2012-09-09 Thread bearophile
Philippe Sigaud: Keep in mind all these structures (AA and dynamic arrays) are reference types. There are bug-prone things you have to keep in mind. Not exactly a reference type, this is by D specs: import std.stdio; import std.array: popFront; void main() { auto d = [1:[2, 3]]; a

Re: Associative array of dynamic array

2012-09-09 Thread Philippe Sigaud
On Sun, Sep 9, 2012 at 2:48 PM, Samuele Carcagno wrote: > thanks a lot! both solutions work, to initialize the arrays of int I'm > doing: > > int[][][string] foo; > foo["key"] = new int[][](6,6); > foo["key"][0][0] = 5; > > it seems to work. Great! Keep in mind all these structures (AA and dynam

Re: Associative array of dynamic array

2012-09-09 Thread Samuele Carcagno
thanks a lot! both solutions work, to initialize the arrays of int I'm doing: int[][][string] foo; foo["key"] = new int[][](6,6); foo["key"][0][0] = 5; it seems to work.

Re: Associative array of dynamic array

2012-09-09 Thread monarch_dodra
On Sunday, 9 September 2012 at 12:17:47 UTC, Samuele Carcagno wrote: I would like to create an associative array that maps a string to a multidimensional dynamic array. In other words, I would like a data structure where I can access elements like this: foo["key"][0][0] Is this possible? If s

Re: Associative array of dynamic array

2012-09-09 Thread Philippe Sigaud
On Sun, Sep 9, 2012 at 2:18 PM, Samuele Carcagno wrote: > I would like to create an associative array that maps a string to a > multidimensional dynamic array. In other words, I would like a data > structure where I can access elements like this: > > foo["key"][0][0] The type you want is int[][][

Associative array of dynamic array

2012-09-09 Thread Samuele Carcagno
I would like to create an associative array that maps a string to a multidimensional dynamic array. In other words, I would like a data structure where I can access elements like this: foo["key"][0][0] Is this possible? If so I'm having trouble figuring out the correct syntax, the following (