struct
ReverseRandomAccessIndex
<
I
:
RandomAccessIndexType
>
Inheritance |
BidirectionalIndexType, Comparable, Equatable, ForwardIndexType, RandomAccessIndexType, Strideable, _BidirectionalIndexType, _Comparable, _ForwardIndexType, _Incrementable, _RandomAccessIndexType, _Strideable
View Protocol Hierarchy →
|
---|---|
Import |
|
Instance Methods
Return self
offset by n
steps.
Returns: If n > 0
, the result of applying successor
to
self
n
times. If n < 0
, the result of applying
predecessor
to self
-n
times. Otherwise, self
.
Complexity: O(1)
Declaration
func
advancedBy
(
amount
:
I
.
Distance
) -
>
ReverseRandomAccessIndex
<
I
>
Return the minimum number of applications of successor
or
predecessor
required to reach other
from self
.
Complexity: O(1).
Declaration
func
distanceTo
(
other
:
ReverseRandomAccessIndex
<
I
>
) -
>
I
.
Distance
Returns the previous consecutive value before self
.
Requires: the previous value is representable.
Declaration
func
predecessor
() -
>
ReverseRandomAccessIndex
<
I
>
Returns the next consecutive value after self
.
Requires: the next value is representable.
Declaration
func
successor
() -
>
ReverseRandomAccessIndex
<
I
>
A wrapper for a
RandomAccessIndexType
that reverses its direction of traversal