Consider this template function:
template
ReturnT foo(const std::function& fun)
{
return fun();
}
>
The function bar
is of type bool (*)()
or so, that is: a normal pre-C++11 function type. I'm not that confident in C++11, but I guess the compiler does not see the connection between bool (*)()
and const std::function
, even when the first can be implicitly converted into the second for ReturnT = bool
.