I am trying to concatenate 2 ranges of the same type (SortedRange in my case). I have tried merge, join and chain, but the problem is that the result is not an object of the type of the initial ranges. For example:

1. If I use chain(r1, r2), the result will be an object of type Result which I cannot cast to my specific type (SortedRange).

2. If I use merge(r1, r2), the result will be an object of type Merge!(typeof(r1), typeof(r)).

I know that I can use the .array property, but I think that this iterates through all of my elements. Using assumeSorted(chain(r1, r2).array) will return a SortedRange, but I am not sure what the complexity for this operation is.

Is there a way to concatenate 2 ranges (SortedRange in my case) in O(1) time?

Reply via email to