I was playing with C++ lambdas and their implicit conversion to function pointers. My starting example was using them as callback for the ftw function. This works as expecte
Found an answer here: http://meh.schizofreni.co/programming/magic/2013/01/23/function-pointer-from-lambda.html
It converts lambda pointer
to void*
and convert back when needed.
to void*
:
auto voidfunction = new decltype(to_function(lambda))(to_function(lambda));
from void*
:
auto function = static_cast< std::function*>( voidfunction);