От: | Aera | ||
Дата: | 11.10.04 03:37 | ||
Оценка: |
template<class Y> shared_ptr(std::auto_ptr<Y> & r);
[This constructor takes a the source auto_ptr by reference and not by value, and cannot accept auto_ptr temporaries. This is by design, as the constructor offers the strong guarantee; an rvalue reference would solve this problem, too.]
От: | Sergey Shelomencev | ||
Дата: | 11.10.04 04:38 | ||
Оценка: | 2 (2) |
A>template<class Y> shared_ptr(std::auto_ptr<Y> & r);
A>[This constructor takes a the source auto_ptr by reference and not by value, and cannot accept auto_ptr temporaries. This is by design, as the constructor offers the strong guarantee; an rvalue reference would solve this problem, too.]
int _tmain(int argc, _TCHAR* argv[])
{
std::auto_ptr< int > a_ptr( new int );
try
{
// Если генерируется исключение здесь
boost::shared_ptr< int > s_ptr( ap );
}
catch( ... )
{
}
// Место 1
// Здесь у тебя auto_ptr все еще владеет указателем
}
От: | korzhik | ||
Дата: | 11.10.04 05:05 | ||
Оценка: |
A>template<class Y> shared_ptr(std::auto_ptr<Y> & r);
A>[This constructor takes a the source auto_ptr by reference and not by value, and cannot accept auto_ptr temporaries. This is by design, as the constructor offers the strong guarantee; an rvalue reference would solve this problem, too.]