Mot*_*Mot 0 c++ parameters std stdarray
我正在尝试制作一个模板函数,使我可以使用std :: array对象作为具有可变数量元素的参数。
例如:
#include <array>
template <class T>
void func(std::array<T,/*varying#ofelems*/> ary){...}
Run Code Online (Sandbox Code Playgroud)
您只需在模板参数中指定元素数。
template<class T, size_t N>
void func(std::array<T, N> arr) {
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
65 次 |
| 最近记录: |