File tree Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Expand file tree Collapse file tree 1 file changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -96,18 +96,30 @@ extension Tuple: Equatable where repeat each Element: Equatable {
96
96
// FIXME: Hack
97
97
@_disfavoredOverload
98
98
public static func == ( lhs: Self , rhs: Self ) -> Bool {
99
- var result = true
100
- func update< E: Equatable > ( lhs: E , rhs: E ) {
101
- result = result && ( lhs == rhs)
99
+ for (l, r) in repeat ( each lhs, each rhs) {
100
+ if l != r { return false }
102
101
}
103
-
104
- repeat update( lhs: each lhs, rhs: each rhs)
105
- return result
102
+ return true
106
103
}
107
104
}
108
105
109
106
extension Tuple : Hashable where repeat each Element : Hashable {
110
107
public func hash( into hasher: inout Hasher ) {
111
- repeat ( each self ) . hash ( into: & hasher)
108
+ for elt in repeat each self {
109
+ elt. hash ( into: & hasher)
110
+ }
112
111
}
113
112
}
113
+
114
+ extension Tuple : Comparable where repeat each Element : Comparable {
115
+ // FIXME: Hack
116
+ @_disfavoredOverload
117
+ public static func < ( lhs: Self , rhs: Self ) -> Bool {
118
+ for (l, r) in repeat ( each lhs, each rhs) {
119
+ if l > r { return false }
120
+ if l < r { return true }
121
+ }
122
+ return false
123
+ }
124
+ }
125
+
You can’t perform that action at this time.
0 commit comments