c++ - "fs::path::string"未解析的重载函数类型

标签 c++ boost

boost 1.49 gcc 版本 4.6.3

        std::transform(barcodeFiles.begin(), barcodeFiles.end(), std::ostream_iterator<std::string>(std::cerr, "\n"),
            boost::bind(&fs::path::string, _1));

如何编辑这段代码?

[ 65%] Building CXX object c++/lib/demultiplex/CMakeFiles/casava_demultiplex.dir/BclDemultiplexer.cpp.o
/bak/software/Linux/CASAVA_v1.8.2/src/c++/lib/demultiplex/BclDemultiplexer.cpp: In member function ‘const casava::demultiplex::BclDemultiplexer::ClusterCorrectedBarcodeIndex casava::demultiplex::BclDemultiplexer::mapClusterBarcodes(unsigned int) const’:
/bak/software/Linux/CASAVA_v1.8.2/src/c++/lib/demultiplex/BclDemultiplexer.cpp:65:50: error: no matching function for call to ‘bind(, boost::arg&)’
/bak/software/Linux/CASAVA_v1.8.2/src/c++/lib/demultiplex/BclDemultiplexer.cpp:65:50

最佳答案

答案可以在 FAQ of boost bind 中找到

std::transform(
    paths.begin(), paths.end(),
    std::ostream_iterator<std::string>(
        std::cerr, "\n"
    ),
    boost::bind(
        static_cast<
            std::string const & (boost::filesystem::path::*)() const
        >(&boost::filesystem::path::string), 
        _1
    )
);

关于c++ - "fs::path::string"未解析的重载函数类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10827542/

相关文章:

c++ - void *p = &&abc; 中的 && 是什么意思

c++ - 我的合并排序函数吐出 0 而不是对我的列表进行排序

c++ - 如果禁用异常,std::vector<T> 可以使用 T 的移动构造函数吗?

c++ - 创建一个编译时键到类型映射,通过调用可变参数函数来填充

c++ - 使用 boost 解析日期时间字符串 : With single digit hour format

c++ - 如何迭代两个类似 STL 的容器(笛卡尔积)

c++ - 使用 std::bind 并存储到 std::函数中

c++ - boost 几何 : intersection of a polygon and a box

C++ 编译时断言

c++ - 添加长年持续时间的 Boost.DateTime 问题