|
Boost : |
From: Larry Evans (jcampbell3_at_[hidden])
Date: 2003-04-23 09:52:21
John Torjo wrote:
> Since there seems to be some confusion about this, I will post the message I
> sent to Reece in the first place:
>
> Hi Reece,
>
> I've looked at col_io library -
> http://groups.yahoo.com/group/boost/files/col_io/, since I've written a
> (note: at that time, I thought Reece developed it)
> library that allows thread-safe logging
> (http://groups.yahoo.com/group/boost/files/thread_safe_log.zip).
>
> I wanted to see if they "get along" and unfortunately the answer is
> something like "sometimes yes, sometimes no".
>
> The point is that I really like the col_io library.
Thanks very much.
>
> I would have a few remarks if it's ok with you:
> 1. at this time, you donot care about formatting.
> So, something like this will most likely not work as expected:
>
> std::ofstream out("out.txt");
> marg_stream m(out);
> locale l( "german");
> out.imbue( l);
> m << 5.23 << std::endl;
I'll have to try it, but I think the ctor either flushes the
out.rdbuf or copies it to m.rdbuf; hence, it MIGHT work.
>
> 2. binding marg_stream to a std::ostream& couples them too much IMHO
> (that is, the marg_stream variable is coupled to the other stream)
> This actually came to me when I wanted to use col_io together with my
> thread_safe_log library.
[snip]
OK.
> Both indent_ostream and indent_ostream_wrapper are meant to be used as RAII
> (resource acquisition is initialization) objects - they are destroyed as
> soon as they are not needed anymore.
[snip]
>
> Please let me know what you think.
>
> Best,
> John
John, I haven't looked closely at your indenter_streambuf below, but
it looks similar to marg_ostreambuf, which I mentioned in my previous post.
Have you tried using marg_ostreambuf with ostringstream as shown in
the main.cpp code which was also mentioned in my previous post?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk