title: segmentation fault in iterator
body: <p>I have created a multimap for my road points. The key refers to the road number and the values are vec3 points that make up the road. </p>
  
  <p>I am trying to iterate through the values of each key point and create a road segment at each point on the road (except the last), adjust the values to be on the road points and then store them in a std::vector. </p>
  
  <p>The RoadSegment constructor creates 6 vec3 points and pushes them onto a std::vector.</p>
  
  <p>I have a segmentation fault in the line marked in bold
  [for(mapIt = it.first; mapIt != it.second; ++mapIt)]</p>
  
  <p>When i take out the lines creating the new objects and pushing them onto the std::vector it works fine.</p>
  
  <p>Can anyone tell me what the problem is / a solution to the problem??</p>
  
  <p>Many thanks in advance</p>
  
  <pre><code>std::vector&lt;glm::vec3&gt;::iterator SegIt;
  
  for(int i = 0; i &lt; m_genRoads-&gt;getKeyValueData().size(); i++)
  {
      int numberDesired = m_genRoads-&gt;getMultimapData().count(i) - 1;
  
      std::multimap&lt;int, glm::vec3&gt;::iterator mapIt;
      std::pair&lt;std::multimap&lt;int, glm::vec3&gt;::iterator, std::multimap&lt;int, glm::vec3&gt;::iterator&gt; it;
  
      it = m_genRoads-&gt;getMultimapData().equal_range(i);
  
  
      for(mapIt = it.first; mapIt != it.second; ++mapIt)
      {
  
          int distance = std::distance(it.first, mapIt);
  
          if(distance != numberDesired)
          {
              RoadSegement* roadSegmentPointer = new RoadSegement();
  
              // FUNCTIONS TO ADJUST COORD VALUES TO MATCH THE ROAD POINTS
  
  
              m_segmentArray.push_back(roadSegmentPointer);
  
          }
  
          else
          {
              continue;
          }
  
           ///SOME BUFFER BINDING STUFF 
  </code></pre>