4 ms·
Collection's startIndex and subscripting is supposed to be O(1), so I'd assume that first is also supposed to be O(1) since it's trivial to implement it by comp
by saagarjha 8y ago
Collection's startIndex and subscripting is supposed to be O(1), so I'd assume that first is also supposed to be O(1) since it's trivial to implement it by composing the first two (in fact, this is how Swift implements it by default if you don't override it: https://github.com/apple/swift/blob/e08b2194487d883896a377a0f343577775845cd3/stdlib/public/core/Collection.swift#L1095 https://github.com/apple/swift/blob/e08b2194487d883896a377a0...)