Using `std::function<void(…)>` to call non-void function
问题 A while ago I used std::function pretty much like this: std::function<void(int)> func = [](int i) -> int { return i; }; Basically, I did this because I wanted to store different function objects in a std::function , but I didn\'t want to restrict the return types of these functions. Since this seemed to work, I went with it. But I\'m not convinced that it is safe to use, and I haven\'t been able to find any documentation on it. Does anyone know whether this usage is legitimate? Or more