我不明白为什么下面的代码不能在VS 2013中编译。编译器只是抱怨如下,我不知道如何修复它:
e:\work\justtest\console\console.cpp(37):C2664 C2664:'bool dfsFolder(const wchar_t *,const wchar_t *,std::function &)‘:无法将参数3从“main:”转换为“std::wchar_t&”
bool dfsFolder(__in const wchar_t* folderPath, __in const wchar_t* ext, const std::function<bool(const std::wstring& wsFilePath)>& pFunc)
{
}
int main()
{
auto path = LR"(F:\TODOWNLOAD\)";
auto lambda = [&](const std::wstring& wsFilePath) mutable -> bool
{
wcout << wsFilePath << endl;
return true;
};
dfsFolder(path, L"*.jpg", lambda);
}发布于 2015-11-20 13:24:02
错误消息似乎与代码不匹配:最后一个参数是std::function<...> const&,而不是错误中所述的std::function<...>&。您的实际代码是否将std::function<...>&参数声明为const
https://stackoverflow.com/questions/33825254
复制相似问题