Hi,

I want to know if there is a way to pass variadic arguments as reference? DMD says no!

I wrote the snippet code below, but what I want to do in fact is assign the sum back to respective variables to use somewhere else.

http://dpaste.dzfl.pl/515edfb8

or

import std.stdio;
import std.conv;

void sum(double value, in double[] numbers ...){
        foreach(num; numbers)
                writeln(num+value);
}

void main(){
        auto a = 1, b = 2, c = 3;
        sum(10, a, b, c);
        
        writeln("a = "~to!string(a),
                        "\nb = "~to!string(b),
                        "\nc = "~to!string(c));
}

Thanks,

Matheus.

Reply via email to