added an auto_ptr & constructor to shared_count

[SVN r12623]
This commit is contained in:
Peter Dimov
2002-02-01 18:40:35 +00:00
parent 4fdc84f29e
commit 39c10f739d

View File

@ -16,6 +16,13 @@
// warranty, and with no claim as to its suitability for any purpose.
//
#include <boost/config.hpp>
#ifndef BOOST_NO_AUTO_PTR
# include <memory>
#endif
#include <boost/checked_delete.hpp>
#include <boost/detail/atomic_count.hpp>
namespace boost
@ -160,6 +167,18 @@ public:
}
}
#ifndef BOOST_NO_AUTO_PTR
// auto_ptr<Y> is special cased to provide the strong guarantee
template<typename Y>
explicit shared_count(std::auto_ptr<Y> & r): pi_(new counted_base_impl< Y *, checked_deleter<Y> >(r.get(), checked_deleter<Y>(), 1, 1))
{
r.release();
}
#endif
~shared_count() // nothrow
{
pi_->release();