#include <array>
#include <functional>
template<typename T, typename ... Args>
auto make_array(T&& t, Args&& ... args) -> std::array<T, sizeof...(Args)+1> {
return {std::forward<T>(t), std::forward<Args>(args)...};
}
int main() {
auto f = [](int i)->int { return i; };
auto f2 = [](int i)->int { return i*2; };
auto arr2 = make_array<std::function<int(int)>>(f, f2);
return 0;
}
有没有办法不在呼叫站点指定模板类型make_array<std::function<int(int)>>
?