Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2000-08-21 16:23:31

on 8/21/00 11:56 AM, Karl Nelson at kenelson_at_[hidden] wrote:

> Beyond David, Valentin, and myself there wasn't much comment on
> whether this idea was acceptable for boost.

I'd love to have something like this in boost. Two things like this in boost
would be bad though.

> Now as for what I plan to do. I don't have an implementation of
> STL with stringstream, wstrstream, or even wstream. Nor do I
> expect that the users of Gtk-- will be installing their own
> libraries which such C++ features.

I know of at least two users of Gtk-- (me and one other) who plan to use
libsigc++ on Macintosh with CodeWarrior Pro 6 (which has stringstream,
wstrstream, and wstream); but it's true that we won't be using Gtk-- there.
The only platform I program on regularly that lacks stringstream is the
current Unix/gcc world; that's the anomalous one in my opinion.

> I can however write a configure
> script that identifies features in the STL like stringstream and
> use them where applicable. (the difference between using stringstream
> and strstream is all of about 3 lines for my code. )

Ironically this does no good for Macintosh since configure scripts aren't
used there. One thing I like about the boost library is that there are no
dependencies (or few at least) on things like configure and automake.

> After reading Valentin Bonnard's code and others from
> the archives I do see some areas for improvement in my code.
> I could easily allow format to be base class (rather than
> a stub as it currently is) which cleans up the code, and
> just add a stringformat type using similar code.
> string s=stringformat("%.4f") << 1.0;
> cout << format("%.4f") << 1.0;
> format(cout,"%.4f") << 1.0;
> cout << format("The result is %^25s") <<
> ( stringformat("%.3f != %.3") << i1 << i2 );
> (where %^25s, means a 25 wide centered string)

I like the idea here, but not the name. Is there a compelling reason to cram
the words string and format together without punctuation?

Sadly I have not had time to discuss the two current proposals enough to
evaluate them. I do like Karl's approach of matching printf format strings
closely instead of inventing a new format string language.

    -- Darin

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