Control object Copy, assignment, destructor
Copy constructor, move constructor
Copy assignment operator, move assignment operator
Destructors
--------------------------------------------------------------------------------------------------------------- ----------------------
1. Copy constructor: The parameter must be a reference type &, typically a const
The 1th parameter of a copy constructor refers to a reference to its own class type
2. Copy assignment operator: essentially operator function overloading
3. Destructors: Releasing and destroying objects, no return value
Requires the compiler to generate a composite version of the copy constructor, copy assignment operator, and destructor using "=default"
block copy : 1) define deleted functions: Copy constructor, copy assignment operator using "=delete"
2) destructor cannot be a deleted member
3) Private Copy Control: copy constructor, copy assignment operator using "private"
Object Movement : For objects that are destroyed after some copies, moving, not copying, can significantly improve performance
New standard in order to support the move Operation , a new reference type is introduced: rvalue reference:&&
An rvalue reference can only be bound to an object that is about to be destroyed:int &&r=42; rvalue reference (int &r=i is a generic lvalue reference)
Or use the standard move function Move (): int &&r=move (r1);
C + + notes (11): Copy Control (copy move, construct assignment, destructor)