Shorthand for Offsetting startIndex and endIndex

This seems like another case that would be well served by an operator ..<+ hack:

infix operator ..<+

extension Strideable {
  static func ..<+ (lhs: Self, rhs: Stride) -> Range<Self> {
    return lhs..<lhs.advanced(by: rhs)
  }
}

let r = 5..<+10
// r = 5..<15
1 Like