In c++17, it is valid like
string s = "asd";
string &ss = "asd" + s; --> here
Now I have two doubts:
1.Why reference of ss
is valid? What is it reference to? An anonymous variable of the result of
"asd" + s
?But is it valid to reference to an anonymous variable?
2.Why "asd" could directly add s
?Wouldn't write it as string("asd") + s
like before?Why?