|
Boost : |
From: Dirk Gerrits (dirkg_at_[hidden])
Date: 2002-05-12 16:05:41
----- Original Message -----
From: "Giovanni Bajo" <giovannibajo_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Sunday, 12 May, 2002 20:15
Subject: [boost] String formatting library: interest?
> What I am proposing here is an 'extension' to std::string to add
formatting
> capabilities ala-sprintf, but in a type-safe, no-ellipsis manner. The
credit
> for this idea goes to Trolltech (QString in the Qt package
> ...
> A quick example:
>
> cout << mystring("Hello, my name is %1 and I am %2 years
> old").arg("Giovanni").arg(999) << endl;
I would find this a nice addition indeed. QString works very beautifully.
But by
'extension' do you mean 'implemented in terms of'? Because I'm not sure that
this
boost::basic_string (or whatever it will be called) *should* be implemented
using
std::basic_string. If it were implemented internally as a
std::basic_stringstream
for example, then the parameters to arg, operator+=, etc could be any class
that
overloads the proper stream insertion functions. A lot nicer and less
limiting.
Just my 2 cents. What do you think?
Dirk Gerrits
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk