lundi 25 juillet 2016

Set of vectors ordered by vector size allowing same size

I have the following structure:

 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 now insert via

path.insert(vector<int>{g.id(v)});

He inserts of size 1 only 1, of size 2 only 1 etc.

I want him ordered by the size, but he should compare really the vectors to avoid duplicates.

Aucun commentaire:

Enregistrer un commentaire