以下代码给了我一个编译错误:class Q64 is not a valid type for a template constant parameter
template<int GRIDD, class T>
INLINE T grid_residue(T amount) {
T rem = amount%(GRIDD);
if (rem > GRIDD/2) rem -= GRIDD;
return rem;
}
template<int GRIDD, Q64>
INLINE Q64 grid_residue(Q64 amount) {
return Q64(grid_residue<GRIDD, int64_t>(to_int(amount)));
}
怎么了?我正在尝试专攻grid_residue
课程Q64
。
更新:
改变了语法。现在出现错误error: function template partial specialization 'grid_residue<GRIDD, Q64>' is not allowed
template<int GRIDD>
INLINE Q64 grid_residue(Q64 amount) {
return Q64(grid_residue<GRIDD, int>(to_int(amount)));
}
谢谢