Using arrays of function pointers in D
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu May 21 09:25:23 PDT 2015
Start with a function type declaration:
void function() func_ptr;
Then make an array out of it:
void function()[] func_ptr_array;
It works like other arrays, just the [] might be a little harder
to see since it is a much longer type signature. But it is still
in there, right after it, similarly to int[].
Then the array is indexed and set like normal. You can change
length on it (auto initializes all members to null), ~= &my_func
to append, etc.
You can also do associative arrays of function pointers btw.
More information about the Digitalmars-d-learn
mailing list