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

rdbms - what exactly the undo information lives in oracle? -

bash - How do you programmatically add a bats test? -

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