Is it possible to use tokens as template parameters?
evilrat
evilrat666 at gmail.com
Sat Aug 14 14:52:09 UTC 2021
On Saturday, 14 August 2021 at 13:50:52 UTC, rempas wrote:
>
> The behavior I want to achieve is not having to enclose the
> word (tokens) in double quotes.
Then it is not possible. D is strictly hygienic in that regard.
You either use explicit mixin or string paramter.
It is possible to have it with alias by using std.meta
```Alias!"name_here"``` or similar short template like below, but
both has same limitation, there is absolutely no way to get rid
of quotes.
```d
auto t(T) {
enum t = T;
}
writeln("token".t);
```
More information about the Digitalmars-d
mailing list