Rectangular Arrays

Another Roadside Attraction me at me.com
Thu Feb 22 23:14:11 PST 2007


Thanks, Bill!!

I hadn't seen the array initialization syntax with the parenthetized arguments. It's kind of odd-looking. Do know know anything about its etymology? Since arrays already have bracketized declaration syntax, the parenthetized syntax seems like an unnecessary kludge.

Anyhow, the parenthetized syntax doesn't seem to be anywhere on the digital mars website or in any of the dsource tutorials.

http://digitalmars.com/d/arrays.html
http://www.dsource.org/projects/tutorials/wiki/ArraysCategory

Unfortunately, your multi-array library won't work for me, since it relies on templates. I won't know the size of the grid until runtime, so templates are a no-go.

But the ragged arrays should be fine for now.

Thanks again,

--ARA


Bill Baxter Wrote:

> D doesn't have rectangular arrays at the moment.  But you can init a 
> multi-dim ragged array.
> 
> http://www.digitalmars.com/d/expression.html#NewExpression
> 
> int[][][] bar = new int[][][](5,20,30);
> or
> auto bar = new int[][][](5,20,30);
> 
> I have some nd rectangular array at 
> http://www.dsource.org/projects/multiarray
> but it sounds like for your purposes the ragged array will be sufficient.
> 
> --bb



More information about the Digitalmars-d-learn mailing list