Distance | |||
| Element operator | i[n] | Convertible to | |
| Element assignment | i[n] = t | Convertible to |
Semantics of an expression is defined only where it differs from, or is not defined in, Bidirectional Iterator or LessThan Comparable.
| Name | Expression | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
| Forward motion | i += n | Including | If | |
| Iterator addition | i + n or n + i | Same as for | Equivalent to | Result is dereferenceable or past-the-end |
| Iterator subtraction | i –= n | Including | Equivalent to | |
| Iterator subtraction | i – n | Same as for | Equivalent to | Result is dereferenceable or past-the-end |
| Difference | i – j | Either | Returns a number | |
| Element operator | i[n] | Equivalent to | ||
| Element assignment | i[n] = t | Equivalent to | ||
| Less | i < j | Either | As described in LessThan Comparable [4] |
All operations on Random Access Iterators are amortized constant time. [5]
Вы читаете Standard Template Library Programmer's Guide
