我在声明模板类时遇到问题。我尝试了许多可读性差且毫无意义的组合。
template <class C, class M >
class BlockCipherGenerator : public KeyGenerator
{
...
private:
M < C > m_cipher;
};
和
template <class C, class M >
class BlockCipherGenerator : public KeyGenerator
{
typedef typename C::value_type CIPHER;
typedef typename M::value_type MODE;
private:
MODE < CIPHER > m_cipher;
};
最佳答案
它是这么说的。
您的模板参数列表显示 M
is a class
, not a template
.
如果你说它是一个类模板,then everything's fine :
template <class C, template <class C> class M>
class BlockCipherGenerator : public KeyGenerator
{
M<C> m_cipher;
};
记住,像 std::vector
不是一个类,而是一个类模板。像 std::vector<int>
是一个类(类型)。
关于c++ - “X 不是模板”错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6970219/