NumberSetIterator
public struct NumberSetIterator<T> : IteratorProtocol where T : FixedWidthInteger, T : UnsignedInteger
An Iterator
that return the elements of a NumberSet
.
-
The elements returned by the
NumberSetIterator
are of typeInt
.Declaration
Swift
public typealias Element = Int
-
Creates a new iterator from the specified value.
Declaration
Swift
public init(rawValue: T)
Parameters
rawValue
An unsigned
FixedWidhtInteger
with a bit represeting each element that will be returned by the iterator. -
Advances to the next element and returns it, or
nil
if no next element exists.The next element returned is represented by the lowest bit that is set and is cleared before returning. Once all of the bits are clear then all subsequent calls return
nil
.Declaration
Swift
public mutating func next() -> Element?