constructor invocation mechanism
问题 struct my { my(){ std::cout<<\"Default\";} my(const my& m){ std::cout<<\"Copy\";} ~my(){ std::cout<<\"Destructor\";} }; int main() { my m(); //1 my n(my()); //2 } Expected output : 1 ) Default 2 ) Copy Actual output : What\'s wrong with my understanding of the constructor invoking mechanism? Note I have omitted header files for brevity. 回答1: Case 1) m is interpreted as a function return my and taking no arguments. To see the expected output remove () i.e use my m; Case 2) This is something