On Wed, Mar 27, 2013 at 07:41:42PM +0100, John Colvin wrote: > On Wednesday, 27 March 2013 at 18:06:46 UTC, Vidar Wahlberg wrote: > >I'm impressed and most grateful for the feedback, I've learned > >some new things today :) > > > >>int i = 5; > >>auto foo = new int[][](i,i); > > > >Won't this create an array (with 5 elements) of arrays (with 5 > >elements), also called a "jagged array"? Where memory is not > >necessarily continuously allocated and looking up values adds > >another layer of indirection? > > > > Unfortunately yes. > > However, it's not a hard problem to overcome with a wrapper struct > over a contiguous array.
Which is what Denis' multidimensional array implementation does. As does my implementation as well. This seems to be quite a common use-case; we should put this into Phobos IMO. T -- People tell me that I'm skeptical, but I don't believe it.