Error: template cannot deduce function from argument types.
Damian Day via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Aug 23 19:53:40 PDT 2014
Hi, I've been trying to reduce a bug in the containers (8824).
From the example below it seems the dup method is passing the
constructor
an array of dchars and the template is failing.
Is this a compiler bug, or ?
import std.range, std.traits;
struct Array2(T)
{
private T[] _payload;
size_t insertAt(R)(size_t index, R rng)
if (isInputRange!R &&
isImplicitlyConvertible!(ElementType!R, T))
{
return 0;
}
this(U)(U[] values...)
if (isImplicitlyConvertible!(U, T))
{
insertAt(0, values);
}
@property Array2 dup()
{
return Array2(_payload);
}
}
unittest
{
Array2!int a; //passes
Array2!char a; //fails
}
More information about the Digitalmars-d-learn
mailing list