ReverseRandomAccessIndex

  • struct ReverseRandomAccessIndex<Base : RandomAccessIndex>

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

Inheritance BidirectionalIndex, Comparable, Equatable, ForwardIndex, RandomAccessIndex, ReverseIndexProtocol, 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 advanced(by:)

Declaration

  • func advanced(by n: Base.Distance) -> ReverseRandomAccessIndex<Base>

Declared In

ReverseRandomAccessIndex, RandomAccessIndex, ReverseIndexProtocol, BidirectionalIndex, _RandomAccessAmbiguity, ForwardIndex
func advanced(by:limit:)

Declaration

  • func advanced(by n: ReverseRandomAccessIndex<Base>.Distance, limit: ReverseRandomAccessIndex<Base>) -> ReverseRandomAccessIndex<Base>

Declared In

RandomAccessIndex, ReverseIndexProtocol, BidirectionalIndex, ForwardIndex
func distance(to:)

Declaration

  • func distance(to other: ReverseRandomAccessIndex<Base>) -> Base.Distance

Declared In

ReverseRandomAccessIndex, RandomAccessIndex, ReverseIndexProtocol, BidirectionalIndex, ForwardIndex
func predecessor()

Returns the previous consecutive value before self.

Precondition: The previous value is representable.

Declaration

  • func predecessor() -> ReverseRandomAccessIndex<Base>

Declared In

BidirectionalIndex
func successor()

Returns the next consecutive value after self.

Precondition: The next value is representable.

Declaration

  • func successor() -> ReverseRandomAccessIndex<Base>

Declared In

BidirectionalIndex

3 inherited items hidden. (Show all)