struct IndexingGenerator<C : _CollectionType>

A generator for an arbitrary collection. Provided C conforms to the other requirements of CollectionType, IndexingGenerator<C> can be used as the result of C's generate() method. For example:

 struct MyCollection : CollectionType {
   struct Index : ForwardIndexType { *implementation hidden* }
   subscript(i: Index) -> MyElement { *implementation hidden* }
   func generate() -> **IndexingGenerator<MyCollection>** {
     return IndexingGenerator(self)
Inheritance GeneratorType, SequenceType, _SequenceType, _Sequence_Type View Protocol Hierarchy →
Associated Types
Generator = IndexingGenerator<C>

Type alias inferred.

Element = Generator.Element

Type alias inferred.

Import import Swift



Create a generator over the given collection


init(_ seq: C)

Instance Methods

func generate()

Return a generator over the elements of this sequence.

Complexity: O(1)


func generate() -> IndexingGenerator<C>
mutating func next()

Advance to the next element and return it, or nil if no next element exists.

Requires: no preceding call to has returned nil.


mutating func next() -> C._Element?