Add shared_ptr constructor taking std::unique_ptr. Refs #6625.

[SVN r81131]
This commit is contained in:
Peter Dimov committed 2012-10-31 22:16:20 +00:00
1 parent 10dcb8db7c
commit 0c22e55f3e
4 files changed
+228

No files matched your search

+12
View File
@@ -298,6 +298,18 @@ public:
#endif // BOOST_NO_AUTO_PTR
#if !defined( BOOST_NO_CXX11_SMART_PTR )
template< class Y, class D >
shared_ptr( std::unique_ptr< Y, D > && r): px( r.get() ), pn()
{
Y * tmp = r.get();
pn = boost::detail::shared_count( r );
boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
}
#endif
// assignment
shared_ptr & operator=( shared_ptr const & r ) // never throws