相关疑难解决方法(0)

使用boost :: iostreams :: tee_device?

有人能帮我吗?

我想尝试做以下事情:

#include <boost/iostreams/tee.hpp>
#include <boost/iostreams/stream.hpp>
#include <sstream>  
#include <cassert>  

namespace io = boost::iostreams;
typedef io::stream<io::tee_device<std::stringstream, std::stringstream> > Tee;
std::stringstream ss1, ss2;
Tee my_split(ss1, ss2); // redirects to both streams
my_split << "Testing";
assert(ss1.str() == "Testing" && ss1.str() == ss2.str());
Run Code Online (Sandbox Code Playgroud)

但它不会在VC9中编译:

c:\lib\boost_current_version\boost\iostreams\stream.hpp(131) : error C2665: 'boost::iostreams::tee_device<Sink1,Sink2>::tee_device' : none of the 2 overloads could convert all the argument types
Run Code Online (Sandbox Code Playgroud)

有没有人得到这个工作?我知道我可以自己上课去做,但我想知道我做错了什么.

谢谢

c++ iostream stream boost-iostreams

7
推荐指数
1
解决办法
3426
查看次数

标签 统计

boost-iostreams ×1

c++ ×1

iostream ×1

stream ×1