nullを許容しないスマポ
template<typename T>
struct smart_ptr {
...
explicit smart_ptr(T * ptr) : ptr_(ptr) {}
template<typename U>
smart_ptr(smart_ptr<U> const & other) : ptr_(other.get()) {}
smart_ptr & operator=(T * ptr) { ptr_ = ptr; ... return *this; }
template<typename U>
smart_ptr & operator=(smart_ptr<U> const & other) { ptr_ = other.get(); ... return *this; }
private:
explicit smart_ptr(int);
smart_ptr & operator=(int);
};うーんsmart_ptr