Suppose we have the following class function:
struct Entity {}
template <typename Component, typename... Components>
void each(std::function<void(Entity&, Component&, Components&...)> fn) {}
Calling it like below produces the "could not deduce template argument for..." error:
.each<int>([](Entity& e, int& i) {}
However, this works as expected:
std::function<void(Entity&, int&)> x = [](Entity& e, int& i) {}
.each<int>(x);
Straight forward, what's going on here and how to solve this?