StructureSwift

ReversedCollection

A collection that presents the elements of its base collection in reverse order.

@frozen struct ReversedCollection<Base> where Base : BidirectionalCollection

Overview

The reversed() method is always lazy when applied to a collection with bidirectional indices, but does not implicitly confer laziness on algorithms applied to its result. In other words, for ordinary collections c having bidirectional indices:

  • c.reversed() does not create new storage

  • c.reversed().map(f) maps eagerly and returns a new array

  • c.lazy.reversed().map(f) maps lazily and returns a LazyMapCollection

Members

Typealiases

Instance Subscripts

Instance Properties

Instance Methods

Structures

  • struct Index

    An index that traverses the same positions as an underlying index, with inverted traversal direction.

  • struct Iterator

    A type that provides the sequence’s iteration interface and encapsulates its iteration state.

Conforms To

Removed Members

Instance Methods