2011-09-22 60 views
2

我在使用Sun Studio編譯器的Solaris上有問題。它似乎與libCstd有關。問題與std :: BinaryPredicate使用Solaris CC

考慮下面的代碼:

#include <list> 
static bool f(double fFreq1, double fFreq2) { return false; } 
int main() 
{ 
    std::list<double> l; 
    l.unique(f); 
} 

該錯誤消息我得到的是:

"uniq.cpp", line 6: Error: Could not find a match for std::list<double>::unique(bool(double,double)) needed in main(). 

但是當我使用的引用而不是值,它編譯就好:

#include <list> 
static bool f(const double& fFreq1, const double& fFreq2) { return false; } 
int main() 
{ 
    std::list<double> l; 
    l.unique(f); 
} 

使用g ++編譯都可以。有誰知道發生了什麼事?謝謝 !

+0

也許是庫實現中的錯誤。你可以在列表標題中查找相關部分嗎? –

+0

不幸的是,我找不到頭文件。 – ghi

+1

'grep -rH searchTerm/usr/include'如何? –

回答