I would like to print, for debugging purposes, the address of the function pointer stored in my std::function. I can guarantee that the std::function is going to point to a c-style function or a lambda. Is there any way to do this?
Otherwise I am going to have to store the function pointer in memory when it is added and modify all the lambdas.
I have attempted to use the answer here https://stackoverflow.com/a/18422878/274249 but it doesn’t seem to work.
Some example code:
std::function<void()> func = commands.front();
void * fp = get_fn_ptr<0>(func);
void * bb = &glBindBuffer;
printf("bb is %x\n", bb); // Outputs 5503dfe0
printf("fp is %x\n", fp); // Should be the same as above, but outputs 4f9680