I was playing arround with std::function and std::bind and I noticed something unintuitive and I would like to understand it better.
For example:
void fun()
{
}
void hun(std::string)
{
}
int main()
{
function<void(int)> g = &fun; //This fails as it should in my understanding.
function<void(int)> f = std::bind(fun); //This works for reasons unknown to me
function<void(int, std::string)> h = std::bind(hun); //this doesn't work
return 0;
}
How is it possible to bind a function<void(int)>
to a function that is void().
I could then call f(1) and get fun().
I would like to understand how this is done.
Going inside Microsoft Visual Studio 2012's implementation of this got me lost in a sea of unreadable macros. so that is why I ask this question here.