String, Y U NO append?


#1

Why doesn’t this compile:

beginTest (String ("backend=") << backendName)

where backendName is of type String?

It’s annoying that I have to write

String s;
s << "backend=" << backendName;
beginTest (s);

Am I missing something?


#2

Why not write “StringA + StringB”?

Edit: Is it possible the issue lies with using basic_ostream, and not having a constructor for it?


#3

That worked! Thanks!


#4

I think it’s probably because the unnamed temporary string object is treated as const, but the << operator is non-const.