forked from boostorg/smart_ptr
Avoid memcpy over a spinlock, because g++ 8 warns
This commit is contained in:
@ -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
|
#else
|
||||||
|
|
||||||
atomic_shared_ptr() BOOST_SP_NOEXCEPT
|
atomic_shared_ptr() BOOST_SP_NOEXCEPT
|
||||||
@ -71,8 +76,6 @@ public:
|
|||||||
std::memcpy( &l_, &init, sizeof( init ) );
|
std::memcpy( &l_, &init, sizeof( init ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
atomic_shared_ptr( shared_ptr<T> p ) BOOST_SP_NOEXCEPT
|
atomic_shared_ptr( shared_ptr<T> p ) BOOST_SP_NOEXCEPT
|
||||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
||||||
: p_( std::move( p ) )
|
: p_( std::move( p ) )
|
||||||
@ -84,6 +87,8 @@ public:
|
|||||||
std::memcpy( &l_, &init, sizeof( init ) );
|
std::memcpy( &l_, &init, sizeof( init ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
atomic_shared_ptr& operator=( shared_ptr<T> r ) BOOST_SP_NOEXCEPT
|
atomic_shared_ptr& operator=( shared_ptr<T> r ) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
boost::detail::spinlock::scoped_lock lock( l_ );
|
boost::detail::spinlock::scoped_lock lock( l_ );
|
||||||
|
Reference in New Issue
Block a user