I have a foreach loop that goes though a std::set
that looks like
for (auto& line : lines){
//use line
bool end = /* Check if line is the last element */
}
With a std::vector
I could check &line == &lines.back();
Is there a way I can do something similar for a std::set
?
zneak has some pretty good ideas, but here's one involving iterators in the loop: