No matching function for call to … with dtl-cpp
I am using dtl-cpp to compare the difference of two files line by line.
I have set up this comparator:
class LBCompareNSString : public dtl::Compare<NSString *> {
public:
virtual bool impl(const NSString *& A, const NSString *& B) const {
return [A isEqualToString:B];
}
};
I have two vectors of NSString
objects, like so with the custom comparator:
std::vector<NSString *> linesInACxx;
std::vector<NSString *> linesInBCxx;
And I set up dtl-cpp in this way:
LBCompareNSString comparator;
dtl::Diff< NSString *, std::vector<NSString *>, LBCompareNSString > dtlEngine(linesInACxx,开发者_C百科 linesInBCxx, comparator);
dtlEngine.compose();
However, when I compile I get this error in Diff.hpp:
Diff.hpp:506: error: no matching function for call to 'LBCompareNSString::impl(NSString*&, NSString*&)'
LBDifferenceEngine.mm:7: note: candidates are: virtual bool LBCompareNSString::impl(const NSString*&, const NSString*&) const
I have no idea how to declare the method so it will work. I tried removing virtual
and const
but that did not work. Does anyone know what I might have done wrong?
Aha! I found what I've done wrong.
virtual bool impl(const NSString *& A, const NSString *& B) const
should be
virtual bool impl(NSString *& A, NSString *& B) const
just like the compiler says.
精彩评论