From dcc1713c59132c5b06f55e8b1a444d04627a0597 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 9 Jan 2013 23:41:31 +0000 Subject: [PATCH] Merged revision(s) 82351 from trunk: Replace std::nullptr_t with boost::detail::sp_nullptr_t. [SVN r82427] --- .../boost/smart_ptr/detail/sp_nullptr_t.hpp | 45 +++++++++++++++++++ include/boost/smart_ptr/intrusive_ptr.hpp | 9 ++-- include/boost/smart_ptr/scoped_array.hpp | 10 ++--- include/boost/smart_ptr/scoped_ptr.hpp | 9 ++-- include/boost/smart_ptr/shared_array.hpp | 9 ++-- include/boost/smart_ptr/shared_ptr.hpp | 19 ++++---- 6 files changed, 75 insertions(+), 26 deletions(-) create mode 100644 include/boost/smart_ptr/detail/sp_nullptr_t.hpp diff --git a/include/boost/smart_ptr/detail/sp_nullptr_t.hpp b/include/boost/smart_ptr/detail/sp_nullptr_t.hpp new file mode 100644 index 0000000..ccbb123 --- /dev/null +++ b/include/boost/smart_ptr/detail/sp_nullptr_t.hpp @@ -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 +#include + +#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 diff --git a/include/boost/smart_ptr/intrusive_ptr.hpp b/include/boost/smart_ptr/intrusive_ptr.hpp index 64a2923..b6f5bcd 100644 --- a/include/boost/smart_ptr/intrusive_ptr.hpp +++ b/include/boost/smart_ptr/intrusive_ptr.hpp @@ -18,6 +18,7 @@ #include #include #include +#include #include // for std::less @@ -220,22 +221,22 @@ template inline bool operator!=(intrusive_ptr const & a, intrusive_p #if !defined( BOOST_NO_CXX11_NULLPTR ) -template inline bool operator==( intrusive_ptr const & p, std::nullptr_t ) BOOST_NOEXCEPT +template inline bool operator==( intrusive_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT { return p.get() == 0; } -template inline bool operator==( std::nullptr_t, intrusive_ptr const & p ) BOOST_NOEXCEPT +template inline bool operator==( boost::detail::sp_nullptr_t, intrusive_ptr const & p ) BOOST_NOEXCEPT { return p.get() == 0; } -template inline bool operator!=( intrusive_ptr const & p, std::nullptr_t ) BOOST_NOEXCEPT +template inline bool operator!=( intrusive_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT { return p.get() != 0; } -template inline bool operator!=( std::nullptr_t, intrusive_ptr const & p ) BOOST_NOEXCEPT +template inline bool operator!=( boost::detail::sp_nullptr_t, intrusive_ptr const & p ) BOOST_NOEXCEPT { return p.get() != 0; } diff --git a/include/boost/smart_ptr/scoped_array.hpp b/include/boost/smart_ptr/scoped_array.hpp index 1ddaa07..e395e28 100644 --- a/include/boost/smart_ptr/scoped_array.hpp +++ b/include/boost/smart_ptr/scoped_array.hpp @@ -14,7 +14,7 @@ #include #include #include -#include // in case ptrdiff_t not in std +#include #include @@ -100,22 +100,22 @@ public: #if !defined( BOOST_NO_CXX11_NULLPTR ) -template inline bool operator==( scoped_array const & p, std::nullptr_t ) BOOST_NOEXCEPT +template inline bool operator==( scoped_array const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT { return p.get() == 0; } -template inline bool operator==( std::nullptr_t, scoped_array const & p ) BOOST_NOEXCEPT +template inline bool operator==( boost::detail::sp_nullptr_t, scoped_array const & p ) BOOST_NOEXCEPT { return p.get() == 0; } -template inline bool operator!=( scoped_array const & p, std::nullptr_t ) BOOST_NOEXCEPT +template inline bool operator!=( scoped_array const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT { return p.get() != 0; } -template inline bool operator!=( std::nullptr_t, scoped_array const & p ) BOOST_NOEXCEPT +template inline bool operator!=( boost::detail::sp_nullptr_t, scoped_array const & p ) BOOST_NOEXCEPT { return p.get() != 0; } diff --git a/include/boost/smart_ptr/scoped_ptr.hpp b/include/boost/smart_ptr/scoped_ptr.hpp index a75f91f..be6722d 100644 --- a/include/boost/smart_ptr/scoped_ptr.hpp +++ b/include/boost/smart_ptr/scoped_ptr.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #ifndef BOOST_NO_AUTO_PTR @@ -117,22 +118,22 @@ public: #if !defined( BOOST_NO_CXX11_NULLPTR ) -template inline bool operator==( scoped_ptr const & p, std::nullptr_t ) BOOST_NOEXCEPT +template inline bool operator==( scoped_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT { return p.get() == 0; } -template inline bool operator==( std::nullptr_t, scoped_ptr const & p ) BOOST_NOEXCEPT +template inline bool operator==( boost::detail::sp_nullptr_t, scoped_ptr const & p ) BOOST_NOEXCEPT { return p.get() == 0; } -template inline bool operator!=( scoped_ptr const & p, std::nullptr_t ) BOOST_NOEXCEPT +template inline bool operator!=( scoped_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT { return p.get() != 0; } -template inline bool operator!=( std::nullptr_t, scoped_ptr const & p ) BOOST_NOEXCEPT +template inline bool operator!=( boost::detail::sp_nullptr_t, scoped_ptr const & p ) BOOST_NOEXCEPT { return p.get() != 0; } diff --git a/include/boost/smart_ptr/shared_array.hpp b/include/boost/smart_ptr/shared_array.hpp index 38047ff..73a07ae 100644 --- a/include/boost/smart_ptr/shared_array.hpp +++ b/include/boost/smart_ptr/shared_array.hpp @@ -27,6 +27,7 @@ #include #include +#include #include #include // for std::ptrdiff_t @@ -245,22 +246,22 @@ template inline bool operator!=(shared_array const & a, shared_array #if !defined( BOOST_NO_CXX11_NULLPTR ) -template inline bool operator==( shared_array const & p, std::nullptr_t ) BOOST_NOEXCEPT +template inline bool operator==( shared_array const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT { return p.get() == 0; } -template inline bool operator==( std::nullptr_t, shared_array const & p ) BOOST_NOEXCEPT +template inline bool operator==( boost::detail::sp_nullptr_t, shared_array const & p ) BOOST_NOEXCEPT { return p.get() == 0; } -template inline bool operator!=( shared_array const & p, std::nullptr_t ) BOOST_NOEXCEPT +template inline bool operator!=( shared_array const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT { return p.get() != 0; } -template inline bool operator!=( std::nullptr_t, shared_array const & p ) BOOST_NOEXCEPT +template inline bool operator!=( boost::detail::sp_nullptr_t, shared_array const & p ) BOOST_NOEXCEPT { return p.get() != 0; } diff --git a/include/boost/smart_ptr/shared_ptr.hpp b/include/boost/smart_ptr/shared_ptr.hpp index b34b0ac..d2781c1 100644 --- a/include/boost/smart_ptr/shared_ptr.hpp +++ b/include/boost/smart_ptr/shared_ptr.hpp @@ -32,6 +32,7 @@ #include #include #include +#include #if !defined(BOOST_SP_NO_ATOMIC_ACCESS) #include @@ -41,7 +42,7 @@ #include // for std::swap #include // for std::less #include // for std::bad_cast -#include // for std::size_t, std::nullptr_t +#include // for std::size_t #if !defined(BOOST_NO_IOSTREAM) #if !defined(BOOST_NO_IOSFWD) @@ -341,7 +342,7 @@ public: #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 ) - template shared_ptr( std::nullptr_t p, D d ): px( p ), pn( p, d ) + template 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 ) - template shared_ptr( std::nullptr_t p, D d, A a ): px( p ), pn( p, d, a ) + template 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 ) - 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); return *this; @@ -752,22 +753,22 @@ template inline bool operator!=(shared_ptr const & a, shared_ptr #if !defined( BOOST_NO_CXX11_NULLPTR ) -template inline bool operator==( shared_ptr const & p, std::nullptr_t ) BOOST_NOEXCEPT +template inline bool operator==( shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT { return p.get() == 0; } -template inline bool operator==( std::nullptr_t, shared_ptr const & p ) BOOST_NOEXCEPT +template inline bool operator==( boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_NOEXCEPT { return p.get() == 0; } -template inline bool operator!=( shared_ptr const & p, std::nullptr_t ) BOOST_NOEXCEPT +template inline bool operator!=( shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT { return p.get() != 0; } -template inline bool operator!=( std::nullptr_t, shared_ptr const & p ) BOOST_NOEXCEPT +template inline bool operator!=( boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_NOEXCEPT { return p.get() != 0; }