www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - how to print the tested-condition in myAsssert -- stringification

I'm using the myAssert() suggested by others in the D forum, with 
a few tweaks:

void myAssert(int line = __LINE__, string file = __FILE__, 
Args...)(lazy bool condition, lazy Args args) {

   string string_version_of_condition = //? how?
   if (!condition)
     {
       writefln("Assertion (%s) failed   %s:%d in test '%s'",
       string_version_of_condition, file, line, currentTestName);
       foreach(a; args) {
         write("   assert-extra: ");
         writeln(a);
       }
       exit(1);
     }
   }
}

This is great, but I would also like to print out the stringified 
version of the condition, so that the assert shows me the text of 
the failed test-condition.

e.g.

myAssert(1 == 0);

// should result in:

Assertion (1 == 0) failed   test.d:34 in test 'bool test'

How to I initialize string_version_of_condition?  In C/C++, I'd 
use a macro and token pasting.
Aug 30 2013