parameter pack to inputRange

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 5 22:20:50 PDT 2016


On 05/05/2016 10:00 PM, Erik Smith wrote:
> Is there an existing way to adapt a parameter pack to an input range? I
> would like to construct an array with it.  Example:
>
> void run(A...) (A args) {
>       Array!int a(toInputRange(args));
> }
>

Just initialize an array with the arguments:

void run(A...) (A args) {
     writeln([args]);
}

Ali



More information about the Digitalmars-d-learn mailing list