4

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

このコンパイラ エラーは何を教えてくれますか? 以下は、310 行を含む secmem.h のスニペットです。

[...]
/**
* 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!
[...]
4

1 に答える 1

9

これを次のように変更します。

{ if(this != &in) this->set(in); return (*this); } 

set関数が基本クラスで定義されていると思われますか? 非修飾名は、テンプレート パラメーターに依存する基本クラスでは検索されません。したがって、この場合、名前はおそらくテンプレート引数を必要とsetするテンプレートに関連付けられています。std::set

名前を で修飾するとthis->、コンパイラはクラスのスコープを調べるように明示的に指示され、そのルックアップに依存する基本クラスが含まれます。

于 2010-05-15T20:38:31.933 に答える