1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
See section ref(ITERATORS) for details about em(iterators). As a quick
introduction to iterators: an iterator acts like a pointer, and pointers can
often be used in situations where iterators are requested. Iterators usually
come in pairs, defining a range of entities. The begin-iterator points to the
first entity, the end-iterator points just beyond the last entity of the
range. Their difference is equal to the number of entities in the
iterator-range.
Iterators play an important role in the context of em(generic algorithms)
(cf. chapter ref(GENERIC)). The class tt(std::string) defines the following
hi(string: iterator types)em(iterator types):
itemization(
itt(string::iterator) and tt(string::const_iterator):
quote(these iterators are emi(forward iterators). The
tt(const_iterator) is returned by tt(string const) objects, the plain
tt(iterator) is returned by non-const string objects. Characters referred to
by tt(iterators) may be modified;)
itt(string::reverse_iterator) and tt(string::const_reverse_iterator):
quote(these iterators are also emi(forward iterators) but when
em(incrementing) the iterator the em(previous) character in the string object
is reached. Other than that they are comparable to, respectively,
tt(string::iterator) and tt(string::const_iterator).)
)
|