Another, perhaps more effective option is to use a macro to create code for you:
#define DO_N(name, ...) for(int i = 0; i < big; i++){name(__VA_ARGS__);} if (condition1) { DO_N(do1, ...) } else if (condition 2) { DO_N(do2, ...) } else { DO_N(do3, ...) } #undef DO_N
Its ugly, but I think it does what you want and can allow embedding where there is no function pointer.
Additionally, you may find it more readable to put your shared code in a separate macro or function.
Straw1239
source share