Why can't the compiler properly detect the type of Array!string("something")?
Adnan
relay.public.adnan at outlook.com
Sat Mar 14 23:39:11 UTC 2020
In the following code the compiler says the type is
Array!()(string):
if (key in wordTable)
wordTable[key] ~= word;
else
wordTable[key] = Array!string(word);
source/app.d(29,36): Error: template
std.container.array.Array!string.Array.__ctor cannot deduce functi
on from argument types !()(string), candidates are:
/snap/dmd/99/bin/../import/phobos/std/container/array.d(467,5):
__ctor(U)(U[] values...)
with U = immutable(char)
must satisfy the following constraint:
isImplicitlyConvertible!(U, T)
/snap/dmd/99/bin/../import/phobos/std/container/array.d(501,5):
__ctor(Range)(Range r)
with Range = string
must satisfy the following constraint:
isImplicitlyConvertible!(ElementType!Range, T)
More information about the Digitalmars-d-learn
mailing list