Use BOOST_SP_NOEXCEPT, BOOST_SP_NOEXCEPT_WITH_ASSERT

This commit is contained in:
Peter Dimov
2017-06-12 18:06:54 +03:00
parent e75fa9329b
commit 52d976fde2
15 changed files with 264 additions and 246 deletions
+21 -21
View File
@@ -120,7 +120,7 @@ public:
shared_array( shared_array<Y> const & r )
#endif
BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) // never throws
BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn )
{
boost::detail::sp_assert_convertible< Y[], T[] >();
}
@@ -128,7 +128,7 @@ public:
// aliasing
template< class Y >
shared_array( shared_array<Y> const & r, element_type * p ) BOOST_NOEXCEPT : px( p ), pn( r.pn )
shared_array( shared_array<Y> const & r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn( r.pn )
{
}
@@ -143,7 +143,7 @@ public:
#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400)
template<class Y>
shared_array & operator=( shared_array<Y> const & r ) BOOST_NOEXCEPT
shared_array & operator=( shared_array<Y> const & r ) BOOST_SP_NOEXCEPT
{
this_type( r ).swap( *this );
return *this;
@@ -160,7 +160,7 @@ public:
}
template<class Y>
shared_array & operator=( shared_array<Y> && r ) BOOST_NOEXCEPT
shared_array & operator=( shared_array<Y> && r ) BOOST_SP_NOEXCEPT
{
this_type( static_cast< shared_array<Y> && >( r ) ).swap( *this );
return *this;
@@ -168,7 +168,7 @@ public:
#endif
void reset() BOOST_NOEXCEPT
void reset() BOOST_SP_NOEXCEPT
{
this_type().swap( *this );
}
@@ -189,19 +189,19 @@ public:
this_type( p, d, a ).swap( *this );
}
template<class Y> void reset( shared_array<Y> const & r, element_type * p )
template<class Y> void reset( shared_array<Y> const & r, element_type * p ) BOOST_SP_NOEXCEPT
{
this_type( r, p ).swap( *this );
}
T & operator[] (std::ptrdiff_t i) const // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
T & operator[] (std::ptrdiff_t i) const BOOST_SP_NOEXCEPT_WITH_ASSERT
{
BOOST_ASSERT(px != 0);
BOOST_ASSERT(i >= 0);
return px[i];
}
T * get() const BOOST_NOEXCEPT
T * get() const BOOST_SP_NOEXCEPT
{
return px;
}
@@ -209,23 +209,23 @@ public:
// implicit conversion to "bool"
#include <boost/smart_ptr/detail/operator_bool.hpp>
bool unique() const BOOST_NOEXCEPT
bool unique() const BOOST_SP_NOEXCEPT
{
return pn.unique();
}
long use_count() const BOOST_NOEXCEPT
long use_count() const BOOST_SP_NOEXCEPT
{
return pn.use_count();
}
void swap(shared_array<T> & other) BOOST_NOEXCEPT
void swap(shared_array<T> & other) BOOST_SP_NOEXCEPT
{
std::swap(px, other.px);
pn.swap(other.pn);
}
void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const
void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT
{
return pn.get_deleter( ti );
}
@@ -239,51 +239,51 @@ private:
}; // shared_array
template<class T> inline bool operator==(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT
template<class T> inline bool operator==(shared_array<T> const & a, shared_array<T> const & b) BOOST_SP_NOEXCEPT
{
return a.get() == b.get();
}
template<class T> inline bool operator!=(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT
template<class T> inline bool operator!=(shared_array<T> const & a, shared_array<T> const & b) BOOST_SP_NOEXCEPT
{
return a.get() != b.get();
}
#if !defined( BOOST_NO_CXX11_NULLPTR )
template<class T> inline bool operator==( shared_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
template<class T> inline bool operator==( shared_array<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, shared_array<T> const & p ) BOOST_NOEXCEPT
template<class T> inline bool operator==( boost::detail::sp_nullptr_t, shared_array<T> const & p ) BOOST_SP_NOEXCEPT
{
return p.get() == 0;
}
template<class T> inline bool operator!=( shared_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
template<class T> inline bool operator!=( shared_array<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, shared_array<T> const & p ) BOOST_NOEXCEPT
template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, shared_array<T> const & p ) BOOST_SP_NOEXCEPT
{
return p.get() != 0;
}
#endif
template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT
template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) BOOST_SP_NOEXCEPT
{
return std::less<T*>()(a.get(), b.get());
}
template<class T> void swap(shared_array<T> & a, shared_array<T> & b) BOOST_NOEXCEPT
template<class T> void swap(shared_array<T> & a, shared_array<T> & b) BOOST_SP_NOEXCEPT
{
a.swap(b);
}
template< class D, class T > D * get_deleter( shared_array<T> const & p )
template< class D, class T > D * get_deleter( shared_array<T> const & p ) BOOST_SP_NOEXCEPT
{
return static_cast< D * >( p._internal_get_deleter( BOOST_SP_TYPEID(D) ) );
}