struct ReverseRandomAccessIndex<I : RandomAccessIndexType>

A wrapper for a RandomAccessIndexType that reverses its direction of traversal

Inheritance BidirectionalIndexType, Comparable, Equatable, ForwardIndexType, RandomAccessIndexType, Strideable, _BidirectionalIndexType, _Comparable, _ForwardIndexType, _Incrementable, _RandomAccessIndexType, _Strideable View Protocol Hierarchy →
Import import Swift

Instance Methods

func advancedBy(_:)

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)


func advancedBy(amount: I.Distance) -> ReverseRandomAccessIndex<I>
func distanceTo(_:)

Return the minimum number of applications of successor or predecessor required to reach other from self.

Complexity: O(1).


func distanceTo(other: ReverseRandomAccessIndex<I>) -> I.Distance
func predecessor()

Returns the previous consecutive value before self.

Requires: the previous value is representable.


func predecessor() -> ReverseRandomAccessIndex<I>
func successor()

Returns the next consecutive value after self.

Requires: the next value is representable.


func successor() -> ReverseRandomAccessIndex<I>