Enter useless (k, ch) THIS=0X7FFFB5ADE0F0, Ct=1, pc= (Ten, 0x23f7010, xxxxxxxxxx Leave useless (k, ch) Enter operator+ (const &) THIS=0X7FFFB5ADE0F0, Ct=1, pc= (Ten, 0x23f7010, xxxxxxxxxx THIS=0X7FFFB5ADE0F0, Ct=1, pc= (Ten, 0x23f7010, xxxxxxxxxx Enter useless (k) this=0x7fffb5ade100, ct=2, pc= (0x23f7030, Leave useless (k) temp:this=0x7fffb5ade100, ct=2, pc= (0x23f7030, xxxxxxxxxxxxxxxxxxxx Leave operator+ (const &) Object one: THIS=0X7FFFB5ADE0F0, ct=2, pc= (Ten, 0x23f7010, xxxxxxxxxx Object: this=0x7fffb5ade100, ct=2, pc= (0x23f7030, xxxxxxxxxxxxxxxxxxxx "Useless-one +one;" First Call "operator+ (const &)" and call "useless (k)" Within this function to generate the Temp object. Returns when the copy constructor is called to generate a temporary anonymous object. The destructor Temp object. The move copy constructor is then called to generate object A. Destructors temporary anonymous objects. Current GCC version is g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4, the compilation process has been improved, the Temp object and the object directly as an object, eliminating the four steps behind. Enter useless () this=0x7fffb5ade110, ct=3, pc= (0, 0, (object empty) Leave useless () Enter useless () this=0x7fffb5ade120, ct=4, pc= (0, 0, (object empty) Leave useless () three = one Enter operator= (const &) this=0x7fffb5ade110, ct=4, pc= (0, 0, (object empty) THIS=0X7FFFB5ADE0F0, ct=4, pc= (Ten, 0x23f7010, xxxxxxxxxx this=0x7fffb5ade110, ct=4, pc= (Ten, 0x23f7050, xxxxxxxxxx THIS=0X7FFFB5ADE0F0, ct=4, pc= (Ten, 0x23f7010, xxxxxxxxxx Leave operator= (const &) Now object three: this=0x7fffb5ade110, ct=4, pc= (Ten, 0x23f7050, xxxxxxxxxx and object one: THIS=0X7FFFB5ADE0F0, ct=4, pc= (Ten, 0x23f7010, xxxxxxxxxx four = one + Enter operator+ (const &) THIS=0X7FFFB5ADE0F0, ct=4, pc= (Ten, 0x23f7010, xxxxxxxxxx this=0x7fffb5ade100, ct=4, pc= (0x23f7030, xxxxxxxxxxxxxxxxxxxx Enter useless (k) this=0x7fffb5ade130, Ct=5, pc= (0x23f7070, Leave useless (k) temp:this=0x7fffb5ade130, Ct=5, pc= (0x23f7070, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Leave operator+ (const &) //"four = one +" First call the "operator+ (const &)" function. The Temp object is generated within this function. After returning the "operator+ (const &)" function, a temporary anonymous object was not generated, and the Temp object was not refactored, but the move copy function "operator= (&&)" was called directly with the temp parameter. Enter operator= (&&) this=0x7fffb5ade120, ct=5, pc= (0, 0, (object empty) this=0x7fffb5ade130, Ct=5, pc= (0x23f7070, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx this=0x7fffb5ade120, Ct=5, pc= (0x23f7070, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx this=0x7fffb5ade130, ct=5, pc= (0, 0, (object empty) Leave operator= (&&) //After returning the "operator= (&&)" function, the Temp object is not destructor. Enter ~useless () this=0x7fffb5ade130, ct=5, pc= (0, 0, (object empty) Leave ~useless () Now object four: this=0x7fffb5ade120, ct=4, pc= (0x23f7070, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx four = Move (one) //"four = Std::move (one);" Forcibly calls the move assignment function "operator= (&&)". After the call, the four object takes over the internal resources of the one object (PC and N), the one object is not refactored, but the internal resources are "hollowed out"! Enter operator= (&&) this=0x7fffb5ade120, ct=4, pc= (0x23f7070, xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx THIS=0X7FFFB5ADE0F0, ct=4, pc= (Ten, 0x23f7010, xxxxxxxxxx this=0x7fffb5ade120, ct=4, pc= (Ten, 0x23f7010, xxxxxxxxxx THIS=0X7FFFB5ADE0F0, ct=4, pc= (0, 0, (object empty) Leave operator= (&&) Now object four: this=0x7fffb5ade120, ct=4, pc= (Ten, 0x23f7010, xxxxxxxxxx and object one: THIS=0X7FFFB5ADE0F0, ct=4, pc= (0, 0, (object empty) The object that destructors the stack space when exiting "main ()". The destructor sequence is the opposite of the construction order. Enter ~useless () this=0x7fffb5ade120, ct=4, pc= (Ten, 0x23f7010, xxxxxxxxxx Leave ~useless () Enter ~useless () this=0x7fffb5ade110, Ct=3, pc= (Ten, 0x23f7050, xxxxxxxxxx Leave ~useless () Enter ~useless () this=0x7fffb5ade100, ct=2, pc= (0x23f7030, xxxxxxxxxxxxxxxxxxxx Leave ~useless () Enter ~useless () THIS=0X7FFFB5ADE0F0, Ct=1, pc= (0, 0, (object empty) Leave ~useless () |