On Sunday, January 03, 2016 10:55:05 AntonSotov via Digitalmars-d-learn wrote:
> import std.container.rbtree;
>
> class myClass {
> string str;
> }
>
>
> int main()
> {
> auto tree = new RedBlackTree!myClass;
> return 0;
> }
>
>
> Error: mutable method object.Object.opCmp is not callable using a
> inout object
> Error: template instance std.functional.binaryFun!("a < b", "a",
> "b").binaryFun!(inout(myClass), myClass) error instantiating
> /////////////////////////////////////////
>
> How to use RedBlackTree of the objects of of its class?
You either have to define opCmp on your class so that it can be compared
with the < operator, or you need to provide RedBlackTree's constructor a
function to use to compare instead of using <.
- Jonathan M Davis