jfhuang (Zigzag)
use iterator:
vector<object>::iterator aIterator;

for (aIterator = aVector.begin();aIterator != aVector.end();aIterator++){
// loop

the statement to remove an element from a vector is:
aIterator2 = aVector.erase(aIterator1);
aIterator2 is an iterator which desigates the next available element.

2001-7-22 -04:00

回到话题: (C++)How to get object from vector one by one in a loop? thanks. After I erase an element from a list,where the pointer will point to?

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论