Converting increase errors from "boost :: filesystem3 :: path to a non-scalar type" std :: string

I have a code:

std::string firstFile = boost::filesystem::path(first->name()).leaf(); 

But the error will turn out:

 error conversion from 'boost::filesystem3::path' to non-scalar type 'std::string 

How can i fix this?

Thanks.

+6
c ++ string boost std
source share
1 answer
 std::string firstFile = boost::filesystem::path(first->name()).leaf().string(); 

Also note that the leaf function is deprecated and removed in Boost.Filesystem V3.

+10
source share

All Articles