How can i directly find the number of elements between any two iterator pointing to two different key in map without the for loop?
<p>How can i directly find the number of elements between any two iterator pointing to two different key in map without the for loop?</p>

<pre><code>     #include &lt;string&gt;
     #include &lt;iostream&gt;
     #include &lt;map&gt;
     #include &lt;utility&gt;
     #include &lt;iterator&gt;
     #include &lt;stdio.h&gt;
     using namespace std;
     int main()
   {

     std::map&lt;string, string&gt; m;
     m.insert(pair&lt; string, string&gt;("4-2"," 61-7" ));
     m.insert(pair&lt; string, string&gt;("5-2"," 61-7" ));
     m.insert(pair&lt; string, string&gt;("5-3"," 61-7" ));
     m.insert(pair&lt; string, string&gt;("5-4"," 61-7" ));
     m.insert(pair&lt; string, string&gt;("5-5"," 61-7" ));
     m.insert(pair&lt; string, string&gt;("5-6"," 61-7" ));

     map&lt;string, string&gt;::iterator it4;
     map&lt;string, string&gt;::iterator it5;
     it4=m.find("5-2");
     it5=m.find("5-5");
     cout &lt;&lt; " value of it4" &lt;&lt; it4-&gt;first &lt;&lt; it4-&gt;second &lt;&lt;  endl;
     cout &lt;&lt; " value of it5" &lt;&lt; it5-&gt;first &lt;&lt; it5-&gt;second &lt;&lt;  endl;
     m.clear();
     getchar();

  }
</code></pre>

<p>My desired output is difference of elements betwen it5 and it4 which here is 2 as elements with key "5-3" and "5-4" lies between them . I dont want to iterate in for loop as in my case number of elements in map are large enough . And I have to regularly know the difference . using a for loop will take lot of time if two iterator are far away .</p>
