<div dir="ltr">On 7 July 2013 22:31, Dmitry Olshansky <span dir="ltr"><<a href="mailto:dmitry.olsh@gmail.com" target="_blank">dmitry.olsh@gmail.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">06-Jul-2013 05:34, Manu пишет:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Okay, so I feel like this should be possible, but I can't make it work...<br>
I want to use template deduction to deduce the argument type, but I want<br>
the function arg to be Unqual!T of the deduced type, rather than the<br>
verbatim type of the argument given.<br>
<br></div><div class="im">
I've tried: void f(T : Unqual!U, U)(T a) {}<br>
and: void f(T)(Unqual!T a) {}<br>
</div></blockquote>
<br>
The thing is that if even if you somehow force your way past IFTI what would be generated is:<br>
<br>
f!(const int)(int arg);<br>
f!(immutable int)(int arg);<br>
f!(shared int)(int arg);<br>
f!(const shared int)(int arg);<br>
<br>
Which IMHO falls short of desired goal.<br>
Short of using a forwarding thunk (that you don't like, but if there was force_inline?) we'd have to hack the compiler.</blockquote><div><br></div><div style>Hmmm, this is an interesting point.</div><div style>I initially thought this was desirable, it could be useful.</div>
<div style>But now that you point it out, I guess the point you are making is that they will all mangle separately anyway?</div><div style>That seems problematic, because since all have the same return value and physical arguments, how does the compiler choose an overload to call in various circumstances?</div>
<div style>I think I (mistakenly?) presumed they would all mangle the same, since they have the same physical signature (return value + physical args), and therefore all be the same function (eliminating the duplicates).</div>
</div></div></div>