delegates and functions

OlegZ black80 at bk.ru
Sat Jun 9 20:39:05 UTC 2018


On Saturday, 9 June 2018 at 20:03:15 UTC, OlegZ wrote:

>> auto hz = (string s) => { writeln( s ); return cast( int 
>> )s.length; }
> How I should to write lambda of type "int delegate( string )?

I found one way:
> auto hz = delegate int( string s ) { writeln( s ); return cast( 
> int )s.length; };

but still don't understand why
> return cast( int )s.length;
at topmost line returns "int delegate()" not just int?


More information about the Digitalmars-d-learn mailing list