using map erase - Deleting from a map which contains pointer to another map
<p>when i try to remove an element: i go to secondMap which contains in second field a pointer to the first map, now when i try to erase it it gives me problems:</p>

<pre><code>multimap&lt;SortKey,T&gt; firstMap;
multimap&lt;SearchKey,pair&lt;const SortKey,T&gt;*&gt; secondMap;



   template &lt;class T,class SortKey, class SearchKey&gt; T GarageDataBase&lt;T,SortKey,SearchKey&gt;::Remove(SearchKey toRemove) 
{
 multimap&lt;SearchKey,pair&lt;const SortKey,T&gt;*&gt;::iterator it;
 it=secondMap.find(toRemove);
 multimap&lt;SortKey,T&gt;::const_iterator itr;
 itr=(it-&gt;second);//pointer to a pair in the first map
 firstMap.erase(itr);

}
</code></pre>

<p>i get:</p>

<pre><code>error C2664: 'std::_Tree_iterator&lt;_Mytree&gt; std::_Tree&lt;_Traits&gt;::erase(std::_Tree_const_iterator&lt;_Mytree&gt;)' : cannot convert parameter 1 from 'std::_Tree_const_iterator&lt;_Mytree&gt;' to 'std::_Tree_const_iterator&lt;_Mytree&gt;'

error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const std::pair&lt;_Ty1,_Ty2&gt;' (or there is no acceptable conversion) 
</code></pre>

<p>any idea?</p>
