Distance
Element operator i[n] Convertible to T
Element assignment i[n] = t X is mutable Convertible to T
Expression semantics

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 i itself, there must be n dereferenceable or past-the-end iterators following or preceding i, depending on whether n is positive or negative. If n > 0, equivalent to executing ++i n times. If n < 0, equivalent to executing --i n times. If n == 0 , this is a null operation. [1] i is dereferenceable or past-the-end.
Iterator addition i + n or n + i Same as for i += n Equivalent to { X tmp = i; return tmp += n; } . The two forms i + n and n + i are identical. Result is dereferenceable or past-the-end
Iterator subtraction i –= n Including i itself, there must be n dereferenceable or past-the-end iterators preceding or following i, depending on whether n is positive or negative. Equivalent to i += (-n). i is dereferenceable or past-the-end.
Iterator subtraction i – n Same as for i –= n Equivalent to { X tmp = i; return tmp –= n; }. Result is dereferenceable or past-the-end
Difference i – j Either i is reachable from j or j is reachable from i, or both. Returns a number n such that i == j + n
Element operator i[n] i + n exists and is dereferenceable. Equivalent to *(i + n) [2]
Element assignment i[n] = t i + n exists and is dereferenceable. Equivalent to *(i + n) = t [2] i[n] is a copy of t.
Less i < j Either i is reachable from j or j is reachable from i, or both. [3] As described in LessThan Comparable [4]
Complexity guarantees

All operations on Random Access Iterators are amortized constant time. [5]

Invariants
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату