<div><div class="gmail_quote">On Sat, Jun 22, 2013 at 4:18 PM, anonymous <span dir="ltr"><<a href="mailto:anonymous@example.com" target="_blank">anonymous@example.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Saturday, 22 June 2013 at 23:03:17 UTC, Dicebot wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<a href="http://dpaste.1azy.net/22d5eee2" target="_blank">http://dpaste.1azy.net/<u></u>22d5eee2</a><br>
<br>
------------------------------<u></u>------<br>
<br>
import std.traits;<br>
<br>
template getTemplate(T)<br>
{<br>
        static if (is(T == TI!TP, alias TI, TP))<br>
</blockquote>
<br></div>
alias! Of course!<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
        {<br>
                alias getTemplate = TI;<br>
        }<br>
        else<br>
                static assert (false);<br>
}<br>
</blockquote>
<br></div>
Replacing the static if with template specialization makes it shorter:<br>
template getTemplate(T : TI!TP, alias TI, TP)<br>
{<br>
    alias getTemplate = TI;<br>
}<br>
</blockquote></div><br></div><div>great, thanks!<div>improved to support arbitrary number of a</div><div><div>template getTemplate(T : TI!TP, alias TI, TP...)</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>alias getTemplate = TI;</div>
<div>}</div></div><div><br></div></div><div><br></div><div>however, indeed seems to work with types only, not functions. </div>