title: Efficiently count number of entries between two std::multimap iterators
body: <p>I would like to count the number of entries between two iterators of an <code>std::multimap</code> in less than O(N) time. Are there any tricks or clever ways to do this?</p>
  
  <p>Since <code>std::multimap</code> has bidirectional iterators, my understanding is that something like <code>std::distance</code> could do this in O(N) time.</p>
  
  <p>Additional details: The <code>multimap</code>'s key is an N-tuple. I'm trying to find the number of entries in the <code>multimap</code> whose key's first element is 0. The options for the first element of they key are 0 and 1, and the <code>multimap</code> uses a strict weak ordering in which the first element of the key is always the most important. i.e., all elements with 0 come before any elements with 1.</p>
  
  <p>Context: The iterators are returned by <code>equal_range</code>, which runs in logarithmic time. Declaratively, I'd like to measure the length of the range.</p>
  
  <p>Thank you.</p>