Wrap a call?

JN 666total at wp.pl
Wed Feb 18 19:43:38 UTC 2026


     import std;

     void before()
     {
         writeln("Before");
     }

     void after()
     {
         writeln("After");
     }

     void add(int x, int y)
     {
         writeln(x + y);
     }

     template WrapCall(string call)
     {
         enum WrapCall = "before(); " ~ call ~ "; after();";
     }

     void main()
     {
         mixin WrapCall!"add(1, 2)";
     }

This doesn't work, if I change it to mixin(WrapCall!"add(1, 2")), 
it works, why?


More information about the Digitalmars-d-learn mailing list