Sounds fair enough. How about this one.
infix operator >**
/// A half-open interval, from a lower bound (excluding), to an upper bound (including).
public struct LeftOpenRange<Bound: Comparable>: Equatable {
public let lowerBound: Bound
public let upperBound: Bound
public init(uncheckedBounds bounds: (lower: Bound, upper: Bound)) { /*...*/ }
}
extension LeftOpenRange: RangeExpression { /*...*/ }
There should be no need to make lowerBound
optional as there will be a headIndex
pointing to a before start index but no element would exist here.
And with that, moved ranges are not intact anymore. How about making firstRange
and secondRange
inout
as well? It would increase the complexity a little bit but I think it would still be better as trade
methods will be rarely used considering the fact that there are already flexible options such as segregate
, truncate
, prepend
, etc.