I have a series of functions which are differently defined based upon 3 integers. I'd like to use the variable values in the function name. This can be achieved using if-else statements:
if (i == 0 and j == 0 and t == 0) {
return E_0_0_0(args);
}
else if (i == 1 and j == 0 and t == 0) {
return E_1_0_0(args);
}
...
The problem with this is that there are a large number of these possibilities and this part of the program is very time-sensitive. Can I use anything to call a function E_i_j_t(args)
using custom values for i, j, t
based on the variables? I have looked into preprocessor statements but got a bit lost.
Aucun commentaire:
Enregistrer un commentaire