Re[3]: [BUG] VS 8.0 std::auto_ptr
От: Pavel Chikulaev Россия  
Дата: 23.02.06 09:44
Оценка:
Здравствуйте, VNG, Вы писали:


VNG>Не лечится. Так не будет компилироваться код:

VNG>
VNG>std::auto_ptr<int> ptr(new int(0));
VNG>ptr = new int(1);
VNG>

А он и не должен. См. 20.4.5/2

namespace std {
template <class Y> struct auto_ptr_ref {};
template<class X> class auto_ptr {
public:
typedef X element_type;
// 20.4.5.1 construct/copy/destroy:
explicit auto_ptr(X* p =0) throw();
auto_ptr(auto_ptr&) throw();
template<class Y> auto_ptr(auto_ptr<Y>&) throw();
auto_ptr& operator=(auto_ptr&) throw();
template<class Y> auto_ptr& operator=(auto_ptr<Y>&) throw();
auto_ptr& operator=(auto_ptr_ref<X> r) throw();
˜auto_ptr() throw();
// 20.4.5.2 members:
X& operator*() const throw();
X* operator->() const throw();
X* get() const throw();
X* release() throw();
void reset(X* p =0) throw();
// 20.4.5.3 conversions:
auto_ptr(auto_ptr_ref<X>) throw();
template<class Y> operator auto_ptr_ref<Y>() throw();
template<class Y> operator auto_ptr<Y>() throw();
};
}

 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.