Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2003-04-04 11:33:01

Paul A. Bristow wrote:

>Thanks for repackaging the code inside zip, and for mor examples, and
>making it work 'strictly' MXVC 7.0 Level 4 & NO language extensions

No problem.

>But handling at least 2D and 3D C arrays is still acommon requirement.

The problem with 2 or more dimensions is that you cannot specify the
beginning and end point for dimensions beyond the first, making it
impossible to use my formatlist manipulator (in its current implementation)
for displaying things like matrices.

I have a few ideas about how to add support for nD constructs, but do not
have anything resembling a design for them as yet. I will provide more
information once I have something more definate.

>Some people are turned on by wide characters.

Then they are going to like the improvements I have made to the manipulator
- it now supports the following, via the formatlistex manipulator:
* ascii characters (char)
* wide characters (wchar_t)
* ascii strings (char * and const char *)
* wide strings (wchar_t * and const wchar_t *)

I have also provided some new examples to demonstrate these in action.

NOTE: There is a bug when using either std::wcout or std::wofstream when you
try to do something like:
   std::wcout << L"\x2200 foo \x2203 bar\n";

This should output
   $forall$ foo $there-exists$ bar

but it does not want to work on the MSVC7 compiler and default library. It
*should* work, but unfortunatly does not :-(.

Also: does anyone know why a wide character stream will not accept char and
const char * arguments to the << operator, and vise-versa for an ASCII
character stream?

>Doubt that you should worry at present - boost\io\ may be suitable?

I have changed the library to the boost::io namespace anyway. I will not
concern myself anymore with the namespace name until a later date, if/when
the library is ready for integration into boost.

>Your new examples show how easy it is to use.


I have also revised the code structure to seperate the declerations from the
implementation and also to seperate the different classes. Does anyone have
any comments on this version and the old one? Which do you prefer?

I personally favor the new one, but all comments/criticism are welcome.

One final thing: the test code shows the preliminary notion of seperating
the format information from the formatlist_t class, allowing you to apply a
format across several outputs without having to explicitly adding the
formatting options to the manipulator.

Here is what I have in mind, although it is not currently implemented:

Creating the formatter object and configure it:

boost::io::formatter< char > fmt;
fmt.format( '(', ')' );

Output binding mechanism #1:

std::cout << boost::io::formatlist( i, i + 4 )
             .format( fmt );

Output binding mechanism #2:

std::cout << boost::io::formatlist( v, fmt ) << '\n';

NOTE: In mechanism 2, the format type is inherited from the formatter.

I am looking at supporting both mechanisms for greatest flexability.


Use MSN Messenger to send music and pics to your friends

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