Getting value of std::_List_iterator to pointer?
        Posted  
        
            by Onedayitwillmake
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Onedayitwillmake
        
        
        
        Published on 2010-05-02T19:19:06Z
        Indexed on 
            2010/05/02
            19:27 UTC
        
        
        Read the original article
        Hit count: 227
        
How can i loop thru a stl::List and store the value of one of the objects for use later in the function?
Particle *closestParticle;
for(list<Particle>::iterator p1 = mParticles.begin(); p1 != mParticles.end(); ++p1 )
     {
      // Extra stuff removed
            closestParticle = p1; // fails
     }
© Stack Overflow or respective owner