Parameters of overloaded templated function

frame frame86 at live.com
Tue May 10 01:00:24 UTC 2022


So `__traits(getOverloads)` returns also templated members and 
`__traits(isTemplate)` can select those members. Unfortunately, 
`Parameters!` does not work with the templated member. How can I 
pass a symbol of T or A... to `Parameters!` as desired type 
without instantiating the template?

```d
fun(T, A...)(T arg, string foo, int bar, A args); // some overload
```

Assuming T is just an `int`, I cannot apply this type. The 
compiler is forgetting the actual overload:

```d
template getParams(alias overload) {
   static if (__traits(isTemplate, overload)) {
     alias typed = overload!int // error: fun(...) matches more 
than one template declaration
     alias getParams = Parameters!typed;
   }
}
```


More information about the Digitalmars-d-learn mailing list