mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-30 20:57:21 +02:00
Remove uses of BOOST_NO_CXX11_NULLPTR
This commit is contained in:
@ -78,10 +78,8 @@ public:
|
|||||||
sp_alloc_ptr(std::size_t, P p) BOOST_SP_NOEXCEPT
|
sp_alloc_ptr(std::size_t, P p) BOOST_SP_NOEXCEPT
|
||||||
: p_(p) { }
|
: p_(p) { }
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_NULLPTR)
|
sp_alloc_ptr(std::nullptr_t) BOOST_SP_NOEXCEPT
|
||||||
sp_alloc_ptr(detail::sp_nullptr_t) BOOST_SP_NOEXCEPT
|
|
||||||
: p_() { }
|
: p_() { }
|
||||||
#endif
|
|
||||||
|
|
||||||
T& operator*() const {
|
T& operator*() const {
|
||||||
return *p_;
|
return *p_;
|
||||||
@ -133,10 +131,8 @@ public:
|
|||||||
: p_(p)
|
: p_(p)
|
||||||
, n_(n) { }
|
, n_(n) { }
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_NULLPTR)
|
sp_alloc_ptr(std::nullptr_t) BOOST_SP_NOEXCEPT
|
||||||
sp_alloc_ptr(detail::sp_nullptr_t) BOOST_SP_NOEXCEPT
|
|
||||||
: p_() { }
|
: p_() { }
|
||||||
#endif
|
|
||||||
|
|
||||||
T& operator[](std::size_t i) const {
|
T& operator[](std::size_t i) const {
|
||||||
return p_[i];
|
return p_[i];
|
||||||
@ -184,10 +180,8 @@ public:
|
|||||||
sp_alloc_ptr(std::size_t, P p) BOOST_SP_NOEXCEPT
|
sp_alloc_ptr(std::size_t, P p) BOOST_SP_NOEXCEPT
|
||||||
: p_(p) { }
|
: p_(p) { }
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_NULLPTR)
|
sp_alloc_ptr(std::nullptr_t) BOOST_SP_NOEXCEPT
|
||||||
sp_alloc_ptr(detail::sp_nullptr_t) BOOST_SP_NOEXCEPT
|
|
||||||
: p_() { }
|
: p_() { }
|
||||||
#endif
|
|
||||||
|
|
||||||
T& operator[](std::size_t i) const {
|
T& operator[](std::size_t i) const {
|
||||||
return p_[i];
|
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);
|
return !(lhs == rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_NULLPTR)
|
|
||||||
template<class T, class P>
|
template<class T, class P>
|
||||||
inline bool
|
inline bool
|
||||||
operator==(const sp_alloc_ptr<T, P>& lhs,
|
operator==(const sp_alloc_ptr<T, P>& lhs,
|
||||||
detail::sp_nullptr_t) BOOST_SP_NOEXCEPT
|
std::nullptr_t) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !lhs.ptr();
|
return !lhs.ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class P>
|
template<class T, class P>
|
||||||
inline bool
|
inline bool
|
||||||
operator==(detail::sp_nullptr_t,
|
operator==(std::nullptr_t,
|
||||||
const sp_alloc_ptr<T, P>& rhs) BOOST_SP_NOEXCEPT
|
const sp_alloc_ptr<T, P>& rhs) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !rhs.ptr();
|
return !rhs.ptr();
|
||||||
@ -257,19 +250,18 @@ operator==(detail::sp_nullptr_t,
|
|||||||
template<class T, class P>
|
template<class T, class P>
|
||||||
inline bool
|
inline bool
|
||||||
operator!=(const sp_alloc_ptr<T, P>& lhs,
|
operator!=(const sp_alloc_ptr<T, P>& lhs,
|
||||||
detail::sp_nullptr_t) BOOST_SP_NOEXCEPT
|
std::nullptr_t) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !!lhs.ptr();
|
return !!lhs.ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class P>
|
template<class T, class P>
|
||||||
inline bool
|
inline bool
|
||||||
operator!=(detail::sp_nullptr_t,
|
operator!=(std::nullptr_t,
|
||||||
const sp_alloc_ptr<T, P>& rhs) BOOST_SP_NOEXCEPT
|
const sp_alloc_ptr<T, P>& rhs) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !!rhs.ptr();
|
return !!rhs.ptr();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class A>
|
template<class A>
|
||||||
inline void
|
inline void
|
||||||
|
@ -60,14 +60,10 @@ public:
|
|||||||
d_( p );
|
d_( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
void operator()( std::nullptr_t p ) BOOST_SP_NOEXCEPT
|
||||||
|
|
||||||
void operator()( boost::detail::sp_nullptr_t p ) BOOST_SP_NOEXCEPT
|
|
||||||
{
|
{
|
||||||
d_( p );
|
d_( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> class local_sp_deleter<void>
|
template<> class local_sp_deleter<void>
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -40,6 +38,4 @@ namespace detail
|
|||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
|
|
||||||
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED
|
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED
|
||||||
|
@ -212,30 +212,26 @@ template<class T, class U> inline bool operator!=(T * a, intrusive_ptr<U> const
|
|||||||
return a != b.get();
|
return a != b.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
template<class T> inline bool operator==( intrusive_ptr<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
|
||||||
|
|
||||||
template<class T> inline bool operator==( intrusive_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
|
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
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;
|
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;
|
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;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class T> inline bool operator<(intrusive_ptr<T> const & a, intrusive_ptr<T> const & b) BOOST_SP_NOEXCEPT
|
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());
|
return std::less<T *>()(a.get(), b.get());
|
||||||
|
@ -140,14 +140,10 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
BOOST_CONSTEXPR local_shared_ptr( std::nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn( 0 )
|
||||||
|
|
||||||
BOOST_CONSTEXPR local_shared_ptr( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn( 0 )
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// internal constructor, used by make_shared
|
// 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_ )
|
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 );
|
boost::detail::lsp_deleter_construct( this, p, d, pn );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
template<class D> local_shared_ptr( std::nullptr_t p, D d ): px( p ), pn( 0 )
|
||||||
|
|
||||||
template<class D> local_shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( 0 )
|
|
||||||
{
|
{
|
||||||
boost::detail::lsp_deleter_construct( this, p, d, pn );
|
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 )
|
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 );
|
boost::detail::lsp_allocator_construct( this, p, d, a, pn );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
template<class D, class A> local_shared_ptr( std::nullptr_t p, D d, A a ): px( p ), pn( 0 )
|
||||||
|
|
||||||
template<class D, class A> local_shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( 0 )
|
|
||||||
{
|
{
|
||||||
boost::detail::lsp_allocator_construct( this, p, d, a, pn );
|
boost::detail::lsp_allocator_construct( this, p, d, a, pn );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// construction from shared_ptr
|
// construction from shared_ptr
|
||||||
|
|
||||||
template<class Y> local_shared_ptr( shared_ptr<Y> const & r,
|
template<class Y> local_shared_ptr( shared_ptr<Y> const & r,
|
||||||
@ -349,17 +337,13 @@ public:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
local_shared_ptr & operator=( std::nullptr_t ) BOOST_SP_NOEXCEPT
|
||||||
|
|
||||||
local_shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
|
|
||||||
{
|
{
|
||||||
local_shared_ptr().swap(*this);
|
local_shared_ptr().swap(*this);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
|
||||||
|
|
||||||
template<class Y, class D>
|
template<class Y, class D>
|
||||||
local_shared_ptr & operator=( std::unique_ptr<Y, D> && r )
|
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();
|
return a.get() != b.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
template<class T> inline bool operator==( local_shared_ptr<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
|
||||||
|
|
||||||
template<class T> inline bool operator==( local_shared_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
|
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
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;
|
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;
|
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;
|
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
|
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();
|
return a.get() == b.get();
|
||||||
|
@ -98,30 +98,26 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
template<class T> inline bool operator==( scoped_array<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
|
||||||
|
|
||||||
template<class T> inline bool operator==( scoped_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
|
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
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;
|
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;
|
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;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) BOOST_SP_NOEXCEPT
|
template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
a.swap(b);
|
a.swap(b);
|
||||||
|
@ -122,30 +122,26 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
template<class T> inline bool operator==( scoped_ptr<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
|
||||||
|
|
||||||
template<class T> inline bool operator==( scoped_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
|
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
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;
|
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;
|
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;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) BOOST_SP_NOEXCEPT
|
template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
a.swap(b);
|
a.swap(b);
|
||||||
|
@ -58,14 +58,10 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
shared_array( std::nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn()
|
||||||
|
|
||||||
shared_array( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class Y>
|
template<class Y>
|
||||||
explicit shared_array( Y * p ): px( p ), pn( p, checked_array_deleter<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();
|
return a.get() != b.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
template<class T> inline bool operator==( shared_array<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
|
||||||
|
|
||||||
template<class T> inline bool operator==( shared_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
|
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
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;
|
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;
|
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;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) BOOST_SP_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());
|
return std::less<T*>()(a.get(), b.get());
|
||||||
|
@ -283,14 +283,10 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
BOOST_CONSTEXPR shared_ptr( std::nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn()
|
||||||
|
|
||||||
BOOST_CONSTEXPR shared_ptr( boost::detail::sp_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_ )
|
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
|
#endif
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
#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
|
#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
|
#endif
|
||||||
|
|
||||||
// As above, but with allocator. A's copy constructor shall not throw.
|
// As above, but with allocator. A's copy constructor shall not throw.
|
||||||
@ -367,24 +359,20 @@ public:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
#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
|
#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
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// generated copy constructor, destructor are fine...
|
// generated copy constructor, destructor are fine...
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
||||||
@ -627,16 +615,12 @@ public:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
shared_ptr & operator=( std::nullptr_t ) BOOST_SP_NOEXCEPT
|
||||||
|
|
||||||
shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
|
|
||||||
{
|
{
|
||||||
this_type().swap(*this);
|
this_type().swap(*this);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void reset() BOOST_SP_NOEXCEPT
|
void reset() BOOST_SP_NOEXCEPT
|
||||||
{
|
{
|
||||||
this_type().swap(*this);
|
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();
|
return a.get() != b.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
template<class T> inline bool operator==( shared_ptr<T> const & p, std::nullptr_t ) BOOST_SP_NOEXCEPT
|
||||||
|
|
||||||
template<class T> inline bool operator==( shared_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT
|
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
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;
|
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;
|
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;
|
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
|
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 );
|
return a.owner_before( b );
|
||||||
|
@ -78,8 +78,6 @@ static void default_constructor()
|
|||||||
|
|
||||||
static void nullptr_constructor()
|
static void nullptr_constructor()
|
||||||
{
|
{
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::local_shared_ptr<int> p( nullptr );
|
boost::local_shared_ptr<int> p( nullptr );
|
||||||
|
|
||||||
@ -112,8 +110,6 @@ static void nullptr_constructor()
|
|||||||
BOOST_TEST_EQ( p.get(), static_cast<void*>(0) );
|
BOOST_TEST_EQ( p.get(), static_cast<void*>(0) );
|
||||||
BOOST_TEST_EQ( p.local_use_count(), 0 );
|
BOOST_TEST_EQ( p.local_use_count(), 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// pointer constructor
|
// pointer constructor
|
||||||
@ -226,8 +222,6 @@ static void deleter_constructor()
|
|||||||
|
|
||||||
// nullptr_deleter_constructor
|
// nullptr_deleter_constructor
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
|
|
||||||
void deleter3( boost::detail::sp_nullptr_t )
|
void deleter3( boost::detail::sp_nullptr_t )
|
||||||
{
|
{
|
||||||
++m;
|
++m;
|
||||||
@ -260,14 +254,6 @@ static void nullptr_deleter_constructor()
|
|||||||
deleter3_test_<void const volatile>();
|
deleter3_test_<void const volatile>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static void nullptr_deleter_constructor()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// allocator constructor
|
// allocator constructor
|
||||||
|
|
||||||
template<class T> static void allocator_test_()
|
template<class T> static void allocator_test_()
|
||||||
@ -300,8 +286,6 @@ static void allocator_constructor()
|
|||||||
|
|
||||||
// nullptr_allocator_constructor
|
// nullptr_allocator_constructor
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
|
|
||||||
template<class T> static void allocator3_test_()
|
template<class T> static void allocator3_test_()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -329,14 +313,6 @@ static void nullptr_allocator_constructor()
|
|||||||
allocator3_test_<void const volatile>();
|
allocator3_test_<void const volatile>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static void nullptr_allocator_constructor()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// copy constructor
|
// copy constructor
|
||||||
|
|
||||||
template<class T> static void empty_copy_test()
|
template<class T> static void empty_copy_test()
|
||||||
@ -1253,8 +1229,6 @@ static void move_assignment()
|
|||||||
|
|
||||||
// nullptr assignment
|
// nullptr assignment
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
|
|
||||||
template<class T> static void test_nullptr_assign( boost::local_shared_ptr<T> p1 )
|
template<class T> static void test_nullptr_assign( boost::local_shared_ptr<T> p1 )
|
||||||
{
|
{
|
||||||
p1 = nullptr;
|
p1 = nullptr;
|
||||||
@ -1307,14 +1281,6 @@ static void nullptr_assignment()
|
|||||||
BOOST_TEST( X::instances == 0 );
|
BOOST_TEST( X::instances == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static void nullptr_assignment()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// default_reset
|
// default_reset
|
||||||
|
|
||||||
template<class T> static void test_default_reset( boost::local_shared_ptr<T> p1 )
|
template<class T> static void test_default_reset( boost::local_shared_ptr<T> p1 )
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
|
|
||||||
struct X
|
struct X
|
||||||
{
|
{
|
||||||
static int instances;
|
static int instances;
|
||||||
@ -101,12 +99,3 @@ int main()
|
|||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -52,17 +52,13 @@ static Z z;
|
|||||||
static boost::shared_ptr<X> p1;
|
static boost::shared_ptr<X> p1;
|
||||||
static boost::weak_ptr<X> p2;
|
static boost::weak_ptr<X> p2;
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
static boost::shared_ptr<X> p3( nullptr );
|
||||||
static boost::shared_ptr<X> p3( nullptr );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Z::Z()
|
Z::Z()
|
||||||
{
|
{
|
||||||
p1.reset( new X );
|
p1.reset( new X );
|
||||||
p2 = p1;
|
p2 = p1;
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
p3.reset( new X );
|
p3.reset( new X );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
@ -73,13 +69,9 @@ int main()
|
|||||||
BOOST_TEST_EQ( p2.use_count(), 1 );
|
BOOST_TEST_EQ( p2.use_count(), 1 );
|
||||||
BOOST_TEST_EQ( p2.lock(), p1 );
|
BOOST_TEST_EQ( p2.lock(), p1 );
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
|
|
||||||
BOOST_TEST( p3.get() != 0 );
|
BOOST_TEST( p3.get() != 0 );
|
||||||
BOOST_TEST_EQ( p3.use_count(), 1 );
|
BOOST_TEST_EQ( p3.use_count(), 1 );
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,8 +125,6 @@ int main()
|
|||||||
BOOST_TEST( Y::instances == 0 );
|
BOOST_TEST( Y::instances == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Y> p( nullptr, YD() );
|
boost::shared_ptr<Y> p( nullptr, YD() );
|
||||||
|
|
||||||
@ -145,8 +143,6 @@ int main()
|
|||||||
BOOST_TEST( del.moved_ );
|
BOOST_TEST( del.moved_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
|
||||||
|
|
||||||
struct X
|
struct X
|
||||||
{
|
{
|
||||||
static int instances;
|
static int instances;
|
||||||
@ -130,12 +128,3 @@ int main()
|
|||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
Reference in New Issue
Block a user