Why this simple binaryHeap program does not compile?

Cheng Wei rivercheng at gmail.com
Thu Sep 22 04:10:25 PDT 2011


import std.container;

class T {
    int i;
}

void main() {
    auto array = Array!(T);
    auto heap  = BinaryHeap!(Array!(T), "a.i < b.i")(array);
}

After compiling:
dmd2/linux/bin32/../../src/phobos/std/container.d(1612): Error:
template std.conv.emplace(T) if (!is(T == class)) does not match any
function template declaration
dmd2/linux/bin32/../../src/phobos/std/container.d(1612): Error:
template std.conv.emplace(T) if (!is(T == class)) cannot deduce
template function from argument types !()(T*,T)


Is this a bug or I use the binary heap wrongly? Thanks a lot!


More information about the Digitalmars-d-learn mailing list