shared_ptr aliasing constructor
问题 Question about following shared_ptr constructor: template< class Y > shared_ptr( const shared_ptr<Y>& r, T *ptr ); Am I correct that if r was created using user-provided deleter, then aliasing shared_ptr knows that. So if aliasing shared_ptr is last in the group and (when going out of scope) destructs resources originally managed by r , it will use that user-provided deleter? 回答1: Example: #include <iostream> #include <iomanip> struct some_type { int i; }; void my_deleter(some_type* p) { std: