title: what's the best way to delete an entry map<int, A*>
body: <p>I discussed with my coworker about how to delete an entry in a map 
  the map has the int as the index and a pointer pointing to an object. </p>
  
  <p>I said, first release the object, and then delete the entry. 
  My coworker said first delete the entry and then release the object. </p>
  
  <p>So what's the best way? Any trick for this question?</p>