Re: Is it possible to filter variadics?

2015-11-04 Thread maik klein via Digitalmars-d-learn
On Wednesday, 4 November 2015 at 06:20:30 UTC, Jakob Ovrum wrote: On Tuesday, 3 November 2015 at 23:41:10 UTC, maik klein wrote: [...] import std.algorithm.iteration : sum; import std.meta : allSatisfy, Filter; import std.traits; import std.typecons : tuple; import std.range : only; // These

Re: Is it possible to filter variadics?

2015-11-04 Thread Jakob Ovrum via Digitalmars-d-learn
On Wednesday, 4 November 2015 at 09:48:40 UTC, maik klein wrote: Thanks, that is exactly what I wanted to achieve. What is the performance implication of 'only' in this context? Will it copy all arguments? Yes, it will, but just from the stack to a different location on stack.

Is it possible to filter variadics?

2015-11-03 Thread maik klein via Digitalmars-d-learn
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

Re: Is it possible to filter variadics?

2015-11-03 Thread TheFlyingFiddle via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 23:41:10 UTC, maik klein wrote: 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

Re: Is it possible to filter variadics?

2015-11-03 Thread Jakob Ovrum via Digitalmars-d-learn
On Tuesday, 3 November 2015 at 23:41:10 UTC, maik klein wrote: 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