What is the return value of map::begin() for an empty map?
c++, dictionary, stl
Solution
If the map is empty, the `begin` and `end` iterators are equal, i.e. returns `mymap->end()`.
Problem
I use something like this: ``` map<string, Data>::iterator it = mymap->begin(); map<string, Data>::iterator end = mymap->end(); while (it != end) { // do stuff ++it; } ``` I was just wondering if this would work even if the map is empty. I couldn't find any information about the return of map::begin() if the map ist empty.