Re: Variadic function template with one inferred template argument

2020-11-07 Thread Ben Jones via Digitalmars-d-learn
On Saturday, 7 November 2020 at 21:04:19 UTC, starcanopy wrote: void main() { f!(int, float, char)("Hello, world!"); } https://run.dlang.io/is/e8FGrF Ah, I had discovered a different error when I tried that. Thanks!

Re: Variadic function template with one inferred template argument

2020-11-07 Thread starcanopy via Digitalmars-d-learn
On Saturday, 7 November 2020 at 20:43:04 UTC, Ben Jones wrote: I'm trying to write a function template with 1 parameter whose type is inferred, but with the other parameters variadic. Basically, I want to do this: auto f(Ts..., Inferred)(Inferred inf){} and call it with f!(X,Y,Z)(w)

Variadic function template with one inferred template argument

2020-11-07 Thread Ben Jones via Digitalmars-d-learn
I'm trying to write a function template with 1 parameter whose type is inferred, but with the other parameters variadic. Basically, I want to do this: auto f(Ts..., Inferred)(Inferred inf){} and call it with f!(X,Y,Z)(w) //inferred will be typeof(w), Ts... == (X, Y, Z) which I can't do