Xinok:

My concern is that SortedRange only accepts a range which is random-access and limits its functionality to those primitives. Concatenation is not required for random-access ranges, so should we expect SortedRange to overload this operator?

I understand, that's why I am asking this here...
I think the desire to keep a sorted range around and grow it keeping its invariant is a common enough need for my code. Currently I keep an array then I use assumeSorted + upperBound, but this is not safe nor nice.
Perhaps sorted ranges should become more transparent in Phobos.

There are other invariants beside sortness that can be useful to carry around, like set-ness (every item is unique inside this collection) and few more.

Bye,
bearophile

Reply via email to