Eponymous/anonymous mixin templates

Artur Skawina via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 7 07:17:31 PDT 2015


On 06/07/15 11:05, Jeffrey Tsang via Digitalmars-d wrote:
> I use a mixin template to define exactly one symbol, and at instantiation I wish to use that symbol immediately, once.

AFAICT you're asking for the commented-out line in

   auto Tmpl() = l;

   void main(string[] argv) {
      auto l = argv.length;
      mixin Tmpl!() a;
      assert(a.Tmpl==l);
      //assert(a==l);
   }

to work. That would probably be enough, make sense and have
no serious backward compat issues.

artur



More information about the Digitalmars-d mailing list