[Issue 19299] string mixins and template mixins should be allowed in function parameter list
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 31 11:59:10 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=19299
Nick Treleaven <nick at geany.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nick at geany.org
--- Comment #1 from Nick Treleaven <nick at geany.org> ---
Just to mention, you can copy parameters like this:
```d
// simpler version of std.traits.Parameters (which also works)
template Params(alias func)
{
static if (is(typeof(func) PS == __parameters))
alias Params = PS;
}
void f(Params!g, int extra);
void g(char c = 0, byte b);
pragma(msg, typeof(f));
```
If you need just one parameter, use slicing `PS[i..i+1]` rather than indexing
and it will preserve not just the type but the identifier and default argument
too.
--
More information about the Digitalmars-d-bugs
mailing list