[docs] Fix reverse STL iteration example
Use reverse_iterator, now that we finally have it. Change-Id: If74ead1a6075c5437c1d111206913481a495a014 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
143c684364
commit
f4502fbaf0
@ -156,10 +156,9 @@ for (i = list.begin(); i != list.end(); ++i)
|
||||
QList<QString> list;
|
||||
list << "A" << "B" << "C" << "D";
|
||||
|
||||
QList<QString>::iterator i = list.end();
|
||||
while (i != list.begin()) {
|
||||
--i;
|
||||
*i = (*i).toLower();
|
||||
QList<QString>::reverse_iterator i;
|
||||
for (i = list.rbegin(); i != list.rend(); ++i)
|
||||
*i = i->toLower();
|
||||
}
|
||||
//! [11]
|
||||
|
||||
|
@ -472,9 +472,7 @@
|
||||
|
||||
\image stliterators1.png
|
||||
|
||||
Iterating backward with an STL-style iterator requires us to
|
||||
decrement the iterator \e before we access the item. This
|
||||
requires a \c while loop:
|
||||
Iterating backward with an STL-style iterator is done with reverse iterators:
|
||||
|
||||
\snippet code/doc_src_containers.cpp 11
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user