R
Rui Maciel
The typical way to get the biggest key of a std::map is to rely on the
default sorting for std::map (based on std::less) and simply check the key
of the last element of a map, as:
<code>
std::map<key,value> my_map;
//...
key largest_key = my_map.rbegin()->first
<code>
Yet, this trick is a bit flimsy and isn't very elegant. Does anyone know if
there is a better way to extract the biggest key of a std::map?
Thanks in advance,
Rui Maciel
default sorting for std::map (based on std::less) and simply check the key
of the last element of a map, as:
<code>
std::map<key,value> my_map;
//...
key largest_key = my_map.rbegin()->first
<code>
Yet, this trick is a bit flimsy and isn't very elegant. Does anyone know if
there is a better way to extract the biggest key of a std::map?
Thanks in advance,
Rui Maciel