chsvlib
chsv helper source code

◆ C_auto_ptr() [2/2]

C_auto_ptr ( MyType &&  rrRight)

A move constructor for the C_auto_ptr classes. The standard copy constructor is disallowed for the class (see std::unique_ptr::constructors).

Parameters
rrRightis an rvalue reference to the C_auto_ptr instance of the same template instantiation. The contents of the parameter object is moved into the constructed one.
Remarks
After the construction the created object holds ownership of the pointer and delete of the moved instance of the C_auto_ptr instantiation. This means that the constructor completely ignores the third template argument pFree of the C_auto_ptr template behaving exactly as the appropriate constructor of the std::unique_ptr.
After the construction rrRight looses ownership of the pointer it stored and of its deleter and is left empty. The behaviour of the constructor can be shortly described by the following code:
this->reset(rrRight.release());
this->get_deleter() = rrRight.get_deleter();