
14 May
2006
14 May
'06
6:32 p.m.
Hi, Is it possible to use shared_ptr to manage stringstreams, and still use the << operator on the stringstream? example: //I would like to print 'hello world!' in both cases #include <iostream> boost::shared_ptr< std::stringstream > sharedStream(new std::stringstream("hello world")); (*sharedStream) << "!"; std::cerr << (*sharedStream).str() << std::endl; std::stringstream tr; tr << "hello world"; tr << "!"; std::cerr << tr.str() << std::endl; output: !elloworld hello world! Many thanks, Ed Johnson