Thread overview
Why this simple binaryHeap program does not compile?
Sep 22, 2011
Cheng Wei
Sep 22, 2011
Ellery Newcomer
Sep 22, 2011
David Nadlinger
September 22, 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!
September 22, 2011
On 09/22/2011 06:10 AM, Cheng Wei wrote:
> 
> Is this a bug or I use the binary heap wrongly? Thanks a lot!

Looks like a bug in Array. emplace doesn't accept a pointer to a chunk for class types.

Report that puppy!
September 22, 2011
On 9/22/11 7:20 PM, Ellery Newcomer wrote:
> Looks like a bug in Array. emplace doesn't accept a pointer to a chunk
> for class types.
>
> Report that puppy!

See https://github.com/D-Programming-Language/phobos/commit/65a0c2158b1d2ea8e9d3094746739da636266089.

David