I have a the following code.
vector* irds = myotherobj->getIRDs();//gets a pointer to the vector
for(vector::iterator it = ir
You need to use !=
with iterators to test for the end, not <
like you would with pointers. operator<
happens to work with vector
iterators, but if you switch containers (to one like list
) your code will no longer compile, so it's generally good to use !=
.
Also, an iterator is not the type that it points to, so don't try to cast it. You can use the overloaded operator->
on iterators.
vector* irds = myotherobj->getIRDs();//gets a pointer to the vector
for(vector::iterator it = irds->begin(); it != irds->end(); ++it)
{
it->dosomething();
}