Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-09-23 02:33:58


>
>
>>Also, you can save a format object, e.g.:
>> // old style
>> containerfmt_t< char, pairfmt_t< char > >
>> myformat = containerfmt( pairfmt().format( " = "
>
> )).format( "<< ", "
>
>> >>" );
>>
>> std::cout << formatob( vec, myformat ); // << ( a = 5 ), (
>>b = 7 ), ...
>> >>
>> std::cout << formatob( lst, myformat ); // << ( i = 2.132 ), ( j =
>>3.14159 ), ... >>
>> std::cin >> formatob( vec, myformat );
>
>
> And now I need to write
>
> std::cout << formatob( lst, myformat );
>
> every time I print list? No, thank you.
>

As opposed to Foo(lst, std::cout)?

I would certainly go with the former...
Also, if you read the rest of the thread, you would have noticed that
there were a lot of talk about storing the formatter within the stream
itself. Reece has proposed quite a few solutions - and I'm sure he'll
come up with a very good one in the end.

What he was explaining is how things are done now - in this version of
the library.

Best,
John

-- 
John Torjo
-- john_at_[hidden]
Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/
-- v1.4 - save_dlg - true binding of your data to UI controls!
    + easily add validation rules (win32gui/examples/smart_dlg)

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk