MCPcopy Create free account
hub / github.com/changkun/modern-cpp-tutorial / ~A

Method ~A

code/3/3.4.cpp:16–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14 A(A& a):pointer(new int(*a.pointer)) { std::cout << "拷贝" << pointer << std::endl; } // 无意义的对象拷贝
15 A(A&& a):pointer(a.pointer) { a.pointer = nullptr;std::cout << "移动" << pointer << std::endl; }
16 ~A(){ std::cout << "析构" << pointer << std::endl; delete pointer; }
17};
18// 防止编译器优化
19A return_rvalue(bool test) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected