mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-30 04:47:12 +02:00
Remove uses of BOOST_SP_NOEXCEPT from weak_ptr.hpp
This commit is contained in:
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
#include <boost/smart_ptr/detail/shared_count.hpp>
|
#include <boost/smart_ptr/detail/shared_count.hpp>
|
||||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||||
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
@ -33,18 +32,18 @@ public:
|
|||||||
|
|
||||||
typedef typename boost::detail::sp_element< T >::type element_type;
|
typedef typename boost::detail::sp_element< T >::type element_type;
|
||||||
|
|
||||||
BOOST_CONSTEXPR weak_ptr() BOOST_SP_NOEXCEPT : px(0), pn()
|
BOOST_CONSTEXPR weak_ptr() noexcept : px(0), pn()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// generated copy constructor, assignment, destructor are fine...
|
// generated copy constructor, assignment, destructor are fine...
|
||||||
// ... except in C++0x, move disables the implicit copy
|
// ... except in C++0x, move disables the implicit copy
|
||||||
|
|
||||||
weak_ptr( weak_ptr const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn )
|
weak_ptr( weak_ptr const & r ) noexcept : px( r.px ), pn( r.pn )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
weak_ptr & operator=( weak_ptr const & r ) BOOST_SP_NOEXCEPT
|
weak_ptr & operator=( weak_ptr const & r ) noexcept
|
||||||
{
|
{
|
||||||
px = r.px;
|
px = r.px;
|
||||||
pn = r.pn;
|
pn = r.pn;
|
||||||
@ -70,14 +69,14 @@ public:
|
|||||||
|
|
||||||
template<class Y>
|
template<class Y>
|
||||||
weak_ptr( weak_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
|
weak_ptr( weak_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
|
||||||
BOOST_SP_NOEXCEPT : px(r.lock().get()), pn(r.pn)
|
noexcept : px(r.lock().get()), pn(r.pn)
|
||||||
{
|
{
|
||||||
boost::detail::sp_assert_convertible< Y, T >();
|
boost::detail::sp_assert_convertible< Y, T >();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Y>
|
template<class Y>
|
||||||
weak_ptr( weak_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
|
weak_ptr( weak_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
|
||||||
BOOST_SP_NOEXCEPT : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) )
|
noexcept : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) )
|
||||||
{
|
{
|
||||||
boost::detail::sp_assert_convertible< Y, T >();
|
boost::detail::sp_assert_convertible< Y, T >();
|
||||||
r.px = 0;
|
r.px = 0;
|
||||||
@ -85,13 +84,13 @@ public:
|
|||||||
|
|
||||||
// for better efficiency in the T == Y case
|
// for better efficiency in the T == Y case
|
||||||
weak_ptr( weak_ptr && r )
|
weak_ptr( weak_ptr && r )
|
||||||
BOOST_SP_NOEXCEPT : px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) )
|
noexcept : px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) )
|
||||||
{
|
{
|
||||||
r.px = 0;
|
r.px = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for better efficiency in the T == Y case
|
// for better efficiency in the T == Y case
|
||||||
weak_ptr & operator=( weak_ptr && r ) BOOST_SP_NOEXCEPT
|
weak_ptr & operator=( weak_ptr && r ) noexcept
|
||||||
{
|
{
|
||||||
this_type( static_cast< weak_ptr && >( r ) ).swap( *this );
|
this_type( static_cast< weak_ptr && >( r ) ).swap( *this );
|
||||||
return *this;
|
return *this;
|
||||||
@ -100,26 +99,26 @@ public:
|
|||||||
|
|
||||||
template<class Y>
|
template<class Y>
|
||||||
weak_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
|
weak_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
|
||||||
BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn )
|
noexcept : px( r.px ), pn( r.pn )
|
||||||
{
|
{
|
||||||
boost::detail::sp_assert_convertible< Y, T >();
|
boost::detail::sp_assert_convertible< Y, T >();
|
||||||
}
|
}
|
||||||
|
|
||||||
// aliasing
|
// aliasing
|
||||||
template<class Y> weak_ptr(shared_ptr<Y> const & r, element_type * p) BOOST_SP_NOEXCEPT: px( p ), pn( r.pn )
|
template<class Y> weak_ptr(shared_ptr<Y> const & r, element_type * p) noexcept: px( p ), pn( r.pn )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Y> weak_ptr(weak_ptr<Y> const & r, element_type * p) BOOST_SP_NOEXCEPT: px( p ), pn( r.pn )
|
template<class Y> weak_ptr(weak_ptr<Y> const & r, element_type * p) noexcept: px( p ), pn( r.pn )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Y> weak_ptr(weak_ptr<Y> && r, element_type * p) BOOST_SP_NOEXCEPT: px( p ), pn( std::move( r.pn ) )
|
template<class Y> weak_ptr(weak_ptr<Y> && r, element_type * p) noexcept: px( p ), pn( std::move( r.pn ) )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Y>
|
template<class Y>
|
||||||
weak_ptr & operator=( weak_ptr<Y> const & r ) BOOST_SP_NOEXCEPT
|
weak_ptr & operator=( weak_ptr<Y> const & r ) noexcept
|
||||||
{
|
{
|
||||||
boost::detail::sp_assert_convertible< Y, T >();
|
boost::detail::sp_assert_convertible< Y, T >();
|
||||||
|
|
||||||
@ -130,14 +129,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class Y>
|
template<class Y>
|
||||||
weak_ptr & operator=( weak_ptr<Y> && r ) BOOST_SP_NOEXCEPT
|
weak_ptr & operator=( weak_ptr<Y> && r ) noexcept
|
||||||
{
|
{
|
||||||
this_type( static_cast< weak_ptr<Y> && >( r ) ).swap( *this );
|
this_type( static_cast< weak_ptr<Y> && >( r ) ).swap( *this );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Y>
|
template<class Y>
|
||||||
weak_ptr & operator=( shared_ptr<Y> const & r ) BOOST_SP_NOEXCEPT
|
weak_ptr & operator=( shared_ptr<Y> const & r ) noexcept
|
||||||
{
|
{
|
||||||
boost::detail::sp_assert_convertible< Y, T >();
|
boost::detail::sp_assert_convertible< Y, T >();
|
||||||
|
|
||||||
@ -147,63 +146,63 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<T> lock() const BOOST_SP_NOEXCEPT
|
shared_ptr<T> lock() const noexcept
|
||||||
{
|
{
|
||||||
return shared_ptr<T>( *this, boost::detail::sp_nothrow_tag() );
|
return shared_ptr<T>( *this, boost::detail::sp_nothrow_tag() );
|
||||||
}
|
}
|
||||||
|
|
||||||
long use_count() const BOOST_SP_NOEXCEPT
|
long use_count() const noexcept
|
||||||
{
|
{
|
||||||
return pn.use_count();
|
return pn.use_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool expired() const BOOST_SP_NOEXCEPT
|
bool expired() const noexcept
|
||||||
{
|
{
|
||||||
return pn.use_count() == 0;
|
return pn.use_count() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _empty() const BOOST_SP_NOEXCEPT // extension, not in std::weak_ptr
|
bool _empty() const noexcept // extension, not in std::weak_ptr
|
||||||
{
|
{
|
||||||
return pn.empty();
|
return pn.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool empty() const BOOST_SP_NOEXCEPT // extension, not in std::weak_ptr
|
bool empty() const noexcept // extension, not in std::weak_ptr
|
||||||
{
|
{
|
||||||
return pn.empty();
|
return pn.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() BOOST_SP_NOEXCEPT
|
void reset() noexcept
|
||||||
{
|
{
|
||||||
this_type().swap(*this);
|
this_type().swap(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void swap(this_type & other) BOOST_SP_NOEXCEPT
|
void swap(this_type & other) noexcept
|
||||||
{
|
{
|
||||||
std::swap(px, other.px);
|
std::swap(px, other.px);
|
||||||
pn.swap(other.pn);
|
pn.swap(other.pn);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT
|
template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const noexcept
|
||||||
{
|
{
|
||||||
return pn < rhs.pn;
|
return pn < rhs.pn;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT
|
template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const noexcept
|
||||||
{
|
{
|
||||||
return pn < rhs.pn;
|
return pn < rhs.pn;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Y> bool owner_equals( weak_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT
|
template<class Y> bool owner_equals( weak_ptr<Y> const & rhs ) const noexcept
|
||||||
{
|
{
|
||||||
return pn == rhs.pn;
|
return pn == rhs.pn;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Y> bool owner_equals( shared_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT
|
template<class Y> bool owner_equals( shared_ptr<Y> const & rhs ) const noexcept
|
||||||
{
|
{
|
||||||
return pn == rhs.pn;
|
return pn == rhs.pn;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t owner_hash_value() const BOOST_SP_NOEXCEPT
|
std::size_t owner_hash_value() const noexcept
|
||||||
{
|
{
|
||||||
return pn.hash_value();
|
return pn.hash_value();
|
||||||
}
|
}
|
||||||
@ -218,12 +217,12 @@ private:
|
|||||||
|
|
||||||
}; // weak_ptr
|
}; // weak_ptr
|
||||||
|
|
||||||
template<class T, class U> inline bool operator<(weak_ptr<T> const & a, weak_ptr<U> const & b) BOOST_SP_NOEXCEPT
|
template<class T, class U> inline bool operator<(weak_ptr<T> const & a, weak_ptr<U> const & b) noexcept
|
||||||
{
|
{
|
||||||
return a.owner_before( b );
|
return a.owner_before( b );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) BOOST_SP_NOEXCEPT
|
template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) noexcept
|
||||||
{
|
{
|
||||||
a.swap(b);
|
a.swap(b);
|
||||||
}
|
}
|
||||||
@ -236,7 +235,7 @@ template<class T> weak_ptr( shared_ptr<T> ) -> weak_ptr<T>;
|
|||||||
|
|
||||||
// hash_value
|
// hash_value
|
||||||
|
|
||||||
template< class T > std::size_t hash_value( boost::weak_ptr<T> const & p ) BOOST_SP_NOEXCEPT
|
template< class T > std::size_t hash_value( boost::weak_ptr<T> const & p ) noexcept
|
||||||
{
|
{
|
||||||
return p.owner_hash_value();
|
return p.owner_hash_value();
|
||||||
}
|
}
|
||||||
@ -250,7 +249,7 @@ namespace std
|
|||||||
|
|
||||||
template<class T> struct hash< ::boost::weak_ptr<T> >
|
template<class T> struct hash< ::boost::weak_ptr<T> >
|
||||||
{
|
{
|
||||||
std::size_t operator()( ::boost::weak_ptr<T> const & p ) const BOOST_SP_NOEXCEPT
|
std::size_t operator()( ::boost::weak_ptr<T> const & p ) const noexcept
|
||||||
{
|
{
|
||||||
return p.owner_hash_value();
|
return p.owner_hash_value();
|
||||||
}
|
}
|
||||||
@ -258,7 +257,7 @@ template<class T> struct hash< ::boost::weak_ptr<T> >
|
|||||||
|
|
||||||
template<class T> struct equal_to< ::boost::weak_ptr<T> >
|
template<class T> struct equal_to< ::boost::weak_ptr<T> >
|
||||||
{
|
{
|
||||||
bool operator()( ::boost::weak_ptr<T> const & a, ::boost::weak_ptr<T> const & b ) const BOOST_SP_NOEXCEPT
|
bool operator()( ::boost::weak_ptr<T> const & a, ::boost::weak_ptr<T> const & b ) const noexcept
|
||||||
{
|
{
|
||||||
return a.owner_equals( b );
|
return a.owner_equals( b );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user