[stdlib] Nest some additional operators (#9646)

This commit is contained in:
Nate Cook
2017-05-17 21:44:08 -05:00
committed by Ben Cohen
parent 89515f8485
commit ca5c65f93c
6 changed files with 60 additions and 64 deletions

View File

@@ -111,33 +111,31 @@ public struct LazyPrefixWhileIndex<Base : Collection> : Comparable {
internal init(endOf: Base) {
self._value = .pastEnd
}
}
public func == <Base>(
lhs: LazyPrefixWhileIndex<Base>,
rhs: LazyPrefixWhileIndex<Base>
) -> Bool {
switch (lhs._value, rhs._value) {
case let (.index(l), .index(r)):
return l == r
case (.pastEnd, .pastEnd):
return true
default:
return false
public static func == (
lhs: LazyPrefixWhileIndex, rhs: LazyPrefixWhileIndex
) -> Bool {
switch (lhs._value, rhs._value) {
case let (.index(l), .index(r)):
return l == r
case (.pastEnd, .pastEnd):
return true
default:
return false
}
}
}
public func < <Base>(
lhs: LazyPrefixWhileIndex<Base>,
rhs: LazyPrefixWhileIndex<Base>
) -> Bool {
switch (lhs._value, rhs._value) {
case let (.index(l), .index(r)):
return l < r
case (.index, .pastEnd):
return true
default:
return false
public static func < (
lhs: LazyPrefixWhileIndex, rhs: LazyPrefixWhileIndex
) -> Bool {
switch (lhs._value, rhs._value) {
case let (.index(l), .index(r)):
return l < r
case (.index, .pastEnd):
return true
default:
return false
}
}
}