static foreach and new identifier names

Meta jared771 at gmail.com
Fri Jan 5 23:50:52 UTC 2018


On Friday, 5 January 2018 at 17:41:23 UTC, Adam D. Ruppe wrote:
> Make a special identifier known the compiler, let's call it 
> `__unique_name` which is unique for any static foreach 
> iteration.

You can emulate it by abusing the compiler-generated random names 
for lambdas:

enum uniqueName(string cookie = {}.stringof) = cookie;


More information about the Digitalmars-d mailing list