On Tuesday, 19 September 2023 at 06:35:01 UTC, JG wrote:
On Tuesday, 19 September 2023 at 00:34:01 UTC, vino wrote:
//auto a = Array!string("Aname"); // throws error
auto b = Array!char("Bname"); // works
auto c = Array!string("Aname", "Bname"); // works
...
Looks to me like when it receives a single range it expects the
elements of that range to match the type.
Yes, the first overload fails to match because U is inferred as
immutable(char) rather than string:
this(U)(U[] values...)
if (isImplicitlyConvertible!(U, T))
This is because a single array can be passed to a typesafe
variadic parameter rather than elements of that array type. And
then immutable(char) doesn't convert to string.
I think a non-variadic overload could be added to make it work as
expected.