Variadic functions: How to pass another variadic function the variadic args?
Ali Çehreli
acehreli at yahoo.com
Sat Aug 3 08:10:20 PDT 2013
On 08/03/2013 07:58 AM, bearophile wrote:
> Gabi:
>
>> //HOW TO pass F1(..) the args we were called with ?
>
>
> import std.stdio;
>
> void f1(Args...)(Args args) {
> foreach (arg; args)
> arg.writeln;
Would you expect the following two lines behave the same?
writeln(args);
writefln("%s", args);
Apparently not:
10hello1.5
10
Why?
> }
>
> void f2(Args...)(Args args) {
> f1(args);
> }
>
> void main() {
> f2(10, "hello", 1.5);
> }
>
>
> Bye,
> bearophile
Ali
More information about the Digitalmars-d-learn
mailing list