delegates and functions

OlegZ black80 at bk.ru
Sat Jun 9 20:03:15 UTC 2018


I want "int delegate( string )", but hz most probably is "int 
function( string )"
> auto hz = (string s) => { writeln( s ); return cast( int 
> )s.length; };
but
pragma (msg, typeid( (string s) => { writeln( s ); return cast( 
int )s.length; }));
shows
> typeid( int delegate() @safe function(string s) pure nothrow 
> @safe )
Why my lambda is function(string) that returns int delegate()?
How I should to write lambda of type "int function( string )"?
And how I should to write lambda of type "int delegate( string )"?


More information about the Digitalmars-d-learn mailing list