Fixed size multidimensional array at runtime

Denis Shelomovskij verylonglogin.reg at gmail.com
Sun Jul 1 02:46:43 PDT 2012


01.07.2012 0:06, Vidar Wahlberg пишет:
> On Saturday, 30 June 2012 at 19:35:33 UTC, Denis Shelomovskij wrote:
> Thanks for the tip, that is interesting (I'm surprised I didn't come
> across this post when searching for this issue earlier). Although it
> seems to me that you still end up with "matrix[x, y, z]" instead of
> "matrix[x][y][z]", so it will only solve one half of the problem :)

I'm curious why do you need such syntax? `matrix[x][y][z]` expression 
means that `matrix[x]` is also a valid expression but it shouldn't.

Slicing can be done using something like my implementation: `matrix[x, 
R[], R[]][y, R[]][z]` where `matrix[x, R[], R[]]` is obviously a valid 
slice.

So I deliberately disallow rule
  "`matrix[x]` means `matrix[x, R[]...]`"
and made `byTopDimension` property for such iteration:
`matrix.byTopDimension[x].byTopDimension[y].byTopDimension[z]`

See:
http://deoma-cmd.ru/d/docs/src/my/rarray.html#byTopDimension

-- 
Денис В. Шеломовский
Denis V. Shelomovskij




More information about the Digitalmars-d-learn mailing list