On 04/15/2018 02:04 PM, vladdeSV wrote:
foo(1,2,3);
void foo(T...)(T args)
{
writefln("expected: %s", [1,2,3]);
writefln("actual: %s", args);
}
The code above will output
expected: [1, 2, 3]
actual: 1
How would I go on about to print all the arg
On Sunday, 15 April 2018 at 12:04:19 UTC, vladdeSV wrote:
How would I go on about to print all the arguments as I
expected it, using "%s"?
You can expand the template arguments into an array by putting it
into square brackets: [args]. You can format an array with the
default notation using %s
On Sunday, 15 April 2018 at 12:04:19 UTC, vladdeSV wrote:
Hello people of D-land.
In a template function, I want to format all arguments as if it
was an array. Se this snippet of code:
foo(1,2,3);
void foo(T...)(T args)
{
writefln("expected: %s", [1,2,3]);
writefl
Hello people of D-land.
In a template function, I want to format all arguments as if it
was an array. Se this snippet of code:
foo(1,2,3);
void foo(T...)(T args)
{
writefln("expected: %s", [1,2,3]);
writefln("actual: %s", args);
}
The code above will output