We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae60159 commit ebfb504Copy full SHA for ebfb504
stdlib/public/core/Arrays.swift.gyb
@@ -1270,6 +1270,8 @@ public func == <Element : Equatable>(
1270
return true
1271
}
1272
1273
+%if Self == 'ArraySlice':
1274
+
1275
var streamLHS = lhs.generate()
1276
var streamRHS = rhs.generate()
1277
@@ -1282,6 +1284,19 @@ public func == <Element : Equatable>(
1282
1284
nextLHS = streamLHS.next()
1283
1285
1286
1287
+%else:
1288
1289
+ _sanityCheck(lhs.startIndex == 0 && rhs.startIndex == 0)
1290
+ _sanityCheck(lhs.endIndex == lhsCount && rhs.endIndex == lhsCount)
1291
1292
+ // We know that lhs.count == rhs.count, compare element wise.
1293
+ for idx in 0..<lhsCount {
1294
+ if lhs[idx] != rhs[idx] {
1295
+ return false
1296
+ }
1297
1298
+%end
1299
1300
1301
1302
0 commit comments