What is the shortest way to define an immutable token of unique type?

Per Nordlöw per.nordlow at gmail.com
Mon Mar 15 21:47:34 UTC 2021


On Monday, 15 March 2021 at 20:07:53 UTC, Timon Gehr wrote:
> Not sure about simple or non-arcane, but this works:
>
> immutable typeof(new class{}) hex;

Nice. Would be interesting to list use cases for this in the docs.

Moreover

      typeof(new class{})

is

     __anonclass1

so, for conformity,

     typeof(struct {})

should be allowed and be

     __anonstruct1


More information about the Digitalmars-d mailing list