|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81368 - in trunk/boost/smart_ptr: . detail
From: pdimov_at_[hidden]
Date: 2012-11-16 10:05:26
Author: pdimov
Date: 2012-11-16 10:05:25 EST (Fri, 16 Nov 2012)
New Revision: 81368
URL: http://svn.boost.org/trac/boost/changeset/81368
Log:
Apply BOOST_NOEXCEPT patch. Refs #7523.
Text files modified:
trunk/boost/smart_ptr/detail/operator_bool.hpp | 10 ++--
trunk/boost/smart_ptr/enable_shared_from_this.hpp | 8 ++--
trunk/boost/smart_ptr/intrusive_ptr.hpp | 12 +++---
trunk/boost/smart_ptr/make_shared_object.hpp | 10 ++--
trunk/boost/smart_ptr/scoped_array.hpp | 12 +++---
trunk/boost/smart_ptr/scoped_ptr.hpp | 10 ++--
trunk/boost/smart_ptr/shared_array.hpp | 38 ++++++++++----------
trunk/boost/smart_ptr/shared_ptr.hpp | 76 +++++++++++++++++++++------------------
trunk/boost/smart_ptr/weak_ptr.hpp | 41 +++++++++++----------
9 files changed, 112 insertions(+), 105 deletions(-)
Modified: trunk/boost/smart_ptr/detail/operator_bool.hpp
==============================================================================
--- trunk/boost/smart_ptr/detail/operator_bool.hpp (original)
+++ trunk/boost/smart_ptr/detail/operator_bool.hpp 2012-11-16 10:05:25 EST (Fri, 16 Nov 2012)
@@ -8,7 +8,7 @@
#if ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__)
- operator bool () const
+ operator bool () const BOOST_NOEXCEPT
{
return px != 0;
}
@@ -21,7 +21,7 @@
typedef void (*unspecified_bool_type)( this_type*** );
- operator unspecified_bool_type() const // never throws
+ operator unspecified_bool_type() const BOOST_NOEXCEPT
{
return px == 0? 0: unspecified_bool;
}
@@ -33,7 +33,7 @@
typedef element_type * (this_type::*unspecified_bool_type)() const;
- operator unspecified_bool_type() const // never throws
+ operator unspecified_bool_type() const BOOST_NOEXCEPT
{
return px == 0? 0: &this_type::get;
}
@@ -42,7 +42,7 @@
typedef element_type * this_type::*unspecified_bool_type;
- operator unspecified_bool_type() const // never throws
+ operator unspecified_bool_type() const BOOST_NOEXCEPT
{
return px == 0? 0: &this_type::px;
}
@@ -50,7 +50,7 @@
#endif
// operator! is redundant, but some compilers need it
- bool operator! () const // never throws
+ bool operator! () const BOOST_NOEXCEPT
{
return px == 0;
}
Modified: trunk/boost/smart_ptr/enable_shared_from_this.hpp
==============================================================================
--- trunk/boost/smart_ptr/enable_shared_from_this.hpp (original)
+++ trunk/boost/smart_ptr/enable_shared_from_this.hpp 2012-11-16 10:05:25 EST (Fri, 16 Nov 2012)
@@ -25,20 +25,20 @@
{
protected:
- enable_shared_from_this()
+ enable_shared_from_this() BOOST_NOEXCEPT
{
}
- enable_shared_from_this(enable_shared_from_this const &)
+ enable_shared_from_this(enable_shared_from_this const &) BOOST_NOEXCEPT
{
}
- enable_shared_from_this & operator=(enable_shared_from_this const &)
+ enable_shared_from_this & operator=(enable_shared_from_this const &) BOOST_NOEXCEPT
{
return *this;
}
- ~enable_shared_from_this()
+ ~enable_shared_from_this() BOOST_NOEXCEPT // ~weak_ptr<T> newer throws, so this call also must not throw
{
}
Modified: trunk/boost/smart_ptr/intrusive_ptr.hpp
==============================================================================
--- trunk/boost/smart_ptr/intrusive_ptr.hpp (original)
+++ trunk/boost/smart_ptr/intrusive_ptr.hpp 2012-11-16 10:05:25 EST (Fri, 16 Nov 2012)
@@ -58,7 +58,7 @@
typedef T element_type;
- intrusive_ptr(): px( 0 )
+ intrusive_ptr() BOOST_NOEXCEPT : px( 0 )
{
}
@@ -110,12 +110,12 @@
#if defined( BOOST_HAS_RVALUE_REFS )
- intrusive_ptr(intrusive_ptr && rhs): px( rhs.px )
+ intrusive_ptr(intrusive_ptr && rhs) BOOST_NOEXCEPT : px( rhs.px )
{
rhs.px = 0;
}
- intrusive_ptr & operator=(intrusive_ptr && rhs)
+ intrusive_ptr & operator=(intrusive_ptr && rhs) BOOST_NOEXCEPT
{
this_type( static_cast< intrusive_ptr && >( rhs ) ).swap(*this);
return *this;
@@ -135,7 +135,7 @@
return *this;
}
- void reset()
+ void reset() BOOST_NOEXCEPT
{
this_type().swap( *this );
}
@@ -145,7 +145,7 @@
this_type( rhs ).swap( *this );
}
- T * get() const
+ T * get() const BOOST_NOEXCEPT
{
return px;
}
@@ -165,7 +165,7 @@
// implicit conversion to "bool"
#include <boost/smart_ptr/detail/operator_bool.hpp>
- void swap(intrusive_ptr & rhs)
+ void swap(intrusive_ptr & rhs) BOOST_NOEXCEPT
{
T * tmp = px;
px = rhs.px;
Modified: trunk/boost/smart_ptr/make_shared_object.hpp
==============================================================================
--- trunk/boost/smart_ptr/make_shared_object.hpp (original)
+++ trunk/boost/smart_ptr/make_shared_object.hpp 2012-11-16 10:05:25 EST (Fri, 16 Nov 2012)
@@ -67,12 +67,12 @@
public:
- sp_ms_deleter(): initialized_( false )
+ sp_ms_deleter() BOOST_NOEXCEPT : initialized_( false )
{
}
// optimization: do not copy storage_
- sp_ms_deleter( sp_ms_deleter const & ): initialized_( false )
+ sp_ms_deleter( sp_ms_deleter const & ) BOOST_NOEXCEPT : initialized_( false )
{
}
@@ -86,12 +86,12 @@
destroy();
}
- void * address()
+ void * address() BOOST_NOEXCEPT
{
return storage_.data_;
}
- void set_initialized()
+ void set_initialized() BOOST_NOEXCEPT
{
initialized_ = true;
}
@@ -99,7 +99,7 @@
#if defined( BOOST_HAS_RVALUE_REFS )
-template< class T > T&& sp_forward( T & t )
+template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT
{
return static_cast< T&& >( t );
}
Modified: trunk/boost/smart_ptr/scoped_array.hpp
==============================================================================
--- trunk/boost/smart_ptr/scoped_array.hpp (original)
+++ trunk/boost/smart_ptr/scoped_array.hpp 2012-11-16 10:05:25 EST (Fri, 16 Nov 2012)
@@ -53,7 +53,7 @@
typedef T element_type;
- explicit scoped_array( T * p = 0 ) : px( p ) // never throws
+ explicit scoped_array( T * p = 0 ) BOOST_NOEXCEPT : px( p )
{
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
boost::sp_array_constructor_hook( px );
@@ -68,20 +68,20 @@
boost::checked_array_delete( px );
}
- void reset(T * p = 0) // never throws
+ void reset(T * p = 0) // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
{
BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
this_type(p).swap(*this);
}
- T & operator[](std::ptrdiff_t i) const // never throws
+ T & operator[](std::ptrdiff_t i) const // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
{
BOOST_ASSERT( px != 0 );
BOOST_ASSERT( i >= 0 );
return px[i];
}
- T * get() const // never throws
+ T * get() const BOOST_NOEXCEPT
{
return px;
}
@@ -89,7 +89,7 @@
// implicit conversion to "bool"
#include <boost/smart_ptr/detail/operator_bool.hpp>
- void swap(scoped_array & b) // never throws
+ void swap(scoped_array & b) BOOST_NOEXCEPT
{
T * tmp = b.px;
b.px = px;
@@ -97,7 +97,7 @@
}
};
-template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) // never throws
+template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) BOOST_NOEXCEPT
{
a.swap(b);
}
Modified: trunk/boost/smart_ptr/scoped_ptr.hpp
==============================================================================
--- trunk/boost/smart_ptr/scoped_ptr.hpp (original)
+++ trunk/boost/smart_ptr/scoped_ptr.hpp 2012-11-16 10:05:25 EST (Fri, 16 Nov 2012)
@@ -63,7 +63,7 @@
#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)
boost::sp_scalar_constructor_hook( px );
@@ -98,7 +98,7 @@
return px;
}
- T * get() const // never throws
+ T * get() const BOOST_NOEXCEPT
{
return px;
}
@@ -106,7 +106,7 @@
// implicit conversion to "bool"
#include <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 +114,14 @@
}
};
-template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) // never throws
+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();
}
Modified: trunk/boost/smart_ptr/shared_array.hpp
==============================================================================
--- trunk/boost/smart_ptr/shared_array.hpp (original)
+++ trunk/boost/smart_ptr/shared_array.hpp 2012-11-16 10:05:25 EST (Fri, 16 Nov 2012)
@@ -56,7 +56,7 @@
typedef T element_type;
- shared_array(): px( 0 ), pn() // never throws
+ shared_array() BOOST_NOEXCEPT : px( 0 ), pn()
{
}
@@ -90,11 +90,11 @@
// ... except in C++0x, move disables the implicit copy
- shared_array( shared_array const & r ): px( r.px ), pn( r.pn ) // never throws
+ shared_array( shared_array const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
{
}
- shared_array( shared_array && r ): px( r.px ), pn() // never throws
+ shared_array( shared_array && r ) BOOST_NOEXCEPT : px( r.px ), pn()
{
pn.swap( r.pn );
r.px = 0;
@@ -114,7 +114,7 @@
shared_array( shared_array<Y> const & r )
#endif
- : px( r.px ), pn( r.pn ) // never throws
+ BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) // never throws
{
boost::detail::sp_assert_convertible< Y[], T[] >();
}
@@ -122,13 +122,13 @@
// aliasing
template< class Y >
- shared_array( shared_array<Y> const & r, element_type * p ): px( p ), pn( r.pn ) // never throws
+ shared_array( shared_array<Y> const & r, element_type * p ) BOOST_NOEXCEPT : px( p ), pn( r.pn )
{
}
// assignment
- shared_array & operator=( shared_array const & r ) // never throws
+ shared_array & operator=( shared_array const & r ) BOOST_NOEXCEPT
{
this_type( r ).swap( *this );
return *this;
@@ -137,7 +137,7 @@
#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400)
template<class Y>
- shared_array & operator=( shared_array<Y> const & r ) // never throws
+ shared_array & operator=( shared_array<Y> const & r ) BOOST_NOEXCEPT
{
this_type( r ).swap( *this );
return *this;
@@ -147,14 +147,14 @@
#if defined( BOOST_HAS_RVALUE_REFS )
- shared_array & operator=( shared_array && r ) // never throws
+ shared_array & operator=( shared_array && r ) BOOST_NOEXCEPT
{
this_type( static_cast< shared_array && >( r ) ).swap( *this );
return *this;
}
template<class Y>
- shared_array & operator=( shared_array<Y> && r ) // never throws
+ shared_array & operator=( shared_array<Y> && r ) BOOST_NOEXCEPT
{
this_type( static_cast< shared_array<Y> && >( r ) ).swap( *this );
return *this;
@@ -162,7 +162,7 @@
#endif
- void reset() // never throws
+ void reset() BOOST_NOEXCEPT
{
this_type().swap( *this );
}
@@ -188,14 +188,14 @@
this_type( r, p ).swap( *this );
}
- T & operator[] (std::ptrdiff_t i) const // never throws
+ T & operator[] (std::ptrdiff_t i) const // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
{
BOOST_ASSERT(px != 0);
BOOST_ASSERT(i >= 0);
return px[i];
}
- T * get() const // never throws
+ T * get() const BOOST_NOEXCEPT
{
return px;
}
@@ -203,17 +203,17 @@
// implicit conversion to "bool"
#include <boost/smart_ptr/detail/operator_bool.hpp>
- bool unique() const // never throws
+ bool unique() const BOOST_NOEXCEPT
{
return pn.unique();
}
- long use_count() const // never throws
+ long use_count() const BOOST_NOEXCEPT
{
return pn.use_count();
}
- void swap(shared_array<T> & other) // never throws
+ void swap(shared_array<T> & other) BOOST_NOEXCEPT
{
std::swap(px, other.px);
pn.swap(other.pn);
@@ -233,22 +233,22 @@
}; // shared_array
-template<class T> inline bool operator==(shared_array<T> const & a, shared_array<T> const & b) // never throws
+template<class T> inline bool operator==(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT
{
return a.get() == b.get();
}
-template<class T> inline bool operator!=(shared_array<T> const & a, shared_array<T> const & b) // never throws
+template<class T> inline bool operator!=(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT
{
return a.get() != b.get();
}
-template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) // never throws
+template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT
{
return std::less<T*>()(a.get(), b.get());
}
-template<class T> void swap(shared_array<T> & a, shared_array<T> & b) // never throws
+template<class T> void swap(shared_array<T> & a, shared_array<T> & b) BOOST_NOEXCEPT
{
a.swap(b);
}
Modified: trunk/boost/smart_ptr/shared_ptr.hpp
==============================================================================
--- trunk/boost/smart_ptr/shared_ptr.hpp (original)
+++ trunk/boost/smart_ptr/shared_ptr.hpp 2012-11-16 10:05:25 EST (Fri, 16 Nov 2012)
@@ -324,7 +324,7 @@
typedef typename boost::detail::sp_element< T >::type element_type;
- shared_ptr(): px( 0 ), pn() // never throws in 1.30+
+ shared_ptr() BOOST_NOEXCEPT : px( 0 ), pn() // never throws in 1.30+
{
}
@@ -358,7 +358,7 @@
// ... except in C++0x, move disables the implicit copy
- shared_ptr( shared_ptr const & r ): px( r.px ), pn( r.pn ) // never throws
+ shared_ptr( shared_ptr const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
{
}
@@ -374,7 +374,8 @@
}
template<class Y>
- shared_ptr( weak_ptr<Y> const & r, boost::detail::sp_nothrow_tag ): px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) // never throws
+ shared_ptr( weak_ptr<Y> const & r, boost::detail::sp_nothrow_tag )
+ BOOST_NOEXCEPT : px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() )
{
if( !pn.empty() )
{
@@ -392,24 +393,26 @@
shared_ptr( shared_ptr<Y> const & r )
#endif
- : px( r.px ), pn( r.pn ) // never throws
+ BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
{
boost::detail::sp_assert_convertible< Y, T >();
}
// aliasing
template< class Y >
- shared_ptr( shared_ptr<Y> const & r, element_type * p ): px( p ), pn( r.pn ) // never throws
+ shared_ptr( shared_ptr<Y> const & r, element_type * p ) BOOST_NOEXCEPT : px( p ), pn( r.pn )
{
}
template<class Y>
- shared_ptr(shared_ptr<Y> const & r, boost::detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn)
+ shared_ptr(shared_ptr<Y> const & r, boost::detail::static_cast_tag)
+ BOOST_NOEXCEPT : px(static_cast<element_type *>(r.px)), pn(r.pn)
{
}
template<class Y>
- shared_ptr(shared_ptr<Y> const & r, boost::detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn)
+ shared_ptr(shared_ptr<Y> const & r, boost::detail::const_cast_tag)
+ BOOST_NOEXCEPT : px(const_cast<element_type *>(r.px)), pn(r.pn)
{
}
@@ -480,7 +483,7 @@
// assignment
- shared_ptr & operator=( shared_ptr const & r ) // never throws
+ shared_ptr & operator=( shared_ptr const & r ) BOOST_NOEXCEPT
{
this_type(r).swap(*this);
return *this;
@@ -489,7 +492,7 @@
#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400)
template<class Y>
- shared_ptr & operator=(shared_ptr<Y> const & r) // never throws
+ shared_ptr & operator=(shared_ptr<Y> const & r) BOOST_NOEXCEPT
{
this_type(r).swap(*this);
return *this;
@@ -523,7 +526,7 @@
#if defined( BOOST_HAS_RVALUE_REFS )
- shared_ptr( shared_ptr && r ): px( r.px ), pn() // never throws
+ shared_ptr( shared_ptr && r ) BOOST_NOEXCEPT : px( r.px ), pn()
{
pn.swap( r.pn );
r.px = 0;
@@ -539,7 +542,7 @@
shared_ptr( shared_ptr<Y> && r )
#endif
- : px( r.px ), pn() // never throws
+ BOOST_NOEXCEPT : px( r.px ), pn()
{
boost::detail::sp_assert_convertible< Y, T >();
@@ -547,14 +550,14 @@
r.px = 0;
}
- shared_ptr & operator=( shared_ptr && r ) // never throws
+ shared_ptr & operator=( shared_ptr && r ) BOOST_NOEXCEPT
{
this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
return *this;
}
template<class Y>
- shared_ptr & operator=( shared_ptr<Y> && r ) // never throws
+ shared_ptr & operator=( shared_ptr<Y> && r ) BOOST_NOEXCEPT
{
this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
return *this;
@@ -562,7 +565,7 @@
#endif
- void reset() // never throws in 1.30+
+ void reset() BOOST_NOEXCEPT // never throws in 1.30+
{
this_type().swap(*this);
}
@@ -587,20 +590,23 @@
{
this_type( r, p ).swap( *this );
}
-
- typename boost::detail::sp_dereference< T >::type operator* () const // never throws
+
+ // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
+ typename boost::detail::sp_dereference< T >::type operator* () const
{
BOOST_ASSERT( px != 0 );
return *px;
}
-
- typename boost::detail::sp_member_access< T >::type operator-> () const // never throws
+
+ // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
+ typename boost::detail::sp_member_access< T >::type operator-> () const
{
BOOST_ASSERT( px != 0 );
return px;
}
-
- typename boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const // never throws
+
+ // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
+ typename boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const
{
BOOST_ASSERT( px != 0 );
BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) );
@@ -608,7 +614,7 @@
return px[ i ];
}
- element_type * get() const // never throws
+ element_type * get() const BOOST_NOEXCEPT
{
return px;
}
@@ -616,28 +622,28 @@
// implicit conversion to "bool"
#include <boost/smart_ptr/detail/operator_bool.hpp>
- bool unique() const // never throws
+ bool unique() const BOOST_NOEXCEPT
{
return pn.unique();
}
- long use_count() const // never throws
+ long use_count() const BOOST_NOEXCEPT
{
return pn.use_count();
}
- void swap( shared_ptr & other ) // never throws
+ void swap( shared_ptr & other ) BOOST_NOEXCEPT
{
std::swap(px, other.px);
pn.swap(other.pn);
}
- template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const
+ template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const BOOST_NOEXCEPT
{
return pn < rhs.pn;
}
- template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const
+ template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const BOOST_NOEXCEPT
{
return pn < rhs.pn;
}
@@ -647,7 +653,7 @@
return pn.get_deleter( ti );
}
- bool _internal_equiv( shared_ptr const & r ) const
+ bool _internal_equiv( shared_ptr const & r ) const BOOST_NOEXCEPT
{
return px == r.px && pn == r.pn;
}
@@ -670,12 +676,12 @@
}; // shared_ptr
-template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b)
+template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) BOOST_NOEXCEPT
{
return a.get() == b.get();
}
-template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b)
+template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b) BOOST_NOEXCEPT
{
return a.get() != b.get();
}
@@ -684,19 +690,19 @@
// Resolve the ambiguity between our op!= and the one in rel_ops
-template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> const & b)
+template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> const & b) BOOST_NOEXCEPT
{
return a.get() != b.get();
}
#endif
-template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b)
+template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) BOOST_NOEXCEPT
{
return a.owner_before( b );
}
-template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b)
+template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b) BOOST_NOEXCEPT
{
a.swap(b);
}
@@ -741,7 +747,7 @@
// get_pointer() enables boost::mem_fn to recognize shared_ptr
-template<class T> inline T * get_pointer(shared_ptr<T> const & p)
+template<class T> inline T * get_pointer(shared_ptr<T> const & p) BOOST_NOEXCEPT
{
return p.get();
}
@@ -854,7 +860,7 @@
#if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
-template<class T> inline bool atomic_is_lock_free( shared_ptr<T> const * /*p*/ )
+template<class T> inline bool atomic_is_lock_free( shared_ptr<T> const * /*p*/ ) BOOST_NOEXCEPT
{
return false;
}
@@ -933,7 +939,7 @@
template< class T > struct hash;
-template< class T > std::size_t hash_value( boost::shared_ptr<T> const & p )
+template< class T > std::size_t hash_value( boost::shared_ptr<T> const & p ) BOOST_NOEXCEPT
{
return boost::hash< T* >()( p.get() );
}
Modified: trunk/boost/smart_ptr/weak_ptr.hpp
==============================================================================
--- trunk/boost/smart_ptr/weak_ptr.hpp (original)
+++ trunk/boost/smart_ptr/weak_ptr.hpp 2012-11-16 10:05:25 EST (Fri, 16 Nov 2012)
@@ -31,7 +31,7 @@
typedef typename boost::detail::sp_element< T >::type element_type;
- weak_ptr(): px(0), pn() // never throws in 1.30+
+ weak_ptr() BOOST_NOEXCEPT : px(0), pn() // never throws in 1.30+
{
}
@@ -41,11 +41,11 @@
// ... except in C++0x, move disables the implicit copy
- weak_ptr( weak_ptr const & r ): px( r.px ), pn( r.pn ) // never throws
+ weak_ptr( weak_ptr const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
{
}
- weak_ptr & operator=( weak_ptr const & r ) // never throws
+ weak_ptr & operator=( weak_ptr const & r ) BOOST_NOEXCEPT
{
px = r.px;
pn = r.pn;
@@ -81,7 +81,7 @@
weak_ptr( weak_ptr<Y> const & r )
#endif
- : px(r.lock().get()), pn(r.pn) // never throws
+ BOOST_NOEXCEPT : px(r.lock().get()), pn(r.pn)
{
boost::detail::sp_assert_convertible< Y, T >();
}
@@ -98,20 +98,21 @@
weak_ptr( weak_ptr<Y> && r )
#endif
- : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws
+ BOOST_NOEXCEPT : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) )
{
boost::detail::sp_assert_convertible< Y, T >();
r.px = 0;
}
// for better efficiency in the T == Y case
- weak_ptr( weak_ptr && r ): px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws
+ weak_ptr( weak_ptr && r )
+ BOOST_NOEXCEPT : px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) )
{
r.px = 0;
}
// for better efficiency in the T == Y case
- weak_ptr & operator=( weak_ptr && r ) // never throws
+ weak_ptr & operator=( weak_ptr && r ) BOOST_NOEXCEPT
{
this_type( static_cast< weak_ptr && >( r ) ).swap( *this );
return *this;
@@ -130,7 +131,7 @@
weak_ptr( shared_ptr<Y> const & r )
#endif
- : px( r.px ), pn( r.pn ) // never throws
+ BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
{
boost::detail::sp_assert_convertible< Y, T >();
}
@@ -138,7 +139,7 @@
#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300)
template<class Y>
- weak_ptr & operator=( weak_ptr<Y> const & r ) // never throws
+ weak_ptr & operator=( weak_ptr<Y> const & r ) BOOST_NOEXCEPT
{
boost::detail::sp_assert_convertible< Y, T >();
@@ -151,7 +152,7 @@
#if defined( BOOST_HAS_RVALUE_REFS )
template<class Y>
- weak_ptr & operator=( weak_ptr<Y> && r )
+ weak_ptr & operator=( weak_ptr<Y> && r ) BOOST_NOEXCEPT
{
this_type( static_cast< weak_ptr<Y> && >( r ) ).swap( *this );
return *this;
@@ -160,7 +161,7 @@
#endif
template<class Y>
- weak_ptr & operator=( shared_ptr<Y> const & r ) // never throws
+ weak_ptr & operator=( shared_ptr<Y> const & r ) BOOST_NOEXCEPT
{
boost::detail::sp_assert_convertible< Y, T >();
@@ -172,17 +173,17 @@
#endif
- shared_ptr<T> lock() const // never throws
+ shared_ptr<T> lock() const BOOST_NOEXCEPT
{
return shared_ptr<T>( *this, boost::detail::sp_nothrow_tag() );
}
- long use_count() const // never throws
+ long use_count() const BOOST_NOEXCEPT
{
return pn.use_count();
}
- bool expired() const // never throws
+ bool expired() const BOOST_NOEXCEPT
{
return pn.use_count() == 0;
}
@@ -192,12 +193,12 @@
return pn.empty();
}
- void reset() // never throws in 1.30+
+ void reset() BOOST_NOEXCEPT // never throws in 1.30+
{
this_type().swap(*this);
}
- void swap(this_type & other) // never throws
+ void swap(this_type & other) BOOST_NOEXCEPT
{
std::swap(px, other.px);
pn.swap(other.pn);
@@ -210,12 +211,12 @@
pn = r.pn;
}
- template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const
+ template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const BOOST_NOEXCEPT
{
return pn < rhs.pn;
}
- template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const
+ template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const BOOST_NOEXCEPT
{
return pn < rhs.pn;
}
@@ -237,12 +238,12 @@
}; // weak_ptr
-template<class T, class U> inline bool operator<(weak_ptr<T> const & a, weak_ptr<U> const & b)
+template<class T, class U> inline bool operator<(weak_ptr<T> const & a, weak_ptr<U> const & b) BOOST_NOEXCEPT
{
return a.owner_before( b );
}
-template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b)
+template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) BOOST_NOEXCEPT
{
a.swap(b);
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk