Relax template sequence parameters, explicit template sequence arguments
monkyyy
crazymonkyyy at gmail.com
Thu Feb 20 05:56:11 UTC 2025
On Thursday, 20 February 2025 at 03:46:08 UTC, Quirin Schroll
wrote:
> Template sequence parameters (`Ts...`) must be the last
> parameter of a template. That also means one can only have one
> of them per template.
```d
template foo(T...){
template foo(S...){
void foo(U...)(){
T.stringof.writeln;
S.stringof.writeln;
U.stringof.writeln;
}}}
unittest{
alias a=foo!(int,float);
alias b=a!bool;
b!(1);
}
```
If the "multi template argument" thing was removed it would just
work
---
> Other use case: Make it hard to pass certain arguments
> void f(Ts..., size_t line = __LINE__)(Ts args) { pragma(msg,
> line); }
Should just remove the restriction that ... must come last
```
void foo(T...,A...,R)(R r,A args,int line=__LINE__){...}
buzz.foo!(bar,fizz)(1,2,3);// r=buzz,T=bar,fizz,args=1,2,3
```
More information about the dip.ideas
mailing list