On Wednesday, 25 May 2016 at 11:14:26 UTC, FreeSlave wrote:
Works with 'only', 'array' and static array slicing.
import std.algorithm : map;
import std.range : only;
import std.conv : to;
import std.stdio : writeln;
import std.string : join;
import std.array : array;
string test(Args...)(in Args items){
immutable string[items.length] itemstrings =
map!(to!string)(only(items)).array;
return join(itemstrings[], ", ");
}
unittest{
writeln(test(1, 2, 3, 4));
}
Nice, but I think it doesn't work with varying types.
writeln(test(1, 2, "v", 4, 'c'));