Skip to content

Instantly share code, notes, and snippets.

@mlaster
Created June 11, 2014 14:26
Show Gist options
  • Save mlaster/085b80f8430fdbf33600 to your computer and use it in GitHub Desktop.
Save mlaster/085b80f8430fdbf33600 to your computer and use it in GitHub Desktop.
// Playground - noun: a place where people can play
struct MySet<T: Hashable> : DebugPrintable {
var store: Dictionary<T,Void>
init() {
store = [:]
}
var debugDescription : String { return "fake description" }
mutating func add(v: T) -> Void {
println("add v: \(v)")
store[v] = ()
println("store: \(store)")
}
}
var s = MySet<String>()
var s2 = MySet<Int>()
s.add("foo")
s.add("bar")
s2.add(23)
s2.add(42)
s
s2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment