mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-10-04 19:51:02 +02:00
Compare commits
3 Commits
master
...
boost-1.30
Author | SHA1 | Date | |
---|---|---|---|
|
0de0d99848 | ||
|
011d6b4faf | ||
|
86ba6efa8f |
@@ -1,8 +1,8 @@
|
||||
#ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED
|
||||
|
||||
#if _MSC_VER >= 1020
|
||||
#pragma once
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
|
@@ -14,6 +14,8 @@
|
||||
// See http://www.boost.org/libs/smart_ptr/intrusive_ptr.html for documentation.
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4284) // odd return type for operator->
|
||||
@@ -119,6 +121,15 @@ public:
|
||||
return p_;
|
||||
}
|
||||
|
||||
#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
|
||||
|
||||
operator bool () const
|
||||
{
|
||||
return p_ != 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
typedef T * (intrusive_ptr::*unspecified_bool_type) () const;
|
||||
|
||||
operator unspecified_bool_type () const
|
||||
@@ -126,6 +137,8 @@ public:
|
||||
return p_ == 0? 0: &intrusive_ptr::get;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// operator! is a Borland-specific workaround
|
||||
bool operator! () const
|
||||
{
|
||||
@@ -224,7 +237,7 @@ template<class Y> std::ostream & operator<< (std::ostream & os, intrusive_ptr<Y>
|
||||
|
||||
#else
|
||||
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200 && __SGI_STL_PORT)
|
||||
# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, <= 1200 && __SGI_STL_PORT)
|
||||
// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL
|
||||
using std::basic_ostream;
|
||||
template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, intrusive_ptr<Y> const & p)
|
||||
|
@@ -15,6 +15,9 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/checked_delete.hpp>
|
||||
#include <boost/config.hpp> // in case ptrdiff_t not in std
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <cstddef> // for std::ptrdiff_t
|
||||
|
||||
namespace boost
|
||||
@@ -83,6 +86,15 @@ public:
|
||||
|
||||
// implicit conversion to "bool"
|
||||
|
||||
#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
|
||||
|
||||
operator bool () const
|
||||
{
|
||||
return ptr != 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
typedef T * (this_type::*unspecified_bool_type)() const;
|
||||
|
||||
operator unspecified_bool_type() const // never throws
|
||||
@@ -90,6 +102,8 @@ public:
|
||||
return ptr == 0? 0: &this_type::get;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool operator! () const // never throws
|
||||
{
|
||||
return ptr == 0;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/checked_delete.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
# include <memory> // for std::auto_ptr
|
||||
@@ -102,6 +103,15 @@ public:
|
||||
|
||||
// implicit conversion to "bool"
|
||||
|
||||
#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
|
||||
|
||||
operator bool () const
|
||||
{
|
||||
return ptr != 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
typedef T * (this_type::*unspecified_bool_type)() const;
|
||||
|
||||
operator unspecified_bool_type() const // never throws
|
||||
@@ -109,6 +119,8 @@ public:
|
||||
return ptr == 0? 0: &this_type::get;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool operator! () const // never throws
|
||||
{
|
||||
return ptr == 0;
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <boost/checked_delete.hpp>
|
||||
|
||||
#include <boost/detail/shared_count.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <cstddef> // for std::ptrdiff_t
|
||||
#include <algorithm> // for std::swap
|
||||
@@ -94,6 +95,15 @@ public:
|
||||
|
||||
// implicit conversion to "bool"
|
||||
|
||||
#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
|
||||
|
||||
operator bool () const
|
||||
{
|
||||
return px != 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
typedef T * (this_type::*unspecified_bool_type)() const;
|
||||
|
||||
operator unspecified_bool_type() const // never throws
|
||||
@@ -101,6 +111,8 @@ public:
|
||||
return px == 0? 0: &this_type::get;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool operator! () const // never throws
|
||||
{
|
||||
return px == 0;
|
||||
|
@@ -246,6 +246,15 @@ public:
|
||||
|
||||
// implicit conversion to "bool"
|
||||
|
||||
#if defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
|
||||
|
||||
operator bool () const
|
||||
{
|
||||
return px != 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
typedef T * (this_type::*unspecified_bool_type)() const;
|
||||
|
||||
operator unspecified_bool_type() const // never throws
|
||||
@@ -253,6 +262,8 @@ public:
|
||||
return px == 0? 0: &this_type::get;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// operator! is redundant, but some compilers need it
|
||||
|
||||
bool operator! () const // never throws
|
||||
@@ -387,7 +398,7 @@ template<class Y> std::ostream & operator<< (std::ostream & os, shared_ptr<Y> co
|
||||
|
||||
#else
|
||||
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200 && __SGI_STL_PORT)
|
||||
# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, <= 1200 && __SGI_STL_PORT)
|
||||
// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL
|
||||
using std::basic_ostream;
|
||||
template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, shared_ptr<Y> const & p)
|
||||
|
Reference in New Issue
Block a user