I was wondering if returning *this from a function is safe. this question shows some ways you can do it and my question is given this example:
struct test {
string t;
string b;
public:
test& A(string test) { this->t=test; return *this; }
test& B(string test) { this->b=test; return *this; }
};
int main() {
auto a = test().A("a").B("b").A("new a");
return 0;
}
Is there going to be memory leakage?