"qazmlp" <qa********@rediffmail.com> wrote in message news:db**************************@posting.google.c om...
int main()
{
std::string strVal = "2" ;
strVal = "000" + strVal ;
}
I am wondering how the above one compiles well. I expected that, it should be
An overload for operator+ is provided
string operator+(const char*, const string& )
(Not literally, but the above is good enough to understand the issue).
This means you can mix most operations you can do with strings with char*'s pointing
at null terminated strings as long as one operand is a string type (obviously no overload
is possible if both args are pointers).
"000" + str;
str + "000"
str + str;
are all valid
"000" + "000"
is not.