Remove uses of BOOST_NO_CXX11_NULLPTR

This commit is contained in:
Peter Dimov
2024-09-24 19:05:48 +03:00
parent bd0419c290
commit 569b07b91c
14 changed files with 45 additions and 189 deletions

View File

@@ -78,10 +78,8 @@ public:
sp_alloc_ptr(std::size_t, P p) BOOST_SP_NOEXCEPT
: p_(p) { }
#if !defined(BOOST_NO_CXX11_NULLPTR)
sp_alloc_ptr(detail::sp_nullptr_t) BOOST_SP_NOEXCEPT
sp_alloc_ptr(std::nullptr_t) BOOST_SP_NOEXCEPT
: p_() { }
#endif
T& operator*() const {
return *p_;
@@ -133,10 +131,8 @@ public:
: p_(p)
, n_(n) { }
#if !defined(BOOST_NO_CXX11_NULLPTR)
sp_alloc_ptr(detail::sp_nullptr_t) BOOST_SP_NOEXCEPT
sp_alloc_ptr(std::nullptr_t) BOOST_SP_NOEXCEPT
: p_() { }
#endif
T& operator[](std::size_t i) const {
return p_[i];
@@ -184,10 +180,8 @@ public:
sp_alloc_ptr(std::size_t, P p) BOOST_SP_NOEXCEPT
: p_(p) { }
#if !defined(BOOST_NO_CXX11_NULLPTR)
sp_alloc_ptr(detail::sp_nullptr_t) BOOST_SP_NOEXCEPT
sp_alloc_ptr(std::nullptr_t) BOOST_SP_NOEXCEPT
: p_() { }
#endif
T& operator[](std::size_t i) const {
return p_[i];
@@ -237,18 +231,17 @@ operator!=(const sp_alloc_ptr<T, P>& lhs, const sp_alloc_ptr<T, P>& rhs)
return !(lhs == rhs);
}
#if !defined(BOOST_NO_CXX11_NULLPTR)
template<class T, class P>
inline bool
operator==(const sp_alloc_ptr<T, P>& lhs,
detail::sp_nullptr_t) BOOST_SP_NOEXCEPT
std::nullptr_t) BOOST_SP_NOEXCEPT
{
return !lhs.ptr();
}
template<class T, class P>
inline bool
operator==(detail::sp_nullptr_t,
operator==(std::nullptr_t,
const sp_alloc_ptr<T, P>& rhs) BOOST_SP_NOEXCEPT
{
return !rhs.ptr();
@@ -257,19 +250,18 @@ operator==(detail::sp_nullptr_t,
template<class T, class P>
inline bool
operator!=(const sp_alloc_ptr<T, P>& lhs,
detail::sp_nullptr_t) BOOST_SP_NOEXCEPT
std::nullptr_t) BOOST_SP_NOEXCEPT
{
return !!lhs.ptr();
}
template<class T, class P>
inline bool
operator!=(detail::sp_nullptr_t,
operator!=(std::nullptr_t,
const sp_alloc_ptr<T, P>& rhs) BOOST_SP_NOEXCEPT
{
return !!rhs.ptr();
}
#endif
template<class A>
inline void

View File

@@ -60,14 +60,10 @@ public:
d_( p );
}
#if !defined( BOOST_NO_CXX11_NULLPTR )
void operator()( boost::detail::sp_nullptr_t p ) BOOST_SP_NOEXCEPT
void operator()( std::nullptr_t p ) BOOST_SP_NOEXCEPT
{
d_( p );
}
#endif
};
template<> class local_sp_deleter<void>

View File

@@ -18,8 +18,6 @@
#include <boost/config.hpp>
#include <cstddef>
#if !defined( BOOST_NO_CXX11_NULLPTR )
namespace boost
{
@@ -40,6 +38,4 @@ namespace detail
} // namespace boost
#endif // !defined( BOOST_NO_CXX11_NULLPTR )
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED

View File

@@ -212,30 +212,26 @@ template<class T, class U> inline bool operator!=(T * a, intrusive_ptr<U> const
return a != b.get();
}
#if !defined( BOOST_NO_CXX11_NULLPTR )
template<class T> inline bool operator==( intrusive_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator==( intrusive_ptr<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
{
return p.get() == 0;
}
template<class T> inline bool operator==( boost::detail::sp_nullptr_t, intrusive_ptr<T> const & p ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator==( std::nullptr_t, intrusive_ptr<T> const & p ) BOOST_SP_NOEXCEPT
{
return p.get() == 0;
}
template<class T> inline bool operator!=( intrusive_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator!=( intrusive_ptr<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
{
return p.get() != 0;
}
template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, intrusive_ptr<T> const & p ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator!=( std::nullptr_t, intrusive_ptr<T> const & p ) BOOST_SP_NOEXCEPT
{
return p.get() != 0;
}
#endif
template<class T> inline bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<T> const & b) BOOST_SP_NOEXCEPT
{
return std::less<T *>()(a.get(), b.get());

View File

@@ -140,14 +140,10 @@ public:
{
}
#if !defined( BOOST_NO_CXX11_NULLPTR )
BOOST_CONSTEXPR local_shared_ptr( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn( 0 )
BOOST_CONSTEXPR local_shared_ptr( std::nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn( 0 )
{
}
#endif
// internal constructor, used by make_shared
BOOST_CONSTEXPR local_shared_ptr( boost::detail::lsp_internal_constructor_tag, element_type * px_, boost::detail::local_counted_base * pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( pn_ )
{
@@ -164,29 +160,21 @@ public:
boost::detail::lsp_deleter_construct( this, p, d, pn );
}
#if !defined( BOOST_NO_CXX11_NULLPTR )
template<class D> local_shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( 0 )
template<class D> local_shared_ptr( std::nullptr_t p, D d ): px( p ), pn( 0 )
{
boost::detail::lsp_deleter_construct( this, p, d, pn );
}
#endif
template<class Y, class D, class A> local_shared_ptr( Y * p, D d, A a ): px( p ), pn( 0 )
{
boost::detail::lsp_allocator_construct( this, p, d, a, pn );
}
#if !defined( BOOST_NO_CXX11_NULLPTR )
template<class D, class A> local_shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( 0 )
template<class D, class A> local_shared_ptr( std::nullptr_t p, D d, A a ): px( p ), pn( 0 )
{
boost::detail::lsp_allocator_construct( this, p, d, a, pn );
}
#endif
// construction from shared_ptr
template<class Y> local_shared_ptr( shared_ptr<Y> const & r,
@@ -349,17 +337,13 @@ public:
#endif
#if !defined( BOOST_NO_CXX11_NULLPTR )
local_shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
local_shared_ptr & operator=( std::nullptr_t ) BOOST_SP_NOEXCEPT
{
local_shared_ptr().swap(*this);
return *this;
}
#endif
#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class Y, class D>
local_shared_ptr & operator=( std::unique_ptr<Y, D> && r )
@@ -513,30 +497,26 @@ template<class T, class U> inline bool operator!=( local_shared_ptr<T> const & a
return a.get() != b.get();
}
#if !defined( BOOST_NO_CXX11_NULLPTR )
template<class T> inline bool operator==( local_shared_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator==( local_shared_ptr<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
{
return p.get() == 0;
}
template<class T> inline bool operator==( boost::detail::sp_nullptr_t, local_shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator==( std::nullptr_t, local_shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT
{
return p.get() == 0;
}
template<class T> inline bool operator!=( local_shared_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator!=( local_shared_ptr<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
{
return p.get() != 0;
}
template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, local_shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator!=( std::nullptr_t, local_shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT
{
return p.get() != 0;
}
#endif
template<class T, class U> inline bool operator==( local_shared_ptr<T> const & a, shared_ptr<U> const & b ) BOOST_SP_NOEXCEPT
{
return a.get() == b.get();

View File

@@ -98,30 +98,26 @@ public:
}
};
#if !defined( BOOST_NO_CXX11_NULLPTR )
template<class T> inline bool operator==( scoped_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator==( scoped_array<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
{
return p.get() == 0;
}
template<class T> inline bool operator==( boost::detail::sp_nullptr_t, scoped_array<T> const & p ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator==( std::nullptr_t, scoped_array<T> const & p ) BOOST_SP_NOEXCEPT
{
return p.get() == 0;
}
template<class T> inline bool operator!=( scoped_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator!=( scoped_array<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
{
return p.get() != 0;
}
template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, scoped_array<T> const & p ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator!=( std::nullptr_t, scoped_array<T> const & p ) BOOST_SP_NOEXCEPT
{
return p.get() != 0;
}
#endif
template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) BOOST_SP_NOEXCEPT
{
a.swap(b);

View File

@@ -122,30 +122,26 @@ public:
}
};
#if !defined( BOOST_NO_CXX11_NULLPTR )
template<class T> inline bool operator==( scoped_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator==( scoped_ptr<T> const & p, std::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_SP_NOEXCEPT
template<class T> inline bool operator==( std::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_SP_NOEXCEPT
template<class T> inline bool operator!=( scoped_ptr<T> const & p, std::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_SP_NOEXCEPT
template<class T> inline bool operator!=( std::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_SP_NOEXCEPT
{
a.swap(b);

View File

@@ -58,14 +58,10 @@ public:
{
}
#if !defined( BOOST_NO_CXX11_NULLPTR )
shared_array( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn()
shared_array( std::nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn()
{
}
#endif
template<class Y>
explicit shared_array( Y * p ): px( p ), pn( p, checked_array_deleter<Y>() )
{
@@ -237,30 +233,26 @@ template<class T> inline bool operator!=(shared_array<T> const & a, shared_array
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_SP_NOEXCEPT
template<class T> inline bool operator==( shared_array<T> const & p, std::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_SP_NOEXCEPT
template<class T> inline bool operator==( std::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_SP_NOEXCEPT
template<class T> inline bool operator!=( shared_array<T> const & p, std::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_SP_NOEXCEPT
template<class T> inline bool operator!=( std::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_SP_NOEXCEPT
{
return std::less<T*>()(a.get(), b.get());

View File

@@ -283,14 +283,10 @@ public:
{
}
#if !defined( BOOST_NO_CXX11_NULLPTR )
BOOST_CONSTEXPR shared_ptr( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn()
BOOST_CONSTEXPR shared_ptr( std::nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn()
{
}
#endif
BOOST_CONSTEXPR shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count const & pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( pn_ )
{
}
@@ -331,22 +327,18 @@ public:
#endif
#if !defined( BOOST_NO_CXX11_NULLPTR )
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class D> shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, static_cast< D&& >( d ) )
template<class D> shared_ptr( std::nullptr_t p, D d ): px( p ), pn( p, static_cast< D&& >( d ) )
{
}
#else
template<class D> shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, d )
template<class D> shared_ptr( std::nullptr_t p, D d ): px( p ), pn( p, d )
{
}
#endif
#endif
// As above, but with allocator. A's copy constructor shall not throw.
@@ -367,24 +359,20 @@ public:
#endif
#if !defined( BOOST_NO_CXX11_NULLPTR )
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, static_cast< D&& >( d ), a )
template<class D, class A> shared_ptr( std::nullptr_t p, D d, A a ): px( p ), pn( p, static_cast< D&& >( d ), a )
{
}
#else
template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a )
template<class D, class A> shared_ptr( std::nullptr_t p, D d, A a ): px( p ), pn( p, d, a )
{
}
#endif
#endif
// generated copy constructor, destructor are fine...
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
@@ -627,16 +615,12 @@ public:
#endif
#if !defined( BOOST_NO_CXX11_NULLPTR )
shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
shared_ptr & operator=( std::nullptr_t ) BOOST_SP_NOEXCEPT
{
this_type().swap(*this);
return *this;
}
#endif
void reset() BOOST_SP_NOEXCEPT
{
this_type().swap(*this);
@@ -803,30 +787,26 @@ template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, share
return a.get() != b.get();
}
#if !defined( BOOST_NO_CXX11_NULLPTR )
template<class T> inline bool operator==( shared_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator==( shared_ptr<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
{
return p.get() == 0;
}
template<class T> inline bool operator==( boost::detail::sp_nullptr_t, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator==( std::nullptr_t, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT
{
return p.get() == 0;
}
template<class T> inline bool operator!=( shared_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator!=( shared_ptr<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
{
return p.get() != 0;
}
template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT
template<class T> inline bool operator!=( std::nullptr_t, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT
{
return p.get() != 0;
}
#endif
template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) BOOST_SP_NOEXCEPT
{
return a.owner_before( b );