Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Xcode seems to hate this
import Foundation
struct BagGenerator<T:Hashable> : Generator
typealias Element = (T, Int, Int)
var count = 0
var _backingGenerator : DictionaryGenerator<T, Int>
init(_ backingDictionary : Dictionary<T, Int>) {
_backingGenerator = backingDictionary.generate()
func next() -> (T, Int, Int)?
var pair : (T, Int)? =
if (!pair) {return nil}
var tuple = (count, pair!.0, pair!.1)
count = count + 1
return tuple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.