Example Program
Iterator Basics
Simple iterator functions.
File "iterator.cpp"
A tutorial about the use of iterators.
1 | |
2 | |
3 | |
4 | |
5 | |
6 |
The metafunction Iterator returns the iterator type for a given container type.
7 | |
8 | |
9 |
We can use iterators to iterate over the elements of a container.
10 | |
11 | |
12 | |
13 | |
14 |
Rooted iterators know their container (Rooted Iterator).
Hence, the functions goBegin and atEnd do
not get str as an argument.
The following loop increments each character in str .
15 | |
16 | |
17 | |
18 | |
19 |
Some iterators support an iteration in reverse order.
Note that goPrevious is called before the value of it2 is accessed.
Remember that the end position of a container is always the position behind the last item in the container.
20 | |
21 | |
22 | |
23 | |
24 | |
25 | |
26 |
assignValue can be used to change the value of an iterator.
27 | |
28 | |
29 | |
30 | |
31 |
See
See Also
SeqAn - Sequence Analysis Library - www.seqan.de