c++11 - Casting function pointer to functor in C++ -


i have function pointer type imported .hpp file. like:

typedef void (*pfn_func)(int i); 

i want create functor of same type:

std::function<pfn_func> 

but doesn't work. don't want solution like

std::function<void(int)> 

because mt function pointer definition more complicated

you this:

std::function<std::remove_pointer<pfn_func>::type> 

removing pointer void (*)(int) gives function type void(int).

for case of general callable, see is possible figure out parameter type , return type of lambda?


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -