[英]No matching function for call to … with dtl-cpp
I am using dtl-cpp to compare the difference of two files line by line.我正在使用dtl-cpp 逐行比较两个文件的差异。
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:我有两个NSString
对象向量,就像自定义比较器一样:
std::vector<NSString *> linesInACxx;
std::vector<NSString *> linesInBCxx;
And I set up dtl-cpp in this way:我以这种方式设置了 dtl-cpp:
LBCompareNSString comparator;
dtl::Diff< NSString *, std::vector<NSString *>, LBCompareNSString > dtlEngine(linesInACxx, linesInBCxx, comparator);
dtlEngine.compose();
However, when I compile I get this error in Diff.hpp:但是,当我编译时,我在 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.我尝试删除virtual
和const
但这不起作用。 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.就像编译器说的那样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.