我有代码:
std::string firstFile = boost::filesystem::path(first->name()).leaf();
但是报错:
error conversion from ‘boost::filesystem3::path’ to non-scalar type ‘std::string
我该如何解决?
谢谢。
最佳答案
std::string firstFile = boost::filesystem::path(first->name()).leaf().string();
另请注意,leaf
函数已弃用并在 Boost.Filesystem V3 中删除。
关于c++ - 从 ‘boost::filesystem3::path’ 到非标量类型‘std::string’的 boost 错误转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5374754/