I'd prefer to loop through a c++ map
in the same way as in this answer:
for (auto& kv : myMap) {
std::cout << kv.first << " has value " << kv.second << std::endl;
}
Using a range-based for such as this, is it possible to determine that kv
is the last element in the range? If so, how?