struct S{
int i;
double d;
S(const S & incoming_S):i(S.i),d(S.d){}
};
void test(){
S myS=S( /*temporary variable*/ S(23,3.14) );
}
Questions:
1) During initialisation, is the temporary variable S(23,3.14) actually created or can it (and is it actually for typical compilers such as VS2008) optimised away?
2) Same question for placement new situation such as:
void test{
char buffer[sizeof(S)];
new buffer(0) S( /*temporary variable */ S(23,3.14) );
}