ReverseRandomAccessIndex

struct ReverseRandomAccessIndex<Base : RandomAccessIndexType>

A wrapper for a RandomAccessIndexType that reverses its direction of traversal.

Inheritance BidirectionalIndexType, Comparable, Equatable, ForwardIndexType, RandomAccessIndexType, ReverseIndexType, Strideable, _Incrementable, _RandomAccessAmbiguity View Protocol Hierarchy →
Associated Types
Distance = Base.Distance
Import import Swift

Initializers

init(_:)

Declaration

init(_ base: Base)

Instance Variables

var base: Base

The successor position in the underlying (un-reversed) collection.

If self is advance(c.reverse.startIndex, n), then: - self.base is advance(c.endIndex, -n). - if n != c.count, then c.reverse[self] is equivalent to [self.base.predecessor()].

Declaration

var base: Base { get }

Instance Methods

func advancedBy(_:)

Declaration

func advancedBy(n: Base.Distance) -> ReverseRandomAccessIndex<Base>

Declared In

ReverseRandomAccessIndex, RandomAccessIndexType, ReverseIndexType, BidirectionalIndexType, _RandomAccessAmbiguity, ForwardIndexType
func advancedBy(_:limit:)

Declaration

func advancedBy(n: ReverseRandomAccessIndex<Base>.Distance, limit: ReverseRandomAccessIndex<Base>) -> ReverseRandomAccessIndex<Base>

Declared In

RandomAccessIndexType, ReverseIndexType, BidirectionalIndexType, ForwardIndexType
func distanceTo(_:)

Declaration

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

Declared In

ReverseRandomAccessIndex, RandomAccessIndexType, ReverseIndexType, BidirectionalIndexType, ForwardIndexType
func predecessor()

Returns the previous consecutive value before self.

Requires: The previous value is representable.

Declaration

func predecessor() -> ReverseRandomAccessIndex<Base>

Declared In

BidirectionalIndexType
func stride(through:by:)

Returns the sequence of values (self, self + stride, self + stride + stride, ... last) where last is the last value in the progression less than or equal to end.

Note: There is no guarantee that end is an element of the sequence.

Declaration

func stride(through end: ReverseRandomAccessIndex<Base>, by stride: ReverseRandomAccessIndex<Base>.Stride) -> StrideThrough<ReverseRandomAccessIndex<Base>>

Declared In

RandomAccessIndexType, Strideable
func stride(to:by:)

Returns the sequence of values (self, self + stride, self + stride + stride, ... last) where last is the last value in the progression that is less than end.

Declaration

func stride(to end: ReverseRandomAccessIndex<Base>, by stride: ReverseRandomAccessIndex<Base>.Stride) -> StrideTo<ReverseRandomAccessIndex<Base>>

Declared In

RandomAccessIndexType, Strideable
func successor()

Returns the next consecutive value after self.

Requires: The next value is representable.

Declaration

func successor() -> ReverseRandomAccessIndex<Base>

Declared In

BidirectionalIndexType