I learnt here about a month ago that plain arrays are the best when making a matrix class(as opposed to linked lists ..etc...as I had a whim to do !!).
Which one of the following would be a better idea when I'd have to make the matrices do almost all sorts of operations and transformations..within my knowledge..?
ORCode:template<class X,int R,int C> //Type,No of Rows and Columns class matrix { public: typedef std::array<X,C> row_a; //Size of a row == no. of cols std::array<row_a,R> dat; };
If the former is better ....what is the way to access the individual X objects ..with iterators...?Code:template<class X,int R,int C> //Type,No of Rows and Coloumns class matrix { public: std::array<X,(R*C)> dat; };



LinkBack URL
About LinkBacks



