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..?
Code:
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;
};
OR
Code:
template<class X,int R,int C> //Type,No of Rows and Coloumns
class matrix
{
public:
std::array<X,(R*C)> dat;
};
If the former is better ....what is the way to access the individual X objects ..with iterators...?