ReverseRandomAccessIndex

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 predecessor()

Returns the previous consecutive value before self.

Requires: The previous value is representable.

Declaration

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

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

Declared In

RandomAccessIndexType, Strideable
func successor()

Returns the next consecutive value after self.

Requires: The next value is representable.

Declaration

Declared In

BidirectionalIndexType

5 inherited items hidden. (Show all)