|
Boost : |
From: John Torjo (john.lists_at_[hidden])
Date: 2004-09-23 14:44:15
troy d. straszheim wrote:
> On Sep 21, 2004, at 6:26 PM, John Torjo wrote:
>
>> std::vector<int> v;
>> // equivalent to your "[ ", ", ", " ]"
>> std::cout << formatob(v, "[ %, % ]");
>>
>> // eq. to "<< ", " | ", " >>"
>> std::cout << formatob(v, "<< % | % >>");
>>
>> // set only open/close decorators
>> std::cout << formatob(v, "<< %*% >>");
>>
>> // sets only the separator
>> std::cout << formatob(v, "*% | %*");
>
>
> I like this as well. But it brings to the fore something I've been
> wondering about the overall coherence of boost, (I haven't spoken up as
> I'm relatively new to the list). What the discussion has evolved to,
> above, looks a *lot* like what is in boost.format, and it would seem to
> me that boost.format would be an appropriate place for it (both
> specifically, as above, and theoretically as well). The docs mention
> that the serialization part of outputformatters is better left to the
> serialization library itself, so that's not an issue... offhand I just
> don't see why this functionality should be separate.
>
boost::format takes care of formatting of "single" values. You can do
printf-like formatting with boost::format.
Output Formatters addresses a different issue - that is : formatting of
collections/containers.
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