Post by monarch_dodra
Currently, this is not possible. Or if it was, it would have a
*very* high code cost inside RBT.
It is possible in theory; RBT returns a separate Range type with
opSlice that is implemented in terms of pointers to node. (This
is hidden by an alias RBNode!Elem* Node, which gets in the way,
but if those were inout(RBNode)* or const()* it'd work).
We can have mutable pointers to const data, which would work with
the range. So opSlice returns a mutable range that points back to
But in this case, none of the functions in rbtree use const nor
inout, and there's some caching (e.g. _left and _right) that I'm
not sure can work with it at all anyway. In a const node, the
left and right properties won't work..