Typesafe variadics in any position

Steven Schveighoffer schveiguy at yahoo.com
Tue Feb 26 15:01:28 PST 2013


On Tue, 26 Feb 2013 17:29:10 -0500, H. S. Teoh <hsteoh at quickfur.ath.cx>  
wrote:

> On Tue, Feb 26, 2013 at 05:16:29PM -0500, Steven Schveighoffer wrote:
>> On Tue, 26 Feb 2013 17:04:40 -0500, timotheecour
>> <thelastmammoth at gmail.com> wrote:
>>
>> >I proposed this a few weeks ago, but nobody gave feedback. This
>> >would enable it without worrying about special cases.
>> >
>> >http://forum.dlang.org/thread/miqtvuufvlwgfzblexxp@forum.dlang.org
>> >feature request: special optional argument (__FILE__, ...) AFTER
>> >variadic template.
>>
>> I think this is a different problem, the issue I'm talking about is
>> typesafe variadics, not variadic templates.
>>
>> >Please let me know what you think!
>>
>> Doesn't this work?
>>
>> foo(string filename=__FILE__, T...)(T args)
> [...]
>
> It should work, except that you'll have template bloat (not as bad as
> putting __line__ in the compile-time arguments though!)

Well, not too bad.  The template can be a wrapper call, and would likely  
be inlined.

But the symbol bloat would suck...

-Steve


More information about the Digitalmars-d mailing list