Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-09-13 03:04:04


David Abrahams wrote:
> "Reece Dunn" <msclrhd_at_[hidden]> writes:
>
>
>>>I'm generally not a great fan of statefulness, but this also seems
>>>like a reasonable thing to want:
>>>
>>> namespace io = boost::io;
>>> std::cout << io::sequence_delimiters("{ ", " }");
>>> std::cout << io::sequence( vec );
>>> // output: { 1, 2, 3 }
>>
>>You can achieve something like this using:
>>
>> io::formatter< const char * > fmt( "{ ", " }" );
>> std::cout << io::sequence( vec ).format( fmt );
>>
>>If there are any better alternatives, I am willing to listen.
>
>
> Well, I think my alternative is better if you want a stateful change,
> since yours doesn't accomplish that. My suggestion is certainly
> consistent with normal io manipulators. The point is to stream a
> bunch of sequences without having to repeat the format part.
>

Yes, that would be very neat. And it's certainly doable:
ios_base::pword

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.0 - 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