For that reason, iterators are rarely useful in connection with QList. One place where STL-style iterators do make sense is as arguments to generic
doc.trolltech.com/4.2/qlist-iterator.html
So if I have a for loop, where the macro foreach isn't an option. Should I use iterators or indexes?
for(int i = 0; i < list.size(); i++) {
Do something with list[i]
blah blah blah
}
for(int i = 0; i < list.size(); i++) {
Do something with list[i]
blah blah blah
}
To copy to clipboard, switch view to plain text mode
for(QList<type>::iterator i = list.begin(); i != list.end(); ++i) {
Do something with *i
blah blah blah
}
for(QList<type>::iterator i = list.begin(); i != list.end(); ++i) {
Do something with *i
blah blah blah
}
To copy to clipboard, switch view to plain text mode
Bookmarks