GeneratorOf

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

Initializers

init(_: () -> T?)

Construct an instance whose next() method calls nextElement.

Declaration

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

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

Declaration

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

Declaration

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 self.next() has returned nil.

Declaration

mutating func next() -> T?