> On Jan 2, 2017, at 1:52 AM, Georgios Moschovitis > <george.moschovi...@icloud.com> wrote: > > Btw, isn’t it strange that the next() method in `IteratorProtocol` *is* > mutating, and makeIterator() is not?
Iterators are inherently stateful things. But for collections, the state they are mutating is their own progress through the collection as you iterate – they aren’t mutating the collection itself. That is what their mutating keyword on next() is indicating. On the other hand, creating a fresh one from the collection by calling makeIterator() shouldn’t need to mutate the collection.
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users