Exactly Replicating a Function's Signature?

Jacob Carlborg doob at me.com
Wed Jan 19 08:17:41 PST 2011


On 2011-01-19 16:29, Andrej Mitrovic wrote:
> Is this what you're looking for?:
>
> import std.stdio;
> import std.traits;
>
> void test(alias F)()
> {
>      ReturnType!(F) otherFunc(ParameterTypeTuple!(F))
>      {
>          typeof(return) result;
>          return result;
>      }
> }
>
> double foo(int x, int y)
> {
>      double result;
>      return x + y * 2.5;
> }
>
> void main()
> {
>      test!foo;
> }

Will that keep: ref, out, inout and so on in the signature ?

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list