Fixed size multidimensional array at runtime

Jonathan M Davis jmdavisProg at gmx.com
Sat Jun 30 12:35:50 PDT 2012


On Saturday, June 30, 2012 21:27:15 Vidar Wahlberg wrote:
> On Saturday, 30 June 2012 at 19:06:31 UTC, Jonathan M Davis wrote:
> > On Saturday, June 30, 2012 21:01:02 Vidar Wahlberg wrote:
> >> This is a very good suggestion, I hadn't thought of this
> >> possibility, this way I can get my beloved "matrix[x][y];"
> >> instead of something like "matrix.get(x, y);".
> > 
> > It might have to be matrix[x, y] though, since while you can
> > make opIndex take
> > as many arguments as you want, I don't believe that it will let
> > you split them
> > out into multiple indexing operations like in matrix[x][y].
> 
> Doh, you are of course correct. That's slightly unfortunate, then
> I'm actually leaning a bit more towards creating a "get(x, y)"
> method as a "[x, y]" construct would be a bit unusual (at least
> for me, for the time being).

I think that there are languages which actually use [x, y] for rectangular 
arrays, but I haven't used one that does that either.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list