我剛剛發佈了一個skiplist容器庫。和Sun編譯器抱怨這一點:模板參數模板函數
template <class T, class R>
bool operator==(const IndexedSkipList<T,R> &left, const IndexedSkipList<T,R> &right)
{
return ((left.size() == right.size()) &&
(std::equal(left.begin(), left.end(), right.begin())));
}
的錯誤是:
"include/CSIndexedSkipList.h", line 65: Error: Too few arguments for template std::reverse_iterator<CS::BidiIdxIterator<CS::IndexedSkipList<CS::T, CS::R>>>.
"include/CSIndexedSkipList.h", line 207: Where: While specializing "CS::IndexedSkipList<CS::T, CS::R>".
"include/CSIndexedSkipList.h", line 207: Where: Specialized in non-template code.
上面的代碼是什麼207開始,但它似乎在抱怨的reverse_iterator的。我無法真正理解它。我沒有直接訪問Sun編譯器,所以我想知道如果我做錯了什麼。
而且,我只用一個reverse_iterator的模板參數,不過我注意到,SGI的文件說,沒有默認的第二個參數T.無處不在,我雖然看了,他們只是用這個:
typedef std::reverse_iterator<iterator> reverse_iterator;
這是編譯器抱怨的第65行。我需要添加T作爲參數嗎?我無法弄清楚有問題的錯誤。
順便說一下,這可以在我能找到的所有平臺上使用gcc。它也適用於Borland。