Efficiently count number of entries between two std::multimap iterators
I would like to count the number of entries between two iterators of an std::multimap in less than O(N) time. Are there any tricks or clever ways to do this? Since std::multimap has bidirectional iterators, my understanding is that something like std::distance could do this in O(N) time. Additional details: The multimap 's key is an N-tuple. I'm trying to find the number of entries in the multimap whose key's first element is 0. The options for the first element of they key are 0 and 1, and the multimap uses a strict weak ordering in which the first element of the key is always the most