o matching function for call to ‘std::__cxx11::wstring_convert<std::codecvt_utf8_utf16<wchar_t> >::to_bytes(std::__cxx11::string&)’ std::string utf8_string = converter.to_bytes(datas);
这个错误的原因可能是你传递给 to_bytes
函数的参数类型不正确。to_bytes
函数需要一个 std::wstring
类型的参数,但是你传递了一个 std::string
类型的参数。你可以尝试将参数转换为正确的类型,或者使用适当的函数来正确地转换字符串类型。你可以检查一下你的代码,看看是否有这样的错误。
template_match.cpp:14:50: error: no matching function for call to ‘TemplateMatch::ParallelMatch(std::vector<std::__cxx11::basic_string<char> >::const_iterator, std::vector<std::__cxx11::basic_string<char> >::const_iterator)’ ParallelMatch(templates.begin(), templates.end()); ^ In file included from template_match.cpp:1:0: template_match.h:13:7: note: candidate: void TemplateMatch::ParallelMatch(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator) void ParallelMatch(std::vector<std::string>::iterator first, std::vector<std::string>::iterator last);
这个错误提示表明在你的代码中调用了一个不存在的函数。具体来说,这个函数是TemplateMatch::ParallelMatch
,它期望接收两个std::vector<std::string>::iterator
类型的参数,但是你传入的却是std::vector<std::__cxx11::basic_string<char> >::const_iterator
类型的参数,因此编译器找不到匹配的函数。
解决这个问题的方法是修改ParallelMatch
函数的参数类型,将其改为const_iterator
类型即可。同时,你也需要确保在调用ParallelMatch
函数时传入正确的参数类型。
error: no matching function for call to ‘std::map<int, std::__cxx11::basic_string<char> >::count(std::__cxx11::string&)
这个错误是因为你正在尝试使用一个 std::map
对象的 count
函数来查找一个 std::__cxx11::string
键,而 count
函数的参数应该与 std::map
对象的键类型相匹配。在这种情况下,std::map
的键类型为 int
,而你提供的参数类型为 std::__cxx11::string
。
要解决这个问题,你需要确保参数类型与 std::map
的键类型相匹配。如果你想在 std::map<int, std::__cxx11::basic_string<char>>
中查找一个字符串键,你可以使用 std::map
的 find
函数。例如:
std::map<int, std::__cxx11::basic_string<char>> myMap;
std::__cxx11::string key = "example";
auto it = myMap.find(key);
if (it != myMap.end()) {
// 键存在于 map 中
} else {
// 键不存在于 map 中
}
这样,你就可以使用 find
函数来查找指定的字符串键。
相关推荐

















