diff options
Diffstat (limited to 'boost/smart_ptr/intrusive_ref_counter.hpp')
-rw-r--r-- | boost/smart_ptr/intrusive_ref_counter.hpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/boost/smart_ptr/intrusive_ref_counter.hpp b/boost/smart_ptr/intrusive_ref_counter.hpp index b7587ea7a0..c2f918d0a4 100644 --- a/boost/smart_ptr/intrusive_ref_counter.hpp +++ b/boost/smart_ptr/intrusive_ref_counter.hpp @@ -17,6 +17,7 @@ #include <boost/config.hpp> #include <boost/smart_ptr/detail/atomic_count.hpp> +#include <boost/smart_ptr/detail/sp_noexcept.hpp> #ifdef BOOST_HAS_PRAGMA_ONCE #pragma once @@ -45,17 +46,17 @@ struct thread_unsafe_counter { typedef unsigned int type; - static unsigned int load(unsigned int const& counter) BOOST_NOEXCEPT + static unsigned int load(unsigned int const& counter) BOOST_SP_NOEXCEPT { return counter; } - static void increment(unsigned int& counter) BOOST_NOEXCEPT + static void increment(unsigned int& counter) BOOST_SP_NOEXCEPT { ++counter; } - static unsigned int decrement(unsigned int& counter) BOOST_NOEXCEPT + static unsigned int decrement(unsigned int& counter) BOOST_SP_NOEXCEPT { return --counter; } @@ -71,17 +72,17 @@ struct thread_safe_counter { typedef boost::detail::atomic_count type; - static unsigned int load(boost::detail::atomic_count const& counter) BOOST_NOEXCEPT + static unsigned int load(boost::detail::atomic_count const& counter) BOOST_SP_NOEXCEPT { return static_cast< unsigned int >(static_cast< long >(counter)); } - static void increment(boost::detail::atomic_count& counter) BOOST_NOEXCEPT + static void increment(boost::detail::atomic_count& counter) BOOST_SP_NOEXCEPT { ++counter; } - static unsigned int decrement(boost::detail::atomic_count& counter) BOOST_NOEXCEPT + static unsigned int decrement(boost::detail::atomic_count& counter) BOOST_SP_NOEXCEPT { return static_cast< unsigned int >(--counter); } @@ -91,9 +92,9 @@ template< typename DerivedT, typename CounterPolicyT = thread_safe_counter > class intrusive_ref_counter; template< typename DerivedT, typename CounterPolicyT > -void intrusive_ptr_add_ref(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_NOEXCEPT; +void intrusive_ptr_add_ref(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT; template< typename DerivedT, typename CounterPolicyT > -void intrusive_ptr_release(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_NOEXCEPT; +void intrusive_ptr_release(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT; /*! * \brief A reference counter base class @@ -121,7 +122,7 @@ public: * * \post <tt>use_count() == 0</tt> */ - intrusive_ref_counter() BOOST_NOEXCEPT : m_ref_counter(0) + intrusive_ref_counter() BOOST_SP_NOEXCEPT : m_ref_counter(0) { } @@ -130,7 +131,7 @@ public: * * \post <tt>use_count() == 0</tt> */ - intrusive_ref_counter(intrusive_ref_counter const&) BOOST_NOEXCEPT : m_ref_counter(0) + intrusive_ref_counter(intrusive_ref_counter const&) BOOST_SP_NOEXCEPT : m_ref_counter(0) { } @@ -139,12 +140,12 @@ public: * * \post The reference counter is not modified after assignment */ - intrusive_ref_counter& operator= (intrusive_ref_counter const&) BOOST_NOEXCEPT { return *this; } + intrusive_ref_counter& operator= (intrusive_ref_counter const&) BOOST_SP_NOEXCEPT { return *this; } /*! * \return The reference counter */ - unsigned int use_count() const BOOST_NOEXCEPT + unsigned int use_count() const BOOST_SP_NOEXCEPT { return CounterPolicyT::load(m_ref_counter); } @@ -155,18 +156,18 @@ protected: */ BOOST_DEFAULTED_FUNCTION(~intrusive_ref_counter(), {}) - friend void intrusive_ptr_add_ref< DerivedT, CounterPolicyT >(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_NOEXCEPT; - friend void intrusive_ptr_release< DerivedT, CounterPolicyT >(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_NOEXCEPT; + friend void intrusive_ptr_add_ref< DerivedT, CounterPolicyT >(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT; + friend void intrusive_ptr_release< DerivedT, CounterPolicyT >(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT; }; template< typename DerivedT, typename CounterPolicyT > -inline void intrusive_ptr_add_ref(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_NOEXCEPT +inline void intrusive_ptr_add_ref(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT { CounterPolicyT::increment(p->m_ref_counter); } template< typename DerivedT, typename CounterPolicyT > -inline void intrusive_ptr_release(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_NOEXCEPT +inline void intrusive_ptr_release(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT { if (CounterPolicyT::decrement(p->m_ref_counter) == 0) delete static_cast< const DerivedT* >(p); |