Created
June 11, 2014 14:26
-
-
Save mlaster/085b80f8430fdbf33600 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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