Dec 3, 2012 at 5:24am UTC
string s1 = "beginning " + s0 + " end" ;
This equates to:
std::string s1( operator +("beginning" , operator +(s0, "end" )) ) ;
There is always a std::string involved with the operator+ chaining.
string s1 = "beginning " + " end" ;
is equivalent to:
std::string s1(operator +("beginning " + " end" )) ;
And you'll notice there is no std::string involved in that operator+. Your compiler is telling you that you can't add char arrays together. You may add one to a std::string, but you can't add it to another char array.
[edit: Fixed missing paren.]
Last edited on Dec 3, 2012 at 8:18pm UTC
Dec 3, 2012 at 7:56pm UTC
muchos gracias ! I can see that I've still a lot to learn !!!
Don't know common forum practices but one can mark this solved ... please tell me if I've to do something for that ?
Dec 3, 2012 at 8:01pm UTC
At the top of this page there is a button that says "Mark as solved".