I got segmentation fault for following code.
#include <iostream>
#include <functional>
int add3(int a, int b, int c)
{
return a + b + c;
}
int main() {
int v = 0;
std::function<int(int,int)> fp =
std::bind(add3, std::placeholders::_1, std::placeholders::_2, 30);
int (*ffp)(int,int) = *fp.target<int (*)(int,int)>();
return 0;
}
I need to convert std::function object to C style function pointer.