Utilizando boost :: iostreams :: tee_device?
¿Alguien me puede ayudar
Estoy tratando de hacer algo como lo siguiente:
#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());
Pero no se compilará en 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
¿Alguien ha conseguido que esto funcione? Sé que podría hacer mi propia clase para hacerlo, pero quiero saber qué estoy haciendo mal.
Gracia