Help!

Manu turkeyman at gmail.com
Mon Nov 26 09:11:48 PST 2012


On 26 November 2012 19:06, Manu <turkeyman at gmail.com> wrote:

> On 26 November 2012 18:49, jerro <a at a.com> wrote:
>
>>  How can I fix the template declaration to not error in that case?
>>>
>>
>> If you want to have a template parameter that can be anything, including
>> a a symbol or a built in type, you can use this ugly workaround:
>>
>> template foo(bar...) if(bar.length == 1)
>> {
>>     enum foo = 1;
>> }
>>
>
> Ahhhhh, that explains why 90% of std.traits is written in that super-weird
> way! I always wondered what that was all about.
>
> When you say 'anything' though, does that include alias parameters? Will
> bar[0] be the equivalent of template foo(alias bar) if called with a symbol?
>

Ummm, immediate problem. That interferes with my argument list, inhibits
consecutive parameters. You'll notice my template had 'A' on the end... it
would make for a horrible API if the second arg were to come first in this
case... is that the only option?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121126/d1372855/attachment.html>


More information about the Digitalmars-d mailing list