2
我有一个模板很奇怪的问题。获取错误error: ‘traits’ is not a template
。我无法在示例测试项目上重现此问题。但它发生在我的项目上(这比我可以在这里发布的要大)。错误:'性状'不是模板 - C++
无论如何,以下是我的文件和用法。任何人有任何关于何时发生此错误的想法?
我在traits.hpp
以下。
namespace silc
{
template<class U>
struct traits<U>
{
typedef const U& const_reference;
};
template<class U>
struct traits<U*>
{
typedef const U* const_reference;
};
}
这用于另一个头文件。
namespace silc {
template<typename T>
class node {
public:
typedef typename traits<T>::const_reference const_reference;
const_reference value() const {
/* ... */
}
}
}
谢谢。那是我犯过的一个愚蠢的错误。再次感谢您指出。 – 2010-02-21 06:12:11