Avoid memcpy over a spinlock, because g++ 8 warns

This commit is contained in:
Peter Dimov
2019-04-22 02:17:28 +03:00
parent 7c76fb385d
commit 2122c7753c

View File

@ -63,6 +63,11 @@ public:
{
}
atomic_shared_ptr( shared_ptr<T> p ) BOOST_SP_NOEXCEPT
: p_( std::move( p ) ), l_ BOOST_DETAIL_SPINLOCK_INIT
{
}
#else
atomic_shared_ptr() BOOST_SP_NOEXCEPT
@ -71,8 +76,6 @@ public:
std::memcpy( &l_, &init, sizeof( init ) );
}
#endif
atomic_shared_ptr( shared_ptr<T> p ) BOOST_SP_NOEXCEPT
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
: p_( std::move( p ) )
@ -84,6 +87,8 @@ public:
std::memcpy( &l_, &init, sizeof( init ) );
}
#endif
atomic_shared_ptr& operator=( shared_ptr<T> r ) BOOST_SP_NOEXCEPT
{
boost::detail::spinlock::scoped_lock lock( l_ );