C++ 什么是C++;模板问题是否与此错误有关?

C++ 什么是C++;模板问题是否与此错误有关?,c++,templates,compiler-errors,botan,C++,Templates,Compiler Errors,Botan,在Botan v1.8.8上运行gcc v3.4.6,在成功构建Botan并运行其自检后,构建我的应用程序时出现以下编译时错误: ../../src/Botan-1.8.8/build/include/botan/secmem.h: In member function `Botan::MemoryVector<T>& Botan::MemoryVector<T>::operator=(const Botan::MemoryRegion<T>&

在Botan v1.8.8上运行gcc v3.4.6,在成功构建Botan并运行其自检后,构建我的应用程序时出现以下编译时错误:

../../src/Botan-1.8.8/build/include/botan/secmem.h: In member function `Botan::MemoryVector<T>& Botan::MemoryVector<T>::operator=(const Botan::MemoryRegion<T>&)':
../../src/Botan-1.8.8/build/include/botan/secmem.h:310: error: missing template arguments before '(' token
。/../src/Botan-1.8.8/build/include/Botan/secmem.h:在成员函数“Botan::MemoryVector&Botan::MemoryVector::operator=(const-Botan::MemoryRegion&)”中:
../../src/Botan-1.8.8/build/include/Botan/secmem.h:310:错误:在“(”标记之前缺少模板参数
这个编译器错误告诉了我什么?下面是secmem.h的一个片段,包括第310行:

[...]
/**
* This class represents variable length buffers that do not
* make use of memory locking.
*/
template<typename T>
class MemoryVector : public MemoryRegion<T>
   {
   public:
      /**
      * Copy the contents of another buffer into this buffer.
      * @param in the buffer to copy the contents from
      * @return a reference to *this
      */
      MemoryVector<T>& operator=(const MemoryRegion<T>& in)
         { if(this != &in) set(in); return (*this); }  // This is line 310!
[...]
[…]
/**
*此类表示不允许使用的可变长度缓冲区
*利用内存锁定。
*/
模板
类MemoryVector:公共MemoryRegion
{
公众:
/**
*将另一个缓冲区的内容复制到此缓冲区中。
*在缓冲区中设置@param以从中复制内容
*@返回对*此的引用
*/
MemoryVector和运算符=(常量MemoryRegion和in)
{if(this!=&in)set(in);return(*this);}//这是第310行!
[...]
将其更改为:

{ if(this != &in) this->set(in); return (*this); } 
我怀疑
set
函数是在基类中定义的?在依赖于模板参数的基类中不会查找非限定名称。因此,在这种情况下,name
set
可能与需要模板参数的
std::set
模板关联


如果您用
this->
限定名称,编译器会被明确告知查看类的作用域,并在查找中包含依赖的基类。

@cleer-1er:您刚刚给了他8分,因为他没有解释您的问题。@sepp2k:True-我暂时忘记了……该死的,约翰是的!我还以为你是个学生?!难道你不想在周六晚上做些别的事情,然后再从老人那里获得积分吗?
:)
+1反正是我的。@sbi我不太适合聚会:)聚会是一件不到10000小时就能掌握的事情。嗯,我同意威廉的观点。(而且,FWIW,我认为吉森也不适合参加聚会。BICBW。)无论如何,如果你碰巧来这里(见个人资料),给我一个提示,你会被邀请和一个脾气暴躁的老人一起喝一杯免费啤酒。
:)
@Wilhelm哦,可怜的书呆子litb需要的远不止这些