两个键之间的键数

时间:2012-11-04 04:50:44

标签: c++ stl map

如何在地图中找到两个键值之间出现的键数?有没有办法用迭代器来完成这个?

1 个答案:

答案 0 :(得分:1)

看看地图和一些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.