Review: A new stab at a potential std.unittests

Leandro Lucarella luca at llucax.com.ar
Fri Nov 19 16:13:28 PST 2010


Jonathan M Davis, el 19 de noviembre a las 13:24 me escribiste:
> On Friday 19 November 2010 12:39:20 Leandro Lucarella wrote:
> > Sean Kelly, el 19 de noviembre a las 14:59 me escribiste:
> > > Jonathan M Davis Wrote:
> > > > On Friday, November 19, 2010 11:37:16 Sean Kelly wrote:
> > > > > Jonathan M Davis Wrote:
> > > > > > In particular, needing to pass LineInfo() to assertExcThrown!() to
> > > > > > know the file and line number was disliked (though it was by far
> > > > > > the best solution that I'd been able to come up with).
> > > > > 
> > > > > Not sure if this helps, but if you default-initialize template
> > > > > function parameters with __LINE__ and __FILE__ they get the line and
> > > > > file of where the template was instantiated.
> > > > 
> > > > Yes. The problem was that the function was a _variadic_ template. So,
> > > > you couldn't have default arguments.
> > > 
> > > This should work:
> > > 
> > > void func(string x = __FILE__, T...)(T args);
> > > 
> > > D allows defaulted template arguments to occur before non-defaulted ones.
> > 
> > And what is func!("blah")(); is supposed to do, make x = "blah"? args[0]
> > = "blah"? both?
> > 
> > (I don't have a compiler at hand to try it =P)
> 
> T... is filled in be args, so if there are no args, T is empty. It can't confuse 
> x for T...

Good point, thanks for the clarification.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Sometimes you got to suffer a little in your youth to motivate you to
succeed later in life. Do you think if Bill Gates got laid in high
school, do you think there'd be a Microsoft? Of course not. You gotta
spend a lot of time stuffin your own locker with your underwear wedged
up your arse before you think "I'm gona take over the world with
computers! You'll see I'll show them."


More information about the Digitalmars-d mailing list