diff options
Diffstat (limited to 'boost/smart_ptr/scoped_ptr.hpp')
-rw-r--r-- | boost/smart_ptr/scoped_ptr.hpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/boost/smart_ptr/scoped_ptr.hpp b/boost/smart_ptr/scoped_ptr.hpp index 8fd8a180fb..5325eba5ff 100644 --- a/boost/smart_ptr/scoped_ptr.hpp +++ b/boost/smart_ptr/scoped_ptr.hpp @@ -8,8 +8,7 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -// http://www.boost.org/libs/smart_ptr/scoped_ptr.htm -// +// See http://www.boost.org/libs/smart_ptr/ for documentation. #include <boost/config.hpp> #include <boost/assert.hpp> @@ -63,7 +62,7 @@ public: typedef T element_type; - explicit scoped_ptr( T * p = 0 ) BOOST_SP_NOEXCEPT : px( p ) // never throws + explicit scoped_ptr( T * p = 0 ) BOOST_SP_NOEXCEPT : px( p ) { #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) boost::sp_scalar_constructor_hook( px ); @@ -72,7 +71,7 @@ public: #ifndef BOOST_NO_AUTO_PTR - explicit scoped_ptr( std::auto_ptr<T> p ) BOOST_NOEXCEPT : px( p.release() ) + explicit scoped_ptr( std::auto_ptr<T> p ) BOOST_SP_NOEXCEPT : px( p.release() ) { #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) boost::sp_scalar_constructor_hook( px ); @@ -81,7 +80,7 @@ public: #endif - ~scoped_ptr() // never throws + ~scoped_ptr() BOOST_SP_NOEXCEPT { #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) boost::sp_scalar_destructor_hook( px ); @@ -89,25 +88,25 @@ public: boost::checked_delete( px ); } - void reset(T * p = 0) // never throws + void reset(T * p = 0) BOOST_SP_NOEXCEPT_WITH_ASSERT { BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors this_type(p).swap(*this); } - T & operator*() const // never throws + T & operator*() const BOOST_SP_NOEXCEPT_WITH_ASSERT { BOOST_ASSERT( px != 0 ); return *px; } - T * operator->() const // never throws + T * operator->() const BOOST_SP_NOEXCEPT_WITH_ASSERT { BOOST_ASSERT( px != 0 ); return px; } - T * get() const BOOST_NOEXCEPT + T * get() const BOOST_SP_NOEXCEPT { return px; } @@ -115,7 +114,7 @@ public: // implicit conversion to "bool" #include <boost/smart_ptr/detail/operator_bool.hpp> - void swap(scoped_ptr & b) BOOST_NOEXCEPT + void swap(scoped_ptr & b) BOOST_SP_NOEXCEPT { T * tmp = b.px; b.px = px; @@ -125,36 +124,36 @@ public: #if !defined( BOOST_NO_CXX11_NULLPTR ) -template<class T> inline bool operator==( scoped_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT +template<class T> inline bool operator==( scoped_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT { return p.get() == 0; } -template<class T> inline bool operator==( boost::detail::sp_nullptr_t, scoped_ptr<T> const & p ) BOOST_NOEXCEPT +template<class T> inline bool operator==( boost::detail::sp_nullptr_t, scoped_ptr<T> const & p ) BOOST_SP_NOEXCEPT { return p.get() == 0; } -template<class T> inline bool operator!=( scoped_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT +template<class T> inline bool operator!=( scoped_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT { return p.get() != 0; } -template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, scoped_ptr<T> const & p ) BOOST_NOEXCEPT +template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, scoped_ptr<T> const & p ) BOOST_SP_NOEXCEPT { return p.get() != 0; } #endif -template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) BOOST_NOEXCEPT +template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) BOOST_SP_NOEXCEPT { a.swap(b); } // get_pointer(p) is a generic way to say p.get() -template<class T> inline T * get_pointer(scoped_ptr<T> const & p) BOOST_NOEXCEPT +template<class T> inline T * get_pointer(scoped_ptr<T> const & p) BOOST_SP_NOEXCEPT { return p.get(); } |