struct GeneratorOf<T>

A type-erased generator.

The generator for SequenceOf<T>. Forwards operations to an arbitrary underlying generator with the same Element type, hiding the specifics of the underlying generator type.

See also: SequenceOf<T>.

Inheritance GeneratorType, SequenceType, _SequenceType, _Sequence_Type View Protocol Hierarchy →
Associated Types
Generator = GeneratorOf<T>

Type alias inferred.

Element = Generator.Element

Type alias inferred.

Import import Swift


init(_: () -> T?)

Construct an instance whose next() method calls nextElement.


init(_ nextElement: () -> T?)
init<G : GeneratorType where T == T>(_: G)

Construct an instance whose next() method pulls its results from base.


init<G : GeneratorType where T == T>(_ base: G)

Instance Methods

func generate()

GeneratorOf<T> is also a SequenceType, so it generates a copy of itself


func generate() -> GeneratorOf<T>
mutating func next()

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

Requires: next() has not been applied to a copy of self since the copy was made, and no preceding call to has returned nil.


mutating func next() -> T?