两个键之间的键数

Number of keys between two keys

本文关键字:之间 两个      更新时间:2023-10-16

我如何找到地图中两个键值之间发生的键数?有什么方法可以使用迭代器来完成此操作?

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