Return Value 戻り値
The distance between start
and end
.
start
とend
の隔たり。
The result can be negative only if the collection conforms to the Bidirectional
protocol.
Availability 有効性
Technology
func distance(from start: Self.Index, to end: Self.Index) -> Int
The distance between start
and end
.
start
とend
の隔たり。
The result can be negative only if the collection conforms to the Bidirectional
protocol.
start
A valid index of the collection. コレクションのひとつの有効なインデックス。
end
Another valid index of the collection. If end
is equal to start
, the result is zero.
コレクションの別の有効なインデックス。end
がstart
に等しいならば、結果はゼロです。
Unless the collection conforms to the Bidirectional
protocol, start
must be less than or equal to end
.
Complexity
O(1) if the collection conforms to Random
; otherwise, O(k), where k is the resulting distance.