我要像这样解压缩bz2文件:
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
ifstream file (file_name);
boost::iostreams::filtering_streambuf<boost::iostreams::input> in;
in.push(boost::iostreams::bzip2_decompressor());
in.push(file);
std::ifstream input(&in);
但执行失败并显示消息:
error: no matching constructor for initialization of 'std::ifstream' (aka 'basic_ifstream<char>')
std::ifstream input(&in);
^ ~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iosfwd:131:33: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'boost::iostreams::filtering_streambuf<boost::iostreams::input> *' to 'const std::__1::basic_ifstream<char, std::__1::char_traits<char> >' for 1st argument
class _LIBCPP_TYPE_VIS_ONLY basic_ifstream;
^
我不确定我在这里做错了什么。这是根据http://www.boost.org/doc/libs/1_49_0/libs/iostreams/doc/tutorial/writing_devices.html
推荐的程序