#include <string>
int main ()
{
std::string MyString = "Testing";
MyString = " " + MyString;
}
This works in Microsoft Visual C++ .net 2003
The end result being MyString contans the text " Testing"
I'm wondering if this is UB. Apparently MSVC is converting
the " " to a std::string, then doing the +. Otherwise it would
try to add a std::string to a char* which would fail.
I know I can do MyString = std::string(" ") + MyString; and
all would still work. But I'm wondering if I have to (to stay
within the standards).