[core.reflect] TemplateInstance reflection
jmh530
john.michael.hall at gmail.com
Mon Oct 4 11:54:09 UTC 2021
On Thursday, 30 September 2021 at 22:19:33 UTC, Stefan Koch wrote:
> [snip]
In the code below you can only get the target of the alias, such
as int and float. Would it be possible to use core.reflect or
something similar, to be able to get back Foo or Foo!int?
```d
template Foo(T)
{
static if(is(T == int))
alias Foo = int;
else
alias Foo = float;
}
void main() {
Foo!int x;
Foo!double y;
static assert(is(typeof(x) == int));
static assert(is(typeof(y) == float));
}
```
More information about the Digitalmars-d
mailing list