mirror of
https://github.com/github/semantic.git
synced 2024-12-28 09:21:35 +03:00
17 lines
303 B
Swift
17 lines
303 B
Swift
public struct BoundsCheckedArray<Element>: CollectionType {
|
|
public init(array: [Element]) {
|
|
self.array = array
|
|
}
|
|
|
|
let array: [Element]
|
|
|
|
public let startIndex = 0
|
|
public var endIndex: Int {
|
|
return array.count
|
|
}
|
|
|
|
public subscript (i: Int) -> Element? {
|
|
return i < count ? array[i] : nil
|
|
}
|
|
}
|