テンプレートに関して非常に奇妙な問題が発生しています。エラーが発生しますerror: ‘traits’ is not a template
。サンプルテストプロジェクトで問題を再現できませんでした。しかし、それは私のプロジェクトで起こります(これは私がここに投稿できるよりも大きいです)。
とにかく、以下は私が持っているファイルと使用法です。このエラーがいつ発生するかについて誰かが知っていますか?
私はに次のものを持っています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 {
/* ... */
}
}
}