Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boost error conversion from ‘boost::filesystem3::path’ to non-scalar type ‘std::string

I have code:

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

But get error:

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

How can i fix it?

Thank you.

like image 314
0xAX Avatar asked Mar 21 '11 07:03

0xAX


1 Answers

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

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

like image 169
Yakov Galka Avatar answered Nov 03 '22 16:11

Yakov Galka