作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<分区>
using
类模板就像一个魅力
template<class T,int N>
struct VecNT{ T arr[N]; };
using Vec5d = VecNT<double,5>; // doing great job!
但它似乎根本不适用于函数
template<class T,int N>
T sumNT(T* xs){ T sum=0; for(int i=0;i<N;i++){sum+=xs[i];}; return sum; };
using sum5d = sumNT<double,5>;
// ERROR: sumNT<double,5> does not name a type
using sum5d(double* xs) = sumNT<double,5>(T* xs);
// ERROR: expected nest-name-specifier before 'sum5d'
那么如何制作sum5d
作为 sumNT<double,5>
的专用/实例化别名?
我是一名优秀的程序员,十分优秀!