ambuli
asked on
Question on using Vector iterator
Hi Experts,
I am using the following function to open numbers of file descriptors stored in a vector. When I run the program, it crashes on this function. If I check the size of the vector, it says 3. But, the loop seems to go more than 3 times before crashing. Can you help me resolve this. Thank you.
I am using the following function to open numbers of file descriptors stored in a vector. When I run the program, it crashes on this function. If I check the size of the vector, it says 3. But, the loop seems to go more than 3 times before crashing. Can you help me resolve this. Thank you.
typedef vector<SomeObject> ObjectsVector_t;
typedef ObjectsVector_t::iterator ObjectsVectorIter_t;
bool Reader::openObjects()
{
cout << "Size is = " << _objectsFactory->getObjectVector().size() << endl;
for (PPSObjectsVectorIter_t iter = _objectsFactory->getObjectVector().begin(); iter != _objectsFactory->getObjectVector().end(); iter++)
{
(*iter).openFd();
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER