|
Boost Users : |
From: Ed Johnson (ed_at_[hidden])
Date: 2006-05-14 05:52:51
Hi,
Is it possible to use shared_ptr to manage stringstreams, and still
use the << operator on the stringstream?
example:
#include <iostream>
boost::shared_ptr< std::stringstream > sharedStream(new
std::stringstream("hello world"));
std::cerr << (*sharedStream).str() << std::endl;
(*sharedStream) << "!";
std::cerr << (*sharedStream).str() << std::endl;
std::stringstream tr;
tr << "hello everyone";
tr << "!";
std::cerr << tr.str() << std::endl;
output:
hello world
!elloworld
hello everyone!
Thanks,
Ed Johnson
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net