I guess this question is building on C++ convert vector<int> to vector<double>
I am trying to cast a two dimensional vector (stored in an object) of type int into a two dimensional vector of type double. According to the SO link I have provided,
std::vector<int> intvec;
std::vector<double> doubvec(intvec.begin(),intvec.end());
should typecast the original vector (it does).
So why doesn't the following code work?
std::vector<std::vector<double>> rotmat(Mesh.matrix.begin(),Mesh.matrix.end());
I can do the line below just fine, so I know there isn't anything else wrong. What am I missing?
std::vector<double> dubvec(Mesh.matrix[0].begin(), Mesh.matrix[0].end());
Mesh is defined by :
class MeshOut
{
public:
MeshOut();
MeshOut(vector < vector < int >>, vector < vector < int >>, int, int, double, int, bool);
vector<vector<int>> matrix;
vector<vector<int>> lv_mat;
int shortNum;
int SourceNum;
double smallestMeshSize;
int factor;
bool Fine;
....
I call Meshout Mesh(x,y,z,i,j,k,l); in the code.