Consider some easy code below:
int f1(int a) {
std::cout << a << std::endl;
}
int main (int agrc, char* argv[]) {
std::function<int(int)> f = std::bind(&f1, std::placeholders::_1);
f(123);
return 0;
}
I've read some documents about std::function and std::bind, but still don't understand how does it work.
The compiler shows that call of std::bind returns an object of type _Bind_helper, however, I don't see the std::function class has a construction function with input type _Bind_helper, so how does the std::function xxx = std::bind xxx work?