【发布时间】:2018-03-10 22:30:18
【问题描述】:
下面的模板如何实现?
std::result_of 不能那样工作。
我希望能够在外部通过其他方式更改 std::vector
我想将F 和V 保留在我的模板中
在 C++17 中首选
谢谢
template <typename F, typename V=vector<result_of<F>>, typename T, typename Ts ...>
auto call (F f, const T & t, const Ts & ... ts) {
V v; // v is a container for values returned from f
f(....); // f is a funtion
....
return v;
}
【问题讨论】:
-
函数怎么调用?这很重要
标签: c++ templates variadic-templates c++17