mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
25 lines
518 B
Swift
25 lines
518 B
Swift
import Base
|
|
|
|
// Instantiate Counter<Int>, relying on Counter's adoption of ForwardIndex.
|
|
public struct OneToAThousand : Collection {
|
|
public typealias Element = Int
|
|
public typealias Index = Counter<Int>
|
|
|
|
public var startIndex: Index {
|
|
return Index(value: 1)
|
|
}
|
|
|
|
public var endIndex: Index {
|
|
return Index(value: 1001)
|
|
}
|
|
|
|
public subscript(i: Index) -> Element {
|
|
return i.value
|
|
}
|
|
|
|
public init() {}
|
|
}
|
|
|
|
public protocol SpecialProto : IntegerLiteralConvertible {}
|
|
extension Int : SpecialProto {}
|