Template
Jarrett Billingsley
kb3ctd2 at yahoo.com
Fri Jun 6 06:38:45 PDT 2008
"Mael" <mael.primet at gmail.com> wrote in message
news:g2bbpi$10n4$1 at digitalmars.com...
> Hello,
>
> another question,
>
> I wanted to generate an image having an arbitrary dimension (each pixel is
> a n-tuple).
>
> The option
>
> class Image(vType, int vDim)
> {
> ...
> vType[vDim][] data ;
> }
>
> isn't really good, because the array isn't "unfolded" resulting in some
> overhead (or is there a way to build a vType[dim][n] array that would be
> represented as a vType[n*dim] array, and the compiler would optimize
> arr[p][k] in arr[p*dim+k] ?)
If you declare a two-dimensional (not sure about more dimensions..)
fixed-size array of fixed-size arrays, like "int[4][4]", it will be treated
as a rectangular array and not as an array of arrays. They are mentioned
here: (http://www.digitalmars.com/d/1.0/arrays.html) in the "Rectangular
Arrays" section.
:)
More information about the Digitalmars-d-learn
mailing list