title: map iterator erase not calling appropriate destructors
body: <p><code>gameObjects</code> is a <code>std::map&lt;sf::String,VisibleGameObject*&gt;</code>, and <code>results</code> is a <code>std::map&lt;sf::String,VisibleGameObject*&gt;::iterator</code>. When this runs:</p>
  
  <pre><code>return gameObjects.erase(results);
  </code></pre>
  
  <p>I expected the destructor of VisibleGameObject to run, which is:</p>
  
  <pre><code>VisibleGameObject::~VisibleGameObject(){
      m_pSceneManager-&gt;removeSprite(name);
  }
  </code></pre>
  
  <p>never runs, until the class which holds <code>gameObjects</code> is destroyed, which then runs:</p>
  
  <pre><code>GameObjectManager::~GameObjectManager(){
      std::for_each(gameObjects.begin(),gameObjects.end(),GameObjectDeallocator());
  }
  
  struct GameObjectDeallocator{
          void operator()(const std::pair&lt;sf::String,VisibleGameObject*&gt;&amp;p) const{
              delete p.second;
          }
      };
  </code></pre>
  
  <p>then it does run. Why doesn't it run in the first case?</p>
  
  <p>Using SFML 2.0</p>
  
  <p>Thanks</p>