++) and dereference (*) operators).++). But other kinds of iterators are possible. For example, eachcontainer type (such as alist) has a specificiterator type designed to iterate through its elements.| category | properties | valid expressions | |||
|---|---|---|---|---|---|
| all categories | copy-constructible,copy-assignable anddestructible | X b(a); | |||
| Can be incremented | ++a | ||||
| Random Access | Bidirectional | Forward | Input | Supports equality/inequality comparisons | a == b |
| Can be dereferenced as anrvalue | *a a->m | ||||
| Output | Can be dereferenced as anlvalue (only formutable iterator types) | *a = t *a++ = t | |||
| default-constructible | X a; X() | ||||
| Multi-pass: neither dereferencing nor incrementing affects dereferenceability | { b=a; *a++; *b; } | ||||
| Can be decremented | --a a-- *a-- | ||||
| Supports arithmetic operators+ and- | a + n n + a a - n a - b | ||||
| Supports inequality comparisons (<,>,<= and>=) between iterators | a < b a > b a <= b a >= b | ||||
| Supports compound assignment operations+= and-= | a += n a -= n | ||||
| Supports offset dereference operator ([]) | a[n] | ||||