I have encountered problem in copying the element of nested std::vector to another std::vector.
Example 1
std::vector<std::vector<int>> foo;
std::vector<int> temp;
std::vector<int> goo;
foo[0].push_back(12345);
goo = foo[0]; //error
Example 2
for(int i = 0; i<foo[0].size(); i++) {temp.push_back(foo[0][i])};
goo = temp; //error
Thus, can i know where is the problem and what should i do to copy the element of a nested vector to another vector??
Aucun commentaire:
Enregistrer un commentaire