没有匹配的函数可用于调用 …与 dtl-cpp

发布于 2024-11-24 06:36:35 字数 1137 浏览 2 评论 0原文

我正在使用 dtl-cpp 逐行比较两个文件的差异。

我已经设置了这个比较器:

class LBCompareNSString : public dtl::Compare<NSString *> {
public:
  virtual bool impl(const NSString *& A, const NSString *& B) const {
    return [A isEqualToString:B];
  }
};

我有两个 NSString 对象向量,就像自定义比较器一样:

std::vector<NSString *> linesInACxx;
std::vector<NSString *> linesInBCxx;

并且我以这种方式设置了 dtl-cpp:

LBCompareNSString comparator;
dtl::Diff< NSString *, std::vector<NSString *>, LBCompareNSString > dtlEngine(linesInACxx, linesInBCxx, comparator);
dtlEngine.compose();

但是,当我编译时,我收到此错误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

我不知道如何声明该方法,以便它能够工作。我尝试删除 virtualconst 但这不起作用。有谁知道我可能做错了什么?

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, 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

謸气贵蔟 2024-12-01 06:36:35

啊哈!我发现我做错了什么。

virtual bool impl(const NSString *& A, const NSString *& B) const

应该

virtual bool impl(NSString *& A, NSString *& B) const

就像编译器所说的那样。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文