Archived

This topic is now archived and is closed to further replies.

Constructor with multi demensional array not compiling

This topic is 5654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Heres my constructor for a matrix with all elements being defined:
  
	CMatrix(scalar_t aRow0Col0, scalar_t aRow0Col1, scalar_t aRow0Col2, scalar_t aRow0Col3,
			scalar_t aRow1Col0, scalar_t aRow1Col1, scalar_t aRow1Col2, scalar_t aRow1Col3,
			scalar_t aRow2Col0, scalar_t aRow2Col1, scalar_t aRow2Col2, scalar_t aRow2Col3,
			scalar_t aRow3Col0, scalar_t aRow3Col1, scalar_t aRow3Col2, scalar_t aRow3Col3):
			mat[0][0](aRow0Col0), mat[0][1](aRow0Col1), mat[0][2](aRow0Col2), mat[0][3](aRow0Col3),
			mat[1][0](aRow1Col0), mat[1][1](aRow1Col1), mat[1][2](aRow1Col2), mat[1][3](aRow1Col3),
			mat[2][0](aRow2Col0), mat[2][1](aRow2Col1), mat[2][2](aRow2Col2), mat[2][3](aRow2Col3),
			mat[3][0](aRow3Col0), mat[3][1](aRow3Col1), mat[3][2](aRow3Col2), mat[3][3](aRow2Col3) {};  
Im gettin a syntax error on "[". Anyone know why? Thanks. Well, that was a waste of 2 minutes of my life. Now I have to code faster to get ''em back...

Share this post


Link to post
Share on other sites
You cannot initialise array elements within a ctor initialisation list. You will have to assign to the elements within the body of the ctor or a helper function.

[edited by - SabreMan on June 25, 2002 5:09:36 AM]

Share this post


Link to post
Share on other sites