Assignment operator reallocation?

May 18, 2016 at 4:19pm
1
2
3
4
5
6
struct A{
  int a;
  string b;
}
A var = {2, "test"}; // This creates my object
var = {3, "test2"}; // Does this reallocate memory or reuse it? 
May 18, 2016 at 4:26pm
Line 6 is an assignment operation. No additional memory is allocated (except perhaps a temporary object on the stack).

May 18, 2016 at 4:27pm
@AbstractionAnon Thanks!
Topic archived. No new replies allowed.