On 26 November 2012 18:49, jerro <span dir="ltr"><<a href="mailto:a@a.com" target="_blank">a@a.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
How can I fix the template declaration to not error in that case?<br>
</blockquote>
<br></div>
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:<br>
<br>
template foo(bar...) if(bar.length == 1)<br>
{<br>
    enum foo = 1;<br>
}<br>
</blockquote></div><br></div><div class="gmail_extra">Ahhhhh, that explains why 90% of std.traits is written in that super-weird way! I always wondered what that was all about.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
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?</div>