Created
January 15, 2015 16:27
-
-
Save jgallagher/de9fd68e00eda76e1e64 to your computer and use it in GitHub Desktop.
Don't use Swift Dictionary indices after you change the dictionary
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
| var d: [Int:Int] = Dictionary(minimumCapacity: 64) | |
| d[1] = 1 | |
| let idx = d.startIndex | |
| println(d[idx]) | |
| for i in 1 ..< 63 { | |
| d[1 + 64*i] = 1+64*i | |
| } | |
| println("d[1] is still \(d[1]), but d[idx] is now \(d[idx])") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment