aboutsummaryrefslogtreecommitdiff
path: root/cutl/details/boost/smart_ptr/scoped_ptr.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'cutl/details/boost/smart_ptr/scoped_ptr.hpp')
-rw-r--r--cutl/details/boost/smart_ptr/scoped_ptr.hpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/cutl/details/boost/smart_ptr/scoped_ptr.hpp b/cutl/details/boost/smart_ptr/scoped_ptr.hpp
index cd2b2d3..4ddda13 100644
--- a/cutl/details/boost/smart_ptr/scoped_ptr.hpp
+++ b/cutl/details/boost/smart_ptr/scoped_ptr.hpp
@@ -11,8 +11,10 @@
// http://www.boost.org/libs/smart_ptr/scoped_ptr.htm
//
+#include <cutl/details/boost/config.hpp>
#include <cutl/details/boost/assert.hpp>
#include <cutl/details/boost/checked_delete.hpp>
+#include <cutl/details/boost/smart_ptr/detail/sp_nullptr_t.hpp>
#include <cutl/details/boost/detail/workaround.hpp>
#ifndef BOOST_NO_AUTO_PTR
@@ -63,7 +65,7 @@ public:
#ifndef BOOST_NO_AUTO_PTR
- explicit scoped_ptr( std::auto_ptr<T> p ): px( p.release() ) // never throws
+ explicit scoped_ptr( std::auto_ptr<T> p ) BOOST_NOEXCEPT : px( p.release() )
{
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
cutl_details_boost::sp_scalar_constructor_hook( px );
@@ -98,7 +100,7 @@ public:
return px;
}
- T * get() const // never throws
+ T * get() const BOOST_NOEXCEPT
{
return px;
}
@@ -106,7 +108,7 @@ public:
// implicit conversion to "bool"
#include <cutl/details/boost/smart_ptr/detail/operator_bool.hpp>
- void swap(scoped_ptr & b) // never throws
+ void swap(scoped_ptr & b) BOOST_NOEXCEPT
{
T * tmp = b.px;
b.px = px;
@@ -114,14 +116,38 @@ public:
}
};
-template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) // never throws
+#if !defined( BOOST_NO_CXX11_NULLPTR )
+
+template<class T> inline bool operator==( scoped_ptr<T> const & p, cutl_details_boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
+{
+ return p.get() == 0;
+}
+
+template<class T> inline bool operator==( cutl_details_boost::detail::sp_nullptr_t, scoped_ptr<T> const & p ) BOOST_NOEXCEPT
+{
+ return p.get() == 0;
+}
+
+template<class T> inline bool operator!=( scoped_ptr<T> const & p, cutl_details_boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
+{
+ return p.get() != 0;
+}
+
+template<class T> inline bool operator!=( cutl_details_boost::detail::sp_nullptr_t, scoped_ptr<T> const & p ) BOOST_NOEXCEPT
+{
+ return p.get() != 0;
+}
+
+#endif
+
+template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) BOOST_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)
+template<class T> inline T * get_pointer(scoped_ptr<T> const & p) BOOST_NOEXCEPT
{
return p.get();
}