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_;

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

public:
        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
{
public:
        void on_connect()
        {
                ...
                out() << "Hello World" << std::flush;
        }       
};

I will take an ostream over writen any day.

-- 
Hamish Mackenzie <[EMAIL PROTECTED]>

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to