Min-Heap and Hash Table help

Timon Gehr timon.gehr at gmx.ch
Tue Apr 3 04:28:06 PDT 2012


On 04/03/2012 05:17 AM, Chris Pons wrote:
> I'm still having troubles with the min-heap.
>
> Node[] a;
> auto b = BinaryHeap!"a.fScore > b.fScore"( a[] );
>
>
> Error 1 Error: template instance BinaryHeap!("a.fScore >
> b.fScore") BinaryHeap!("a.fScore > b.fScore") does not match
> template declaration BinaryHeap(Store,alias less = "a < b") if
> (isRandomAccessRange!(Store) ||
> isRandomAccessRange!(typeof(Store.init[]))) C:\Users\CP\Documents\Visual
> Studio 2010\Projects\D\STDS\NPC.d 252
>

That is an API design issue. This should work:

auto b = BinaryHeap!(Node[], "a.fScore > b.fScore")(a);


More information about the Digitalmars-d-learn mailing list