Consider the following example:
vector<vector<char>*> *outer = new vector<vector<char>*>(); { vector<char> *inner = new vector<char>(); inner->push_back(0); inner->push_back(1); inner->push_back(2); outer->push_back(inner); inner->push_back(3); } auto x = outer->at(0); for (auto c : x) { cout << c << ","; } I would like to iterate through the values of the vector<char>*; how can I accomplish that?
unique_ptrrather than owning raw pointers. Better yet, get rid of the unnecessarynews altogether.unique_ptr...newin the first place.