Re: problem with custom predicate

2015-05-27 Thread Meta via Digitalmars-d-learn
On Wednesday, 27 May 2015 at 17:56:27 UTC, Steven Schveighoffer wrote: On 5/27/15 9:59 AM, Meta wrote: I thought unaryFun *does* work with all callables, including structs/classes with opCall? It (binaryFun actually) declares an alias. But you need an actual instance to use in this case. You

Re: problem with custom predicate

2015-05-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/27/15 9:59 AM, Meta wrote: I thought unaryFun *does* work with all callables, including structs/classes with opCall? It (binaryFun actually) declares an alias. But you need an actual instance to use in this case. You simply can't declare that in a type definition, and it won't be set up

Re: problem with custom predicate

2015-05-27 Thread Timon Gehr via Digitalmars-d-learn
On 05/27/2015 05:30 PM, Steven Schveighoffer wrote: On 5/27/15 9:11 AM, "Simon =?UTF-8?B?QsO8cmdlciI=?= " wrote: On Wednesday, 27 May 2015 at 14:58:39 UTC, drug wrote: Do you want to dynamically change priority? Actually yes. In my actual code I am not using a RedBlackTree but my own Containe

Re: problem with custom predicate

2015-05-27 Thread Meta via Digitalmars-d-learn
On Wednesday, 27 May 2015 at 15:30:28 UTC, Steven Schveighoffer wrote: On 5/27/15 9:11 AM, "Simon =?UTF-8?B?QsO8cmdlciI=?= " wrote: On Wednesday, 27 May 2015 at 14:58:39 UTC, drug wrote: Do you want to dynamically change priority? Actually yes. In my actual code I am not using a RedBlackTree

Re: problem with custom predicate

2015-05-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/27/15 9:11 AM, "Simon =?UTF-8?B?QsO8cmdlciI=?= " wrote: On Wednesday, 27 May 2015 at 14:58:39 UTC, drug wrote: Do you want to dynamically change priority? Actually yes. In my actual code I am not using a RedBlackTree but my own Container (a heap with the possibility to modify elements ins

Re: problem with custom predicate

2015-05-27 Thread via Digitalmars-d-learn
On Wednesday, 27 May 2015 at 14:58:39 UTC, drug wrote: Do you want to dynamically change priority? Actually yes. In my actual code I am not using a RedBlackTree but my own Container (a heap with the possibility to modify elements inside), which is notified when prio changes so it can do a (lo

Re: problem with custom predicate

2015-05-27 Thread drug via Digitalmars-d-learn
On 27.05.2015 13:50, "Simon Bürger" " 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]Do you want to dynamically change

problem with custom predicate

2015-05-27 Thread via Digitalmars-d-learn
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]I think I understand the reason why this does not work (the lambda cannot acces