Slide 7
Slide 7 text
func isEqual(_ lhs: T, _ rhs: T) -> Bool { lhs == rhs }
// Ok, Int is Equatable thus the tuples are Equatable
isEqual((1, 2, 3), (1, 2, 3)) // true
struct EmptyStruct {}
// error: type '(EmptyStruct, Int, Int)' does not conform to protocol 'Equatable'
// note: value of type 'EmptyStruct' does not conform to protocol 'Equatable',
// preventing conformance of '(EmptyStruct, Int, Int)' to 'Equatable'
isEqual((EmptyStruct(), 1, 2), (EmptyStruct(), 1, 2))
// We don't take into account the labels for equality.
isEqual((x: 0, y: 0), (0, 0)) // true
7