【发布时间】:2011-03-04 09:56:01
【问题描述】:
template<typename T>
class CConstraint
{
public:
CConstraint()
{
}
virtual ~CConstraint()
{
}
template <typename TL>
void Verify(int position, int constraints[])
{
}
template <>
void Verify<int>(int, int[])
{
}
};
在 g++ 下编译会出现以下错误:
非命名空间范围'class CConstraint'中的显式特化
在 VC 中,它编译得很好。谁能告诉我解决方法?
【问题讨论】:
-
请注意,这在 C++17 中不再是问题。见stackoverflow.com/questions/49707184/…