In this question, the OP claims that the third line in the main
function is casting the return value of std::bind
to std::function
.
However, it looks like a simple constructor call to me.
Is there a legitimate way to actually cast the return value of std::bind
to std::function
without constructing a new object?
Alternately, is it kosher (not undefined behavior) to cast the the address of a return value of std::bind
to std::function*
and then invoke it by deferencing it?
Assume I know the appropriate template parameters for std::function
. That is, assume they are the same template parameters which would have been used if we were constructing an instance of std::function
from the return value of std::bind
.