     /// Returns a cursor over the concatenated results of mapping transform
     /// over self.
     public func flatMap<SegmentOfResult : Sequence>(_ transform: @escaping (Element) throws -> SegmentOfResult) -> FlattenCursor<MapCursor<Self, IteratorCursor<SegmentOfResult.Iterator>>> {
-        return flatMap { try IteratorCursor(transform($0).makeIterator()) }
+        return flatMap { try IteratorCursor(transform($0)) }
     }
     
     /// Returns a cursor over the concatenated results of mapping transform

    /// Returns a cursor over the concatenated results of mapping transform
    /// over self.
    public func flatMap<SegmentOfResult : Cursor>(_ transform: @escaping (Iterator.Element) throws -> SegmentOfResult) -> FlattenCursor<MapCursor<IteratorCursor<Self.Iterator>, SegmentOfResult>> {
        return IteratorCursor(makeIterator()).flatMap(transform)
    }
}

/// A Cursor whose elements are those of a sequence iterator.
public final class IteratorCursor<Base : IteratorProtocol> : Cursor {
    // TODO: remove this type when `extension IteratorProtocol : Cursor { }` can be written
    
    /// Creates a cursor from a sequence iterator.
    public init(_ base: Base) {
        self.base = base
    }
    
    /// Creates a cursor from a sequence.
    public init<S : Sequence>(_ s: S) where S.Iterator == Base {
        self.base = s.makeIterator()
    }
    
    /// Advances to the next element and returns it, or nil if no next
