On Thursday, 26 July 2018 at 06:04:33 UTC, Paulo Pinto wrote:
On Wednesday, 25 July 2018 at 21:16:40 UTC, Walter Bright wrote:
On 7/24/2018 4:53 AM, Ecstatic Coder wrote:
str = str1 + " " + str2;
But you have to be careful how it is written:
str = "hello" + "world";
str = "hello" + "world" + str1;
don't work, etc.
Well, like everything in C++, there is always a way.
str = "hello"s + "world";
str = "hello"s + "world" + str1;
Spot the difference. :)
It's just synctactic sugar for a constructed string. You can't
even use C++14 string constants to initialize a string view, or
you have a dangling pointer, as it's NOT a true constant.
Ridiculous...