c++ - ': 无法从 'const boost::filesystem::path::value_type *' 转换为 'std::string'
问题描述
void loadImages(const string& src, vector<string> &dest){
directory_iterator end;
path dir(src);
string filename;
int n = 0;
int num;
for (directory_iterator pos(dir); pos != end; ++pos) {
if (is_regular_file(*pos)) {
n++;
}
}
dest.resize(n);
for (directory_iterator pos(dir); pos != end; ++pos) {
if (is_regular_file(*pos)) {
filename = pos->path().filename().string();
num = atoi((filename.substr(0, filename.find("."))).c_str());
dest[num - 1] = pos->path().string();
}
}
}
我该如何解决这个错误加上有 2 个错误:E0308 多个重载函数“is_regular_file”实例与参数列表匹配:
在此处输入图像描述
解决方案
推荐阅读
- mongodb - 未填充猫鼬一对多关系
- javascript - 任务完成和回调函数执行之间是否有延迟?
- excel - 如何使用另一个文件中的代码从文件中删除所有过滤器?
- javascript - 如何绕过firebase功能冷启动
- c# - 在 ASP.Net Core 3 中从中间件设置 HTTP 身份验证标头
- django - Django 嵌套序列化程序错误:“序列化程序字段可能命名不正确,并且不匹配任何属性或键”
- coq - 从 auto/eauto 触发类型类搜索
- go - 从 sourceforge 下载(等待和重定向)
- javascript - 在 Node.js 中构建多分支树时的性能问题
- formidable - 以强大的形象示人