How can you call a stored function in an AA with proper number of arguments converted to the proper type?

Zekereth via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 12 11:07:03 PDT 2016


On Tuesday, 12 July 2016 at 08:34:03 UTC, Kagamin wrote:
> Store a wrapper instead of the actual function:
> void wrapper(alias F)(string[] args)
> {
>   (convert args to F arguments) and invoke
> }
>
> cmd.func = &wrapper!someFunc;
>
> string[] args;
> cmd.func(args);

Thanks that is clever. Never would have thought of that. Thanks a 
lot!


More information about the Digitalmars-d-learn mailing list