struct PermutationGenerator<C : CollectionType, Indices : SequenceType where C.Index == C.Index>

A generator that adapts a collection C and any sequence of its Index type to present the collection's elements in a permuted order.

Inheritance GeneratorType, SequenceType, _SequenceType, _Sequence_Type View Protocol Hierarchy →
Associated Types
Element = C.Generator.Element

The type of element returned by next().

Generator = PermutationGenerator<C, Indices>

A type whose instances can produce the elements of this sequence, in order.

Import import Swift



Construct a generator over a permutation of elements given by indices.

Requires: elements[i] is valid for every i in indices.


init(elements: C, indices: Indices)

Instance Methods

func generate()

Return a generator over the elements of this sequence.

Complexity: O(1)


func generate() -> PermutationGenerator<C, Indices>
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() -> Element?