Boost logo

Boost :

From: Hamish Mackenzie (hamish_at_[hidden])
Date: 2002-11-28 05:30:54

On Wed, 2002-11-27 at 19:13, Boris Schäling wrote:
> I use std::string as a buffer which grows when needed. This is sufficient
> for what I do but may not what others need.

In that case you would be well catered for by.....

class buffered_observer : public observer
        std::stringstream write_stream_;

        std::ostream & out() { return write_stream_; }

        std::istream & write_stream()
                return write_stream_;

Note: I am assuming that the multiplexor will not reenter the observer
on another thread during an on_xxx call

Now your example could become

class my_observer : public buffered_observer
        void on_connect()
                out() << "Hello World" << std::flush;

I will take an ostream over writen any day.

Hamish Mackenzie <hamish_at_[hidden]>

Boost list run by bdawes at, gregod at, cpdaniel at, john at