template<int, int>
struct T;
template<>
struct T<?, ?> {};
我想让它工作
typedef T<1, 0> t;
这会导致编译时错误
typedef T<1, 2> t;
编辑,我的意思是我希望第二个参数为 0。我不能使用 C++11 功能。
最佳答案
你的问题不是很清楚。你在找这个吗?
template <int, int>
struct T;
template<int x>
struct T<x, 0>
{
// Definition of the struct for the allowed case
};
关于c++ - 我可以为并非所有非类型参数部分指定模板吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17830989/