Pregunta

How would I find the number of keys occurring between two key values in a map ? Is there any way to accomplish this using iterators?

¿Fue útil?

Solución

Have a look at map and some STL algirhtims:

http://www.cplusplus.com/reference/stl/map/
    lower_bound Return iterator to lower bound (public member function)
    upper_bound Return iterator to upper bound (public member function) 
    distance Calculates the number of elements between first and last.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top