
Here follows a simple pattern to use Boost.IOstreams with your non-copyable Device, allowing you quick access to formatted input and output: #include <boost/iostreams/stream.hpp> #include <boost/ref.hpp> #include "foo_device.hpp" /* Don't; just to make lines shorter. */ using boost::iostreams; using boost; class foo_device; class foo_stream_base { public: /* Define constructor forwarding to foo_device. */ foo_stream_base (...) : _M_device(...) {} protected: foo_device _M_device; }; class foo_stream : private foo_stream_base, public stream<reference_wrapper<foo_device> > { public: /* Define constructor forwarding to foo_device. */ foo_stream (...) : foo_stream_base(...), stream<reference_wrapper<foo_device> >(ref(_M_device)) {} }; -- Pedro Lamarão Desenvolvimento Intersix Technologies S.A. SP: (55 11 3803-9300) RJ: (55 21 3852-3240) www.intersix.com.br Your Security is our Business