forked from boostorg/smart_ptr
Merged revision(s) 82351 from trunk: Replace std::nullptr_t with boost::detail::sp_nullptr_t.
[SVN r82427]
This commit is contained in:
45
include/boost/smart_ptr/detail/sp_nullptr_t.hpp
Normal file
45
include/boost/smart_ptr/detail/sp_nullptr_t.hpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED
|
||||||
|
#define BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED
|
||||||
|
|
||||||
|
// MS compatible compilers support #pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// detail/sp_nullptr_t.hpp
|
||||||
|
//
|
||||||
|
// Copyright 2013 Peter Dimov
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
#if defined( __clang__ ) && !defined( _LIBCPP_VERSION ) && !defined( BOOST_NO_CXX11_DECLTYPE )
|
||||||
|
|
||||||
|
typedef decltype(nullptr) sp_nullptr_t;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
typedef std::nullptr_t sp_nullptr_t;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED
|
@ -18,6 +18,7 @@
|
|||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <boost/smart_ptr/detail/sp_convertible.hpp>
|
#include <boost/smart_ptr/detail/sp_convertible.hpp>
|
||||||
|
#include <boost/smart_ptr/detail/sp_nullptr_t.hpp>
|
||||||
|
|
||||||
#include <boost/config/no_tr1/functional.hpp> // for std::less
|
#include <boost/config/no_tr1/functional.hpp> // for std::less
|
||||||
|
|
||||||
@ -220,22 +221,22 @@ template<class T> inline bool operator!=(intrusive_ptr<T> const & a, intrusive_p
|
|||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
|
||||||
template<class T> inline bool operator==( intrusive_ptr<T> const & p, std::nullptr_t ) BOOST_NOEXCEPT
|
template<class T> inline bool operator==( intrusive_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
return p.get() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator==( std::nullptr_t, intrusive_ptr<T> const & p ) BOOST_NOEXCEPT
|
template<class T> inline bool operator==( boost::detail::sp_nullptr_t, intrusive_ptr<T> const & p ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
return p.get() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator!=( intrusive_ptr<T> const & p, std::nullptr_t ) BOOST_NOEXCEPT
|
template<class T> inline bool operator!=( intrusive_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() != 0;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator!=( std::nullptr_t, intrusive_ptr<T> const & p ) BOOST_NOEXCEPT
|
template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, intrusive_ptr<T> const & p ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() != 0;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/checked_delete.hpp>
|
#include <boost/checked_delete.hpp>
|
||||||
#include <boost/config.hpp> // in case ptrdiff_t not in std
|
#include <boost/smart_ptr/detail/sp_nullptr_t.hpp>
|
||||||
|
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
@ -100,22 +100,22 @@ public:
|
|||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
|
||||||
template<class T> inline bool operator==( scoped_array<T> const & p, std::nullptr_t ) BOOST_NOEXCEPT
|
template<class T> inline bool operator==( scoped_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
return p.get() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator==( std::nullptr_t, scoped_array<T> const & p ) BOOST_NOEXCEPT
|
template<class T> inline bool operator==( boost::detail::sp_nullptr_t, scoped_array<T> const & p ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
return p.get() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator!=( scoped_array<T> const & p, std::nullptr_t ) BOOST_NOEXCEPT
|
template<class T> inline bool operator!=( scoped_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() != 0;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator!=( std::nullptr_t, scoped_array<T> const & p ) BOOST_NOEXCEPT
|
template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, scoped_array<T> const & p ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() != 0;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/checked_delete.hpp>
|
#include <boost/checked_delete.hpp>
|
||||||
|
#include <boost/smart_ptr/detail/sp_nullptr_t.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
#ifndef BOOST_NO_AUTO_PTR
|
#ifndef BOOST_NO_AUTO_PTR
|
||||||
@ -117,22 +118,22 @@ public:
|
|||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
|
||||||
template<class T> inline bool operator==( scoped_ptr<T> const & p, std::nullptr_t ) BOOST_NOEXCEPT
|
template<class T> inline bool operator==( scoped_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
return p.get() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator==( std::nullptr_t, scoped_ptr<T> const & p ) BOOST_NOEXCEPT
|
template<class T> inline bool operator==( boost::detail::sp_nullptr_t, scoped_ptr<T> const & p ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
return p.get() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator!=( scoped_ptr<T> const & p, std::nullptr_t ) BOOST_NOEXCEPT
|
template<class T> inline bool operator!=( scoped_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() != 0;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator!=( std::nullptr_t, scoped_ptr<T> const & p ) BOOST_NOEXCEPT
|
template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, scoped_ptr<T> const & p ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() != 0;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||||
#include <boost/smart_ptr/detail/shared_count.hpp>
|
#include <boost/smart_ptr/detail/shared_count.hpp>
|
||||||
|
#include <boost/smart_ptr/detail/sp_nullptr_t.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
#include <cstddef> // for std::ptrdiff_t
|
#include <cstddef> // for std::ptrdiff_t
|
||||||
@ -245,22 +246,22 @@ template<class T> inline bool operator!=(shared_array<T> const & a, shared_array
|
|||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
|
||||||
template<class T> inline bool operator==( shared_array<T> const & p, std::nullptr_t ) BOOST_NOEXCEPT
|
template<class T> inline bool operator==( shared_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
return p.get() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator==( std::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_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
return p.get() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator!=( shared_array<T> const & p, std::nullptr_t ) BOOST_NOEXCEPT
|
template<class T> inline bool operator!=( shared_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() != 0;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator!=( std::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_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() != 0;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <boost/smart_ptr/detail/shared_count.hpp>
|
#include <boost/smart_ptr/detail/shared_count.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <boost/smart_ptr/detail/sp_convertible.hpp>
|
#include <boost/smart_ptr/detail/sp_convertible.hpp>
|
||||||
|
#include <boost/smart_ptr/detail/sp_nullptr_t.hpp>
|
||||||
|
|
||||||
#if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
|
#if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
|
||||||
#include <boost/smart_ptr/detail/spinlock_pool.hpp>
|
#include <boost/smart_ptr/detail/spinlock_pool.hpp>
|
||||||
@ -41,7 +42,7 @@
|
|||||||
#include <algorithm> // for std::swap
|
#include <algorithm> // for std::swap
|
||||||
#include <functional> // for std::less
|
#include <functional> // for std::less
|
||||||
#include <typeinfo> // for std::bad_cast
|
#include <typeinfo> // for std::bad_cast
|
||||||
#include <cstddef> // for std::size_t, std::nullptr_t
|
#include <cstddef> // for std::size_t
|
||||||
|
|
||||||
#if !defined(BOOST_NO_IOSTREAM)
|
#if !defined(BOOST_NO_IOSTREAM)
|
||||||
#if !defined(BOOST_NO_IOSFWD)
|
#if !defined(BOOST_NO_IOSFWD)
|
||||||
@ -341,7 +342,7 @@ public:
|
|||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
|
||||||
shared_ptr( std::nullptr_t ) BOOST_NOEXCEPT : px( 0 ), pn() // never throws
|
shared_ptr( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT : px( 0 ), pn() // never throws
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +367,7 @@ public:
|
|||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
|
||||||
template<class D> shared_ptr( std::nullptr_t p, D d ): px( p ), pn( p, d )
|
template<class D> shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, d )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,7 +382,7 @@ public:
|
|||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
|
||||||
template<class D, class A> shared_ptr( std::nullptr_t p, D d, A a ): px( p ), pn( p, d, a )
|
template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -605,7 +606,7 @@ public:
|
|||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
|
||||||
shared_ptr & operator=( std::nullptr_t ) BOOST_NOEXCEPT // never throws
|
shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT // never throws
|
||||||
{
|
{
|
||||||
this_type().swap(*this);
|
this_type().swap(*this);
|
||||||
return *this;
|
return *this;
|
||||||
@ -752,22 +753,22 @@ template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T>
|
|||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
|
||||||
template<class T> inline bool operator==( shared_ptr<T> const & p, std::nullptr_t ) BOOST_NOEXCEPT
|
template<class T> inline bool operator==( shared_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
return p.get() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator==( std::nullptr_t, shared_ptr<T> const & p ) BOOST_NOEXCEPT
|
template<class T> inline bool operator==( boost::detail::sp_nullptr_t, shared_ptr<T> const & p ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() == 0;
|
return p.get() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator!=( shared_ptr<T> const & p, std::nullptr_t ) BOOST_NOEXCEPT
|
template<class T> inline bool operator!=( shared_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() != 0;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline bool operator!=( std::nullptr_t, shared_ptr<T> const & p ) BOOST_NOEXCEPT
|
template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, shared_ptr<T> const & p ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return p.get() != 0;
|
return p.get() != 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user