There have been a couple questions related to how to work around this issue:
I'm not interested in work arounds, I'd just like an explanation of why this doesn't work.
template <typename T>
void foo(T input, function<void(T)> func) { func(input); }
When I make a call like this: foo(13, [](int input){ cout << input; })
I'm assuming that the issue has to do with the fact that the lambda is not of type function<void(int)>
but must be converted to that type. And I'm assuming that such a conversion is not permitted to successfully compile a template.
Could someone get me a reference that affirms this?