这是一些不是我写的旧代码。它用GCC 3.4.6编译,但现在我们用GCC 4.4.7检查构建,并且构建失败。
我希望这段代码能够继续下去:
list<Chapter*> * tocP; //Chapter is a class
tocP = NULL;
if (_searchChapter)
{
_chapter = _manager->GetCurrentChapter(); // _chapter is a Chapter*
}
else
{
tocP = _manager->GetTableOfContents();
if (tocP != NULL && tocP->size() > 0)
_chapter = tocP->front();
}
...
list<Chapter*>::iterator chp;
if (tocP != NULL && tocP->size() > 0)
for (chp=find(tocP->begin(),tocP->end(),_chapter); chp != tocP->end(); ++chp) // this code fails
{
//code to process chapter
}
错误信息是:
../ src / HelpSearchC.C:在成员函数&#39; int HelpSearchC_i :: DoSearch()&#39;: ../src/HelpSearchC.C:685:错误:没有匹配函数来调用&#39; find(std :: _ List_iterator&lt; Chapter *&gt;, std :: _ List_iterator&lt; Chapter *&gt ;, Chapter *&amp;)&#39;