Constructor template -- bug?

Jonathan M Davis jmdavisProg at gmx.com
Wed Mar 2 00:33:02 PST 2011


On Wednesday 02 March 2011 00:14:55 Bekenn wrote:
> On 3/1/2011 11:47 PM, Jonathan M Davis wrote:
> > I should also point out that there is absolutely no need to use template
> > for what you're trying to do. Just declare the constructor like so:
> > 
> > this(string message, string file = __FILE__, size_t line = __LINE__
> > Throwable next = null) { ... }
> 
> You are absolutely right; silly me.  I'd assumed that would pick up the
> file and line at the point of declaration...

I think that it works that way in C/C++, but it doesn't work that way in D. 
Actually, I had to point it out to Andrei at one point after he pointed out that 
it wouldn't work when I did it in some code he was reviewing. But I've tested 
it, and it definitely works.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list