Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2003-02-04 13:22:01

Terje Slettebø wrote:
>>From: "Vladimir Prus" <ghost_at_[hidden]>
>>Terje Slettebø wrote:

> std::cout << io_format<char (&)[3]>("\n|","|\n","|")
> << io_format<char (&)[3][3]>("-------","-------","-------")
> << board << '\n';
> }
> we get:
> -------
> |O|X|O|
> -------
> |X|X|O|
> -------
> |O|O|X|
> -------

I've used marg_ostream to format output for containers; however,
it only used something that changed the margin. I had to
use an ostream<< for the particular composite to get it to work.
However, being able to adjust the margin seems useful for
formating most code. Looking at the code might give you
some more ideas about your io_format. Unfortunately, marg_ostream
requires wrapping the cout in a marg_ostream.

Anyhow, the code is in boost files in shared_cyclic_ptr/
in boost/col_io directory. Basically, marg_ostream++ increments the
margin and marg_ostream-- decrements the margin. You can also specify
what's in the margin. This was used to show the nesting in a fortran
program in a parallelizing compiler.

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