Suppose we have some struct, A, with mathematical operators overloaded, like +,-,*,/ etc. If we then have an equation
A a1, a2, a3, a4, a5;
A a6 = a1*a2 + a3/a4 + 15;
There are intermediates created; for example the result of a1*a2 and the result of a3/a4 (which are then added together). My question is, when do these intermediates get destructed?
Compiling on gcc 4.2.1 the intermediates appear to get destructed after a6 is created. Does this happen for all compilers? Is there something in the standard about this?
Thanks