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 {
9696 // FIXME: Hack
9797 @_disfavoredOverload
9898 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 }
102101 }
103-
104- repeat update( lhs: each lhs, rhs: each rhs)
105- return result
102+ return true
106103 }
107104}
108105
109106extension Tuple : Hashable where repeat each Element : Hashable {
110107 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+ }
112111 }
113112}
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