On Thursday, 25 April 2019 at 23:41:32 UTC, Suleyman wrote:
Hello everyone,
I am happy to announce that in the next DMD release you will be
able to more freely enjoy your metaprograming experience now
that a long-standing limitation has been lifted.
You can now instantiate local and member templates with local
symbols.
Example:
---
struct S
{
private int _m;
void exec(alias fun)()
{
fun(_m);
}
}
unittest
{
int localVar;
void set(int i)
{
localVar = i;
}
auto obj = S(10);
obj.exec!set(); // no error or warning
assert(localVar == 10);
}
---
I hope you enjoy!
Noice! Finally indeed. thank you! :D