On Wednesday, 2 May 2018 at 10:39:29 UTC, ag0aep6g wrote:
On 04/28/2018 06:36 PM, Gerald wrote:
What is the appropriate way to create a variable for the range returned by RedBlackTree lowerBound and upperBound. For example, given this code:

```
RedBlackTree!long promptPosition = redBlackTree!long();

long row = to!long(vte.getVadjustment().getValue());
RBRange!(RBNode!long*) range;
[...]
}
```

The second line where I declare the range variable as RBRange!(RBNode!long*) the compiler complains with the following warning:

Deprecation: std.container.rbtree.RBRange(N) is not visible from module terminal

Which makes sense since RBRange is a private struct.

RedBlackTree also has public range types: Range, ConstRange, ImmutableRange. And `RedBlackTree!long.Range` is an alias for `RBRange!(RBNode!long*)`.

So:

    RedBlackTree!long promptPosition = redBlackTree!long();
    RedBlackTree!long.Range range;

For completeness' sake, and if you don't want to re-specify the template parameters you passed to RedBlackTree, you can write:

promptPosition.Range range;

Reply via email to