title: assertion failure, list iterator not dereferencable
body: <p>I'm getting an assertion failure "list iterator not dereferencable" from this line in the following code:</p>
  
  <p>iter2 = iter->vertex_list.erase(iter2);</p>
  
  <p>I'm not really sure why this is happening, I've made sure the list is not empty. Full code follows:</p>
  
  <pre><code>void Map_Quad_List::Vertex_List_Duplicate_Removal() {
      for (std::list&lt;Map_Polygon&gt;::iterator iter = map_polygon_list.begin(); iter != map_polygon_list.end(); iter++) { //iterate through polygons
          std::vector&lt;XMFLOAT3&gt; position_list; //list of vertices already tried
              for (std::list&lt;Vertex&gt;::iterator iter2 = iter-&gt;vertex_list.begin(); iter2 != iter-&gt;vertex_list.end(); iter2++ ) {//iterate through vertices
                  bool dup = false;
                  for (std::vector&lt;XMFLOAT3&gt;::iterator pos_list_iter = position_list.begin(); pos_list_iter != position_list.end(); pos_list_iter++) { //check vertex against position_list
                      if ((!position_list.empty()) &amp;&amp; (XMFLOAT3_Comparison(*pos_list_iter, iter2-&gt;position))) { //if vertex already exists in position_list
                          iter2 = iter-&gt;vertex_list.erase(iter2); //remove vertex from polygon's vertex_list
                          dup = true;
                      }
                  }
                  if (dup == false) //if there is not a duplicate in position_list, add it to position_list
                  position_list.push_back(iter2-&gt;position);
              }
  
      }
  }
  </code></pre>
  
  <p>map_polygon_list is a std::list of class type Map_Polygon</p>
  
  <p>Map_Polygon class has a std::list of class type Vertex</p>
  
  <p>Vertex is a class made up of a XMFLOAT3 (position) and a XMFLOAT4 (color), this function only deals with position (XMFLOAT3)</p>
  
  <p>XMFLOAT3_Comparison is a function that compare two XMFLOAT3 and returns true if they are the same</p>