<div dir="ltr">On 6 July 2013 22:27, Namespace <span dir="ltr"><<a href="mailto:rswhite4@googlemail.com" target="_blank">rswhite4@googlemail.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"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
The way that makes the most sense to me is:<br>
<br>
void f(T)(Unqual!T t) {}<br>
<br></div><div class="im">
Given an immutable(T) for instance that I want to call with, it would<br>
instantiate the template with the signature void f(T), and then attempt to<br>
call it with the immutable(T). If immutable(T) is not convertible to the<br>
argument T, then it would produce a compile error as if attempting to call<br>
any such function that just receives T.<br>
<br>
The point here is that I want more control over the signature of the<br>
instantiated template (reduce the number of permutations generated for<br>
various calls). Template blow-out is perhaps the biggest and most well<br>
known day-to-day problem in C++, and tools like this may be very valuable<br>
to mitigate the disaster.<br>
</div></blockquote>
<br>
It seems that your code works if you put the Template Type explicit:<br>
----<br>
import std.stdio;<br>
import std.traits : Unqual;<br>
<br>
void foo(T)(Unqual!T a) {<br>
        writeln(typeof(a).stringof, " <-> ", T.stringof);<br>
}<br>
<br>
void main() {<br>
        int a;<br>
        const int b;<br>
        immutable int c;<br>
<br>
        //foo(c); /// Error<br>
        foo!(typeof(a))(a);<br>
        foo!(typeof(b))(b);<br>
        foo!(typeof(c))(c);<br>
}<br>
----<br>
</blockquote></div><br></div><div class="gmail_extra" style>Indeed, hence my point that the type deduction is the key issue here.</div><div class="gmail_extra" style>It should be possible... maybe a bit tricky though.</div>
</div>