I have the following code:
set< vector<int> > set_of_things;
vector<int> triplet(3);
//set_of_things.push_back(stuff) - adding a number of things to the set
How do I now iterate through the set and print all elements?
The set is a collection of triplets so the output should look like:
1 2 3
3 4 5
4 5 6
You use iterators:
In C++11 you can use
autoinstead ofstd::set<vector<int> >::iterator.If you’re not modifying the iterator, you should use a
const_iteratorinstead.