Ai đó có thể giúp tôi không?Sử dụng tăng :: iostreams :: tee_device?
Tôi cố gắng để làm một cái gì đó như sau:
#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());
Nhưng nó sẽ không biên dịch trong 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
Có ai nhận này để làm việc? Tôi biết tôi có thể làm cho lớp học của riêng tôi để làm điều đó, nhưng tôi muốn biết những gì tôi đang làm sai.
Cảm ơn
Chà ... không thấy điều đó trong tài liệu. Công việc tuyệt vời, cảm ơn rất nhiều! – rlbond