mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-30 04:47:12 +02:00
Fixed bool conversions for Sun 5.3
[SVN r18419]
This commit is contained in:
@ -119,6 +119,21 @@ public:
|
|||||||
return p_;
|
return p_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
|
||||||
|
|
||||||
|
operator bool () const
|
||||||
|
{
|
||||||
|
return p_ != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
operator int () const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
typedef T * (intrusive_ptr::*unspecified_bool_type) () const;
|
typedef T * (intrusive_ptr::*unspecified_bool_type) () const;
|
||||||
|
|
||||||
operator unspecified_bool_type () const
|
operator unspecified_bool_type () const
|
||||||
@ -126,6 +141,8 @@ public:
|
|||||||
return p_ == 0? 0: &intrusive_ptr::get;
|
return p_ == 0? 0: &intrusive_ptr::get;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// operator! is a Borland-specific workaround
|
// operator! is a Borland-specific workaround
|
||||||
bool operator! () const
|
bool operator! () const
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
#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/config.hpp> // in case ptrdiff_t not in std
|
||||||
|
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
#include <cstddef> // for std::ptrdiff_t
|
#include <cstddef> // for std::ptrdiff_t
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
@ -83,6 +86,21 @@ public:
|
|||||||
|
|
||||||
// implicit conversion to "bool"
|
// implicit conversion to "bool"
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
|
||||||
|
|
||||||
|
operator bool () const
|
||||||
|
{
|
||||||
|
return ptr != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
operator int () const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
typedef T * (this_type::*unspecified_bool_type)() const;
|
typedef T * (this_type::*unspecified_bool_type)() const;
|
||||||
|
|
||||||
operator unspecified_bool_type() const // never throws
|
operator unspecified_bool_type() const // never throws
|
||||||
@ -90,6 +108,8 @@ public:
|
|||||||
return ptr == 0? 0: &this_type::get;
|
return ptr == 0? 0: &this_type::get;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
bool operator! () const // never throws
|
bool operator! () const // never throws
|
||||||
{
|
{
|
||||||
return ptr == 0;
|
return ptr == 0;
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/checked_delete.hpp>
|
#include <boost/checked_delete.hpp>
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
#ifndef BOOST_NO_AUTO_PTR
|
#ifndef BOOST_NO_AUTO_PTR
|
||||||
# include <memory> // for std::auto_ptr
|
# include <memory> // for std::auto_ptr
|
||||||
@ -102,6 +103,21 @@ public:
|
|||||||
|
|
||||||
// implicit conversion to "bool"
|
// implicit conversion to "bool"
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
|
||||||
|
|
||||||
|
operator bool () const
|
||||||
|
{
|
||||||
|
return ptr != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
operator int () const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
typedef T * (this_type::*unspecified_bool_type)() const;
|
typedef T * (this_type::*unspecified_bool_type)() const;
|
||||||
|
|
||||||
operator unspecified_bool_type() const // never throws
|
operator unspecified_bool_type() const // never throws
|
||||||
@ -109,6 +125,8 @@ public:
|
|||||||
return ptr == 0? 0: &this_type::get;
|
return ptr == 0? 0: &this_type::get;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
bool operator! () const // never throws
|
bool operator! () const // never throws
|
||||||
{
|
{
|
||||||
return ptr == 0;
|
return ptr == 0;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <boost/checked_delete.hpp>
|
#include <boost/checked_delete.hpp>
|
||||||
|
|
||||||
#include <boost/detail/shared_count.hpp>
|
#include <boost/detail/shared_count.hpp>
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
#include <cstddef> // for std::ptrdiff_t
|
#include <cstddef> // for std::ptrdiff_t
|
||||||
#include <algorithm> // for std::swap
|
#include <algorithm> // for std::swap
|
||||||
@ -94,6 +95,21 @@ public:
|
|||||||
|
|
||||||
// implicit conversion to "bool"
|
// implicit conversion to "bool"
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
|
||||||
|
|
||||||
|
operator bool () const
|
||||||
|
{
|
||||||
|
return px != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
operator int () const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
typedef T * (this_type::*unspecified_bool_type)() const;
|
typedef T * (this_type::*unspecified_bool_type)() const;
|
||||||
|
|
||||||
operator unspecified_bool_type() const // never throws
|
operator unspecified_bool_type() const // never throws
|
||||||
@ -101,6 +117,8 @@ public:
|
|||||||
return px == 0? 0: &this_type::get;
|
return px == 0? 0: &this_type::get;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
bool operator! () const // never throws
|
bool operator! () const // never throws
|
||||||
{
|
{
|
||||||
return px == 0;
|
return px == 0;
|
||||||
|
@ -246,6 +246,21 @@ public:
|
|||||||
|
|
||||||
// implicit conversion to "bool"
|
// implicit conversion to "bool"
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x530)
|
||||||
|
|
||||||
|
operator bool () const
|
||||||
|
{
|
||||||
|
return px != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
operator int () const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
typedef T * (this_type::*unspecified_bool_type)() const;
|
typedef T * (this_type::*unspecified_bool_type)() const;
|
||||||
|
|
||||||
operator unspecified_bool_type() const // never throws
|
operator unspecified_bool_type() const // never throws
|
||||||
@ -253,6 +268,8 @@ public:
|
|||||||
return px == 0? 0: &this_type::get;
|
return px == 0? 0: &this_type::get;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// operator! is redundant, but some compilers need it
|
// operator! is redundant, but some compilers need it
|
||||||
|
|
||||||
bool operator! () const // never throws
|
bool operator! () const // never throws
|
||||||
|
Reference in New Issue
Block a user