How to declare function with the same call signature as another?

Tofu Ninja via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 23 14:14:25 PST 2016


On Sunday, 20 November 2016 at 12:06:15 UTC, Tofu Ninja wrote:
> On Sunday, 20 November 2016 at 11:52:01 UTC, Tofu Ninja wrote:
>> ...
>
> Also does not include function linkage :/

Because of the lack of response, I am going to guess there is no 
way to do this cleanly. Guess I am going to have to break out the 
trusty old mixin to get this working.


Also wtf is this... how does this even make sense?

template make_ref(T){
     static if(is(void delegate(ref T) ftype == delegate) && 
is(ftype P == function))
         alias make_ref = P;
     else static assert(false);
}

void main(){
	import std.stdio;
	writeln(make_ref!int.stringof); // (ref int)
}

What is a (ref int)? A tuple with "ref int" as its only member? 
Since when is ref int a type?


More information about the Digitalmars-d-learn mailing list