Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

| >>>>> "John" == John Levon <[EMAIL PROTECTED]> writes:
| 
| John> On Thu, Jun 14, 2001 at 01:46:06AM +0100, John Levon wrote:
| >> > Or the const char * _() could return a string. Or it could be
| >> removed > altogether...
| >> 
| >> removed sounds good. I'll have a go building with this change.
| 
| John> dur, of course we use the char * one everywhere.
| 
| John> And cgrepall '(".*").*+' alone has 69 matches. Argh.
| 
| But the char const * should be promoted to string automatically, no?

Please look into rewriting the code that has problems to use
stringstream, that will actually be better in the long run than to
fiddle with the _() "macros".

Just list the code-lines and I'll do the change...

As mentioned earlier, stringstreams often gives smaller code. Most
likely due to a smaller number of temporaries.

string a = string("hello") + string("world") + string("!");

How many temporaries? At least five.

with string stream this could have been:

ostringstream o;
o << "hello" << "world" << "!";
string a(o.str());

How many temporaries? one?

Also the ostream can often be passed in, and sometimes is passed in
anyway, so we end up with having only one ostream object shared
between several methods. (just look at the write methods)

-- 
        Lgb

Reply via email to