Hi again,

The solution of making an array from the range works, but I'm concerned about the cost of instantiating a (potentially very large) array each time I need to walk across the set. Unless doing that is costless in D for any reason, it does not seem practical in my case.

And when trying to compile the above example I got the following error:

Error: template instance std.range.SortedRange!(InputRange!int) does not match template declaration SortedRange(Range, alias pred = "a < b") if (isRandomAccessRange!Range && hasLength!Range)

I tried to replace SortedRange!InputRange thing with the following :

RandomAccessFinite!(InputRange!MyObject) opSlice();

But then I got the folowing error:

Error: template std.range.assumeSorted cannot deduce function from argument types !()(InputRange!int), candidates are: [...]

And I must admit that I'm stuck on that...

Beside that I understand that range interfaces like SorteRange are not idiomatic at all in D. So I don't mind using something else, but I can't see how a could make an "abstract" range from a RedBlackTree.Range struct.

I wouldn't mind encapsulating it in another struct or class I would define myself, but it seems I cannot access the RedBlackTree.Range struct from outside... For exemple with:

RedBlackTree.Range rbtRange = this.sequence[];

I get:

Error: identifier 'Range' of 'RedBlackTree.Range' is not defined

Or is it a syntax-related problem ?

Thanks again for your help !
Fred

Reply via email to