简体   繁体   English

没有匹配的 function 用于调用 ... 与 dtl-cpp

[英]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.我尝试删除virtualconst但这不起作用。 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.

相关问题 cpp 没有匹配的函数调用来调用构造函数。 为什么? - cpp no matching function call for call to constructor. Why? 错误:- main.cpp:11:19: 错误: push_back 行中没有匹配的调用函数 - error:- main.cpp:11:19: error: no matching function for call in the push_back line Jinja2cpp valueMap 参数多个项目'没有匹配的 function 调用'错误 - Jinja2cpp valueMap param multiple items 'no matching function for call' error 错误:没有匹配的函数来调用&#39;sipqt_gui_cpp_RosPluginlibPluginProvider_ForPlugins :: connectNotify(const char *&)&#39; - error: no matching function for call to ‘sipqt_gui_cpp_RosPluginlibPluginProvider_ForPlugins::connectNotify(const char*&)’ Referee.cpp:10:18:错误:没有匹配的 function 用于调用“Human::Human()”Referee::Referee() - Referee.cpp:10:18: error: no matching function for call to ‘Human::Human()’ Referee::Referee() 如何在cpp的main()中调用这个函数 - How to call this function in main() in cpp 超时后的CPP呼叫功能 - CPP call function after timeout 无匹配 Function 开始多播 - Arduino/cpp - No Matching Function Begin Multicast - Arduino/cpp 当我从另一个.cpp文件调用cpp函数时出错 - Error when I call cpp function from another .cpp file 错误:没有匹配的呼叫功能 - error: no matching function for call
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM