Calling an alias for a Class method in another scope

Steven Schveighoffer schveiguy at yahoo.com
Fri Jun 1 07:36:30 PDT 2012


On Fri, 01 Jun 2012 10:33:07 -0400, d coder <dlang.coder at gmail.com> wrote:

> Steve
>
> One small thing. As you said I might declare a delegate in an alternate
> fashion that is by saying "void delegate() dg;".
>
> But would it be possible to rewrite the following declaration in a way  
> that
> avoids naming foo explicitly. I would just have an alias for foo. I am
> asking this to cover the cases where foo might have a list of arguments  
> and
> I want to create a delegate with the same list of arguments.
>
> typeof(&F.init.foo) dg;

It's possible.  I'm not well versed enough in the traits templates of  
phobos to be able to tell you.

Start looking in std.traits and std.typecons.

There might even be something there that is exactly what you are looking  
for :)

-Steve


More information about the Digitalmars-d mailing list