struct ReverseRandomAccessIndex<Base : RandomAccessIndexType>
Inheritance |
BidirectionalIndexType, Comparable, Equatable, ForwardIndexType, RandomAccessIndexType, ReverseIndexType, Strideable, _Incrementable, _RandomAccessAmbiguity
View Protocol Hierarchy →
|
---|---|
Associated Types | |
Import | import Swift |
Initializers
Instance Variables
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
Declaration
func advancedBy(n: Base.Distance) -> ReverseRandomAccessIndex<Base>
Declared In
ReverseRandomAccessIndex
, RandomAccessIndexType
, ReverseIndexType
, BidirectionalIndexType
, _RandomAccessAmbiguity
, ForwardIndexType
Declaration
func advancedBy(n: ReverseRandomAccessIndex<Base>.Distance, limit: ReverseRandomAccessIndex<Base>) -> ReverseRandomAccessIndex<Base>
Declared In
RandomAccessIndexType
, ReverseIndexType
, BidirectionalIndexType
, ForwardIndexType
Declaration
func distanceTo(other: ReverseRandomAccessIndex<Base>) -> Base.Distance
Declared In
ReverseRandomAccessIndex
, RandomAccessIndexType
, ReverseIndexType
, BidirectionalIndexType
, ForwardIndexType
Returns the previous consecutive value before self
.
Requires: The previous value is representable.
Declaration
func predecessor() -> ReverseRandomAccessIndex<Base>
Declared In
BidirectionalIndexType
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
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
Returns the next consecutive value after self
.
Requires: The next value is representable.
Declaration
func successor() -> ReverseRandomAccessIndex<Base>
Declared In
BidirectionalIndexType
A wrapper for a
RandomAccessIndexType
that reverses its direction of traversal.