【问题标题】:Boost error conversion from ‘boost::filesystem3::path’ to non-scalar type ‘std::string从'boost::filesystem3::path'到非标量类型'std::string'的提升错误转换
【发布时间】:2011-03-21 07:08:31
【问题描述】:

我有代码:

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

但得到错误:

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

我该如何解决?

谢谢。

【问题讨论】:

    标签: c++ string boost std


    【解决方案1】:
    std::string firstFile = boost::filesystem::path(first->name()).leaf().string();
    

    另请注意,leaf 函数已被弃用,并在 Boost.Filesystem V3 中被删除。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-03
    • 1970-01-01
    • 1970-01-01
    • 2021-09-16
    • 2018-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多