Table 5: Random-Access Iterator Additional Properties
Expression | Result Type | Meaning | Notes |
---|---|---|---|
a < b | convertible to bool | b is reachable from a | a and b in same domain |
a > b | convertible to bool | b < a | - |
a <= b | convertible to bool | !(b < a) | - |
a >= b | convertible to bool | !(a < b) | - |
r += n | X& |
{ Dist m = n; for (; 0 < m; --m) ++r; for(; m < 0; ++m) --r; return r; } |
- |
a + n n + a |
- |
{X tmp =a ; return tmp += n;} |
- |
r -= n | X& | r += -n | - |
a - n | X | a + -n | - |
b -a | Dist |
{ Dist m = 0; for (; a < b; ++a) ++m; for (; b < a; ++b) --m; return m; } |
a and b in same domain |
a[n] | convertible to T | *(a + n) | - |
Notes: X is iterator type, a and b have type X, r and s have
type X&
T is element type
Dist is distance type for X
all other properties same as for bidirectional iterators