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 -

c# - How do I get the Nth largest element from a list with duplicates, using LINQ? -

jsp - "Sending a redirect is forbidden after the response has been committed" in sendRedirect -