Skip to content

Instantly share code, notes, and snippets.

@rnapier
Created July 27, 2014 17:17
Show Gist options
  • Save rnapier/411a710ebb725677b25d to your computer and use it in GitHub Desktop.
Save rnapier/411a710ebb725677b25d to your computer and use it in GitHub Desktop.
Tuple equatable
func ==<A:Equatable, B:Equatable>(lhs:(A,B), rhs:(A,B)) -> Bool {
return lhs.0 == rhs.0
&& lhs.1 == rhs.1
}
func ==<A:Equatable, B:Equatable, C:Equatable>(lhs:(A,B,C), rhs:(A,B,C)) -> Bool {
return lhs.0 == rhs.0
&& lhs.1 == rhs.1
&& lhs.2 == rhs.2
}
func ==<A:Equatable, B:Equatable, C:Equatable, D:Equatable>(lhs:(A,B,C,D), rhs:(A,B,C,D)) -> Bool {
return lhs.0 == rhs.0
&& lhs.1 == rhs.1
&& lhs.2 == rhs.2
&& lhs.3 == rhs.3
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment