problem with custom predicate

drug via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 27 07:58:36 PDT 2015


On 27.05.2015 13:50, "Simon Bürger" <simon.buerger at rwth-aachen.de>" wrote:
> I am trying to use a Container class with a custom predicate, but the
> following code does not compile. Any hints on how to do it?
>
> import std.container;
>
> class C
> {
>      int[] prio;
>      RedBlackTree!(int, (a,b)=>prio[a]<prio[b]) tree;
> }
>
> I think I understand the reason why this does not work (the lambda
> cannot access the 'this' to get to 'prio'), but I can't think of a way
> to make it work. Any Ideas?
>
>
Do you want to dynamically change priority? Why prio is outside of your 
predicate?


More information about the Digitalmars-d-learn mailing list