Hey, first post.
I'm really more of a java-programmer but I'm starting out learning c++ more seriously now.
Was coding away and got stuck bad. I have built a vector class,
works the same way more or less like std vector. Anyway
I want to use it to build a 2d matrix.
The idea I had and tried out was like this:
in matrix.h (bit pseudo)
m = new vector<int>(rows)[columns];Code:class Matrix { private: int m, n; vector<int> *m; public: matrix(int columns, int rows); } in matrix.cc matrix(int columns, int rows) { m = new vector<int>(rows)[columns]; }
this does not work..
I tried out with instead of having a vector<int> *m to have
vector<vector<int> > *m, and initialise in matrix.cc with
m = new vector<vector<int>(columns) >(rows)
but this did not work either.
I want the matrix dynamically stored
thanks,