How to declare an alias to a function literal type

Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 12 08:00:37 PST 2016


V Tue, 12 Jan 2016 15:41:02 +0000
ParticlePeter via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> napsáno:

> I have a function type and variable and assign a function to it:
> 
> void function( int i ) myFunc;
> myFunc = void function( int i ) { myCode; }
> 
> How would I declare an alias for void function( int i ) such that 
> the case above would work like this:
> 
> // alias MF = void function( int i );  // not working
> // alias void function( int i ) MF;  // not working
> 
> MF myFunc;
> myFunc = MF { myCode };
> 
> Please, if possible, also show me where I should have found the 
> answer (D Reference, Alis book, etc. )

alias void MF(int i);



More information about the Digitalmars-d-learn mailing list