When does std::unique_ptr<A> need a special deleter if A has a destructor?
问题 If the class A in unique_ptr<A> it's own destructor, is it necessary to declare a deleter to ensure that the unique pointer uses that destructor? The example I am thinking of is that A has a member mx of type user_matrix (a name I just made up) which needs to call a function free(...) to release its memory, one would define ~A(){ user_matrix::free(mx); /*etc*/} Since default_deleter<> will call delete , it is my understanding that that should use ~A() . However, the example with the opening