2
#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)>>
處指定模板類型?std :: array和lambda