There's ParameterStorageClassTuple, which can say if it's a pointer-type parameter (ref and out) or it's a delegate-type parameter (lazy). By analyzing the storage classes of the parameters, one can transform T to T* or T delegate() as necessary.<div>
<br></div><div>Indeed I did precisely this, when I wrote a function parameter tuple encapsulator. It's a template, which takes a function signature and returns a structure, which has an appropriate member for each parameter (taking into account ref, out and lazy) and can call functions of that signature by passing the stored parameters.</div>
<div><br></div><div><br><div class="gmail_quote">On Tue, May 15, 2012 at 5:28 PM, Andrei Alexandrescu <span dir="ltr"><<a href="mailto:SeeWebsiteForEmail@erdani.org" target="_blank">SeeWebsiteForEmail@erdani.org</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 5/15/12 8:16 AM, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Okay, here's another problem due to ref not being a type constructor.<br>
If I have some function that receives an argument by ref, and then I<br>
take parameterTypeTuple! of that functions parameter list, the ref bits<br>
are gone from the typetuple.<br>
If I give that tuple as a template arg, then the template parameters no<br>
longer match the function it's wrapping...<br>
</blockquote>
<br></div>
Correct. That means there needs to be an additional trait that tells which parameters of a function are ref.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
I'm still thinking more and more that there's no solution to all the<br>
problems with ref, other than changing it to use the syntax: ref(type),<br>
and be a type constructor, like const/immutable/shared/etc...<br>
I have problems with ref almost every day. If not in templates, in<br></div>
function/delegate definitions, and the prior issues previously discussed..<div class="im"><br>
<br>
No matter how I look at it, 'ref' really should be a type constructor.<br>
</div></blockquote>
<br>
Ref on a parameter or the return value is a property of the function, not a property of the parameter.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The use of 'ref' fundamentally changes the variable from T to T*, that's<br>
a critical difference, and can't just be lost when taking the typeof<br>
something.<br>
</blockquote>
<br></div>
Ref int is not int*, for example you can do x[0 .. 1] on a pointer but not on a reference. Ref fundamentally dictates how the parameter binds to the argument; otherwise, it doesn't affect the behavior of the parameter's type itself.<br>

<br>
To lift this one level up, what problem are you trying to solve?<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
Andrei<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Bye,<br>Gor Gyolchanyan.<br>
</div>