std.traits.ParameterIdentifierTuple producing empty results.
Nick Treleaven
nick at geany.org
Wed Apr 3 10:13:56 UTC 2024
On Tuesday, 2 April 2024 at 00:28:50 UTC, Carl Sturtivant wrote:
> I looked into `is()` with `__parameters` and the documentation
> is a bit sparse, however eventually I found that I could
> extract the parameter names without CTFE provided I avoided
> stripping them out through instantiating a template with them
I realized there's another way, inspired by your `extern
FunctionType` idea:
```d
import std.traits;
void foo(int i, char c);
void main()
{
pragma(msg, ParameterIdentifierTuple!foo); // i, c
alias Foo = typeof(foo);
pragma(msg, ParameterIdentifierTuple!Foo); // no identifiers
static if (is(Foo PS == __parameters))
void f(PS);
pragma(msg, ParameterIdentifierTuple!f); // i, c
}
```
More information about the Digitalmars-d
mailing list