vendredi 31 juillet 2015

Range based for loop with pointer to vector in C++11

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 vector values of vector<char>* how can I accomplish that?

Thank you in advance!

Aucun commentaire:

Enregistrer un commentaire