new
always requires a matching delete
delete
std::unique_ptr
and std::shared_ptr
templated classes release the object in their destructors
*
and ->
source: https://courses.cs.washington.edu/courses/cse333/22wi/lectures/16/16-smartptrs_22wi_ink.pdf
ToyPtr
How many times is called delete
?
std::unique_ptr<T>
std::shared_ptr<T>