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