Last active
February 16, 2016 09:40
-
-
Save haranicle/d83fc5dca1ee200a4332 to your computer and use it in GitHub Desktop.
なぜなのか #CodePiece
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
protocol P: Hashable {} | |
func ==(lhs: S, rhs: S) -> Bool { return lhs.name == rhs.name } | |
struct S: P { | |
var name = "struct" | |
var hashValue: Int { get{ return name.hash } } | |
} | |
let setS: Set<S> = [S()] | |
let setP: Set<P> = [S()] // Protocol 'P' can only be used as a generic constraint because it has Self or assosiated type requirements |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment