title: Map with in a map: How to clear inner map using iterators?
body: <p>I have an STL map inside another map which has the following structure</p>
  
  <pre><code>typedef set&lt;int&gt; nexthops;
  typedef std::map&lt;int, nexthops&gt; innerMap;
  typedef std::map&lt;int, innerMap&gt; mainMap;
  
  
  typedef std::set&lt;int&gt;::const_iterator nexthop_iterator;
  typedef map&lt;int, nexthops&gt;::const_iterator innermap_iterator;
  typedef map&lt;int, innerMap&gt;::const_iterator outermap_iterator;
  </code></pre>
  
  <p>I'm trying to insert a value in to the inner map's set for a given outer map key. Before i do the insert, i want to check the current key of the inner map for the given outer map key. </p>
  
  <ol>
  <li>If the current inner key is greater than the value that am going to insert, i want to clear the entire inner map and just add this new value as the new inner map key.</li>
  <li>If the current inner key is equal to the value that am going to
  insert, i will add the entry to the inner map's set.</li>
  <li>If the current inner key is less than the incoming value, then just discard the incoming value.</li>
  </ol>
  
  <p>I was able to implement the 2nd and 3rd condition, i need some help with the first condition. i.e to clear the entire inner map corresponding to a particular key in the outer map. </p>
  
  <p>Thank you.</p>