Trouble creating a formatted assert wrapper
    Simen Kjaeraas 
    simen.kjaras at gmail.com
       
    Sun Sep  2 11:51:14 PDT 2012
    
    
  
On Sun, 02 Sep 2012 20:46:50 +0200, Peter Alexander  
<peter.alexander.au at gmail.com> wrote:
> On Sunday, 2 September 2012 at 18:23:48 UTC, Simen Kjaeraas wrote:
>> void myAssert(int line = __LINE__, string file = __FILE__,  
>> Args...)(lazy bool condition, lazy Args args) {
>>     if (!condition)
>>     {
>>         writefln("Assertion failed @ %s:%d", file, line);
>>         writefln(args);
>>         exit(1);
>>     }
>> }
>
> Nice. I thought of that, but for some reason I thought that you couldn't  
> have default args before variadic args.
>
tbh, I was unsure myself. Sometimes you should just try. :p
-- 
Simen
    
    
More information about the Digitalmars-d
mailing list