   Some std::help
  Please forgive me if this formatting is wrong.  I've seen reference to using source tags/delimiters but I haven't yet found the documentation on it.  I would appreciate a pointer to that if possible.  AAR and regardless...I'm doing some reading in advance, as opposed to advanced reading, before diving into my project.  Right now I'm trying to absorb the article on Enginuity.  In it the author creates a static std::list of pointers to his objects.  Each object, as it's created pushes its 'this' pointer onto the list and initializes a counter as to what number of processes are referencing it.  My concern the operation of the garbage collection phase.  In essence....void IMMObject::CollectGarbage(){   for(std::list<IMMObject *>::iterator it=liveObjects.begin();   it!=liveObjects.end(); )   { IMMObject *ptr=(*it); ++it; if(ptr->refCount<=0) {    liveObjects.remove(ptr);    delete ptr; }   }}The code I'm not grokking isliveOjbects.remove(ptr);If I'm reading this code correctly, ptr is a pointer to the object type, which is what comprises the elements of the std::list liveObjects.  Does the .remove function remove any elements that match the function argument by value?  Although this wouldn't be the case here, would it do it for all elements that have that value?TIA,Lilith
Quote:Original post by LilithAnnThe code I'm not grokking isliveOjbects.remove(ptr);If I'm reading this code correctly, ptr is a pointer to the object type, which is what comprises the elements of the std::list liveObjects.  Does the .remove function remove any elements that match the function argument by value?Yes.  In fact the list member function remove is specialised version of the global algorithm remove.Quote:Although this wouldn't be the case here, would it do it for all elements that have that value?Yes.This is a useful reference on the SC++L, (actually the original STL, but most of it is still relevant and the bits that aren't are clearly marked as such).  Or, if you have the resources and the desire for a paper reference I'd recommend The C++ Standard Library, A Tutorial and Reference by Nicolai M. Josuttis.Finally, the instructions on [source] tags can be found in the GDNet Forums FAQ.  Basically they operate just like html, so you need to close them!Σnigma   ;  Yes, it will remove all pointers with the same value (i.e. that refer to the same object).Documentation on the tags is available in the Forum FAQ. You need to close the source tag as well.   ;  Thanks to both of you.  The links have helped forstall my asking one more question about the iterator, its validity and what it actually is.Lilith   