mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Mechanically add "Type" to the end of any protocol names that don't end in "Type," "ible," or "able." Also, drop "Type" from the end of any associated type names, except for those of the *LiteralConvertible protocols. There are obvious improvements to make in some of these names, which can be handled with separate commits. Fixes <rdar://problem/17165920> Protocols `Integer` etc should get uglier names. Swift SVN r19883
20 lines
506 B
Swift
20 lines
506 B
Swift
// Adopt ForwardIndexType via BidirectionalIndexType.
|
|
public struct Counter<T: protocol<RandomAccessIndexType, IntegerLiteralConvertible>> : BidirectionalIndexType {
|
|
public var value = 0
|
|
|
|
public func predecessor() -> Counter {
|
|
return Counter(value: value - 1)
|
|
}
|
|
|
|
public func successor() -> Counter {
|
|
return Counter(value: value + 1)
|
|
}
|
|
|
|
public init(value: Int) { self.value = value }
|
|
}
|
|
|
|
public func == <T>(lhs: Counter<T>, rhs: Counter<T>) -> Bool {
|
|
return lhs.value == rhs.value
|
|
}
|
|
|