Difficulty copying multi dimensional static array to dynamic array.
Spacen Jasset
spacen at yahoo.co.uk
Sun Feb 24 15:17:55 PST 2008
I have more than one problem in this class (errors below), but my focus
it to return a dynamic array of float[4][4] which is copied from a
static array of float[4][4]. I am having trouble finding how to do this.
class Matrix
{
float[][] toFloatArray4x4()
{
float f[4][4] = matrix.dup;
return f;
}
void toFloatArray16(float flat[16])
{
flat[]=matrix_flat[];
}
private:
union
{
float matrix[4][4];
float matrix_flat[16];
}
}
matrix.d(74): Error: cannot implicitly convert expression
(_adDupT(&_D14TypeInfo_G4G4f6__initZ,cast(float[4u][])(this.matrix))) of
type float[4u][] to float[]
matrix.d(75): Error: cannot implicitly convert expression (f) of type
float[4u][4u] to float[][]
matrix.d(75): Error: escaping reference to local f
More information about the Digitalmars-d-learn
mailing list