{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

36 ios beijing university of posts telecommunications

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 不抛出异常 ~auto_ptr() throw() { delete ptr; } //注意,复制构造函数和赋值都用非const参数 auto_ptr(auto_ptr& a) throw(); // 复制,而后a.ptr=0 template<class Y> auto_ptr(auto_ptr<Y>& a) throw(); // 复制,而后a.ptr=0 auto_ptr& operator=(auto_ptr& a) throw(); // 复制,而后a.ptr=0 template<class Y> auto_ptr& operator=(auto_ptr<Y>& a) throw(); // 复制,而后a.ptr=0 Beijing University of Posts & Telecommunications Beijing [email protected] auto_ptr的声明 // 运算符重载 X& operator*() const throw() { return *ptr; } X* operator->() const throw() { return ptr; } X* get() const throw() { return ptr; } // 提取指针 X* release() throw() { X* t=ptr; ptr=0; return t; } // 放弃所有权 void reset(X* p=0) throw() { if(p!=ptr) {delete ptr; ptr=p; }} }; auto_ptr(auto_ptr_ref<X...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online