Is it possible to filter variadics?

maik klein via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 3 15:41:08 PST 2015


Is it possible to filter variadics for example if I would call

void printSumIntFloats(Ts...)(Ts ts){...}

printSumIntFloats(1,1.0f,2,2.0f);

I want to print the sum of all integers and the sum of all floats.


//Pseudo code
void printSumIntFloats(Ts...)(Ts ts){
     auto sumOfInts = ts
                       .filter!(isInteger)
                       .reduce(a => a + b);
     writeln(sumOfInts);
     ...
}

Is something like this possible?



More information about the Digitalmars-d-learn mailing list