Quick A: When it is assigned.
Recently on SO:
s2binds to the expression
s1 + s1, but is this evaluated at the time
Yes.And also would
s2hold memory for a temporary string?
s2is bound to a temporary
s1 + s1will produce a temporary
std::string, which will be bound to the reference
s2(and its lifetime is extended to the lifetime of the reference). Then
s2 += "Test";, performs
s2, i.e. the temporary