Navigating maps using iterators in c++
<p>I've been having an issue using the map iterator, which I'm hoping someone here can resolve for me.</p>

<p>Basically, I need to return the last 10 keys in a map that I have, so I tried this:</p>

<pre><code>for (map&lt;int, char&gt;::iterator i = (singleCountSwitched.end()); i != (singleCountSwitched.end()-10); --i) {
                cout &lt;&lt; (*i).first &lt;&lt; ": " &lt;&lt; (*i).second &lt;&lt; endl;
            }
</code></pre>

<p>However it is giving me the following error:</p>

<pre><code>main.cpp:150:112: error: no match for ‘operator-’ in ‘singleCountSwitched.std::map&lt;_Key, _Tp, _Compare, _Alloc&gt;::end&lt;int, char, std::less&lt;int&gt;, std::allocator&lt;std::pair&lt;const int, char&gt; &gt; &gt;() - 10’
</code></pre>

<p>which seems to say that there is no support for the - operator (a similar message was thrown when using map.begin()+10). Am I using the iterator incorrectly? I thought the iterators for STL containers were supposed to all have overloaded +'s and -'s.</p>
