Passing around a list of differently typed functions

Tobias Pankrath via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 22 23:26:34 PDT 2014


On Monday, 23 June 2014 at 01:16:49 UTC, Evan Davis wrote:
> As the subject says, I would like to pass around an array of 
> functions. The trick is, that the functions have different type 
> signatures. Is there a way to put the two functions
>
> int foo(int a, int b);
> bool bar(bool a, bool b);
>
> into one array, that I can pass around and cast as necessary?
>
> Thanks, Evan

Use void* as a common type or use std.variant.


More information about the Digitalmars-d-learn mailing list