mercredi 6 juillet 2016

Avoid iterators from sets and vectors


I have the following set:

        auto comp = [](const vector<int>& a, const vector<int>& b) -> bool
    { return a.size() < b.size(); };
    auto path = std::set <vector<int>, decltype(comp)> (comp);

When I try to get the first element from the set tasks

tasks.begin() this will return an iterator of the set

Also when I then again try to access the vector of the set:

tasks.begin()->begin() this will only return an iterator of the vector.

How do I get the first element of the set without any iterator in between?


Aucun commentaire:

Enregistrer un commentaire