(C++) Letting `unique_ptr` have `nullptr` value
Setting a unique_ptr to nullptr is supported by C++11 standard.
-
Declaring a
unique_ptrwithout definition fills the pointer withnullptr -
unique_ptrhas dedicated overloaded assignment operator to update its value- The object previously pointed to by the pointer is destroyed
- Effectively equivalent to
unique_ptr::reset()with no argument
References:
Written on March 9, 2021
