[問題] auto_ptr_ref的功用

看板C_and_CPP (C/C++)作者 ( )時間16年前 (2009/04/30 00:15), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
請問auto_ptr的實作中為什麼要多定義 auto_ptr(auto_ptr_ref<T> rhs) throw() : ap(rhs.yp) { } auto_ptr& operator= (auto_ptr_ref<T> rhs) throw() { // new reset(rhs.yp); return *this; } template<class Y> operator auto_ptr_ref<Y>() throw() { return auto_ptr_ref<Y>(release()); } template<class Y> operator auto_ptr<Y>() throw() { return auto_ptr<Y>(release()); } 其他的CODE的在http://www.josuttis.com/libbook/util/autoptr.hpp.html 看不太懂這些出現的時機。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.169.194.109
文章代碼(AID): #19-7qW23 (C_and_CPP)
文章代碼(AID): #19-7qW23 (C_and_CPP)