converting a string function name to an actual function call

mandel oh at no.es
Thu Nov 29 16:02:18 PST 2007


oliver Wrote:

> void insertInTable( char [] name, int function(int) address, inout int function(int) [ char[] ] table) {
>     table[ name ] = address;
> }
[..]
>     insertInTable("f1", &f1, funcAddressTable);
>     insertInTable("f2", &f2, funcAddressTable);
As a side note.
You can also write:
void insertInTable(inout int function(int) [ char[] ] table, char [] name, int function(int) address) {
     table[ name ] = address;
}
insertInTable("f1", &f1);
insertInTable("f2", &f2);



More information about the Digitalmars-d-learn mailing list