Create variable for RedBlackTree range

ag0aep6g anonymous at example.com
Wed May 2 10:39:29 UTC 2018


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;


More information about the Digitalmars-d-learn mailing list