×

Loading...

template

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.
(#141106@0)
2001-7-22 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: (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?

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论