How do you use iterators with vectors of class pointers?
Hello! I'm very new to STL and have run across a fairly rudimentary question. Let's say I've got a vector as follows:
Let's say I've got the following function definition:
Apparently that doesn't work too well. Basically I just want to go through tangibles, find the first element whose "tangibleType" is equals to the value specified, set theReturn to that element (which is a pointer), pull the element out of the vector, and return theReturn. How should this block of code be written? Thanks!
Tangible* theReturn = NULL;
for (iterator = tangibles.begin(); iterator != tangibles.end();
if (iterator->get_tangibleType() == tangibleType)
theReturn = iterator;