Problem Instantiating a BinaryHeap with a Comparison Function the needs this

Tobias Pankrath via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 19 06:12:49 PST 2015


On Thursday, 19 February 2015 at 11:56:19 UTC, Nordlöw wrote:

Please provide reduced examples.

This fails:

class C
{
     int[] a;
     alias BH = BinaryHeap!(int[], (x, y) => (x+a < y));
}

This works:

class C
{
     int[] a;

     void foo() {
         alias BH = BinaryHeap!(int[], (x, y) => (x+a < y));
     }
}

But will create an instance of BinaryHeap per member function.

> What to do?

Dunno.


More information about the Digitalmars-d-learn mailing list