Wil*_*mKF 4 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>&)':
../../src/Botan-1.8.8/build/include/botan/secmem.h:310: error: missing template arguments before '(' token
Run Code Online (Sandbox Code Playgroud)
这个编译器错误告诉我什么?这是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!
[...]
Run Code Online (Sandbox Code Playgroud)
Joh*_*itb 10
把它改成这个:
{ if(this != &in) this->set(in); return (*this); }
Run Code Online (Sandbox Code Playgroud)
我怀疑该set
函数是在基类中定义的?不依赖于模板参数的基类中不会查找非限定名称.因此,在这种情况下,名称set
可能与std::set
需要模板参数的模板相关联.
如果使用限定名称this->
,则会明确告知编译器查看类的范围,并在该查找中包含依赖的基类.
归档时间: |
|
查看次数: |
767 次 |
最近记录: |