Flat multi-dim arrays.
Oskar Linde
olREM at OVEnada.kth.se
Thu Aug 10 16:14:11 PDT 2006
Mikola Lysenko wrote:
>
> 5. How do slices work?
>
> You can't just slice a random chunk from the middle of an array in place
> like a regular array, since the layout will be incorrect.
Yes you can. This is exactly what strides are for.
For each dimension, you keep a stride as well as a length. Walking up the
dimension moves a stride of units of memory. This even allows things like
transposing a large matrix without moving a single byte.
/Oskar
More information about the Digitalmars-d
mailing list