I\'m trying to figure out the best way to determine whether I\'m in the last iteration of a loop over a map in order to do something like the following:
for
A simple, yet effective, approach:
size_t items_remaining = someMap.size(); for (iter = someMap.begin(); iter != someMap.end(); iter++) { bool last_iteration = items_remaining-- == 1; }