我有代码:
std::string firstFile = boost::filesystem::path(first->name()).leaf();
但是得到错误:
error conversion from ‘boost::filesystem3::path’ to non-scalar type ‘std::string
我该如何解决?
谢谢。
答案 0 :(得分:10)
std::string firstFile = boost::filesystem::path(first->name()).leaf().string();
另请注意,leaf
函数已弃用,并已在Boost.Filesystem V3中删除。