This is straight-forward with the new range-based for
loops that were introduced in C++11:
for (auto const & v : set_of_things)
{
for (auto it = v.cbegin(), e = v.cend(); it != e; ++it)
{
if (it != v.cbegin()) std::cout << " ";
std::cout << *it;
}
std::cout << "\n";
}
If you don't mind a trailing space:
for (auto const & v : set_of_things)
{
for (auto const & x : v)
{
std::cout << *it << " ";
}
std::cout << "\n";
}
Or use the pretty printer:
#include <prettyprint.hpp>
#include <iostream>
std::cout << set_of_things << std::endl;
If you have an older compiler, you will have to spell both iterations out in terms of iterators.