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::ite
I'm not an expert on the STL, but I believe the reason it fails to compile is because an iterator is an object that points to another object. In other words, an iterator is a generalization of a pointer. So to do what you'd want with minimal changes to your code, you would first need to de-reference the iterator to get at the value it contains. You'd then use the '&' to get its address and would then assign that address to your pointer variable. This is why ptr=&*it; works.