forked from boostorg/intrusive
merged sandbox-branches/intrusive_fix_SunCC (r55765 and r55775) fixing intrusive for Sun CC (#3339)
[SVN r55918]
This commit is contained in:
@ -46,7 +46,7 @@ struct internal_base_hook_bool
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::boost_intrusive_tags::is_base_hook>
|
||||
test (detail::bool_<U::boost_intrusive_tags::is_base_hook>* = 0);
|
||||
test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
@ -63,7 +63,7 @@ struct internal_any_hook_bool
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::is_any_hook>
|
||||
test (detail::bool_<U::is_any_hook>* = 0);
|
||||
test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
@ -81,7 +81,7 @@ struct external_value_traits_bool
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::external_value_traits>
|
||||
test (detail::bool_<U::external_value_traits>* = 0);
|
||||
test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
@ -92,7 +92,7 @@ struct external_bucket_traits_bool
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::external_bucket_traits>
|
||||
test (detail::bool_<U::external_bucket_traits>* = 0);
|
||||
test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
|
@ -187,7 +187,7 @@ struct store_hash_bool
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::store_hash>
|
||||
test (detail::bool_<U::store_hash>* = 0);
|
||||
test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
@ -204,7 +204,7 @@ struct optimize_multikey_bool
|
||||
struct two_or_three {one _[2 + Add];};
|
||||
template <class U> static one test(...);
|
||||
template <class U> static two_or_three<U::optimize_multikey>
|
||||
test (detail::bool_<U::optimize_multikey>* = 0);
|
||||
test (int);
|
||||
static const std::size_t value = sizeof(test<T>(0));
|
||||
};
|
||||
|
||||
|
@ -34,9 +34,9 @@ struct reinterpret_cast_tag {};
|
||||
struct empty_type{};
|
||||
|
||||
template<class T>
|
||||
struct random_it
|
||||
: public boost::iterator<std::random_access_iterator_tag,
|
||||
T, std::ptrdiff_t, T*, T&>
|
||||
struct random_it
|
||||
: public boost::iterator<std::random_access_iterator_tag,
|
||||
T, std::ptrdiff_t, T*, T&>
|
||||
{
|
||||
typedef const T* const_pointer;
|
||||
typedef const T& const_reference;
|
||||
@ -108,25 +108,25 @@ class smart_ptr
|
||||
public: //Public Functions
|
||||
|
||||
//!Constructor from raw pointer (allows "0" pointer conversion). Never throws.
|
||||
explicit smart_ptr(pointer ptr = 0)
|
||||
smart_ptr(pointer ptr = 0)
|
||||
: m_ptr(ptr)
|
||||
{}
|
||||
|
||||
//!Constructor from other pointer. Never throws.
|
||||
template <class T>
|
||||
smart_ptr(T *ptr)
|
||||
smart_ptr(T *ptr)
|
||||
: m_ptr(ptr)
|
||||
{}
|
||||
|
||||
//!Constructor from other smart_ptr
|
||||
//!Constructor from other smart_ptr
|
||||
smart_ptr(const smart_ptr& ptr)
|
||||
: m_ptr(ptr.m_ptr)
|
||||
{}
|
||||
|
||||
//!Constructor from other smart_ptr. If pointers of pointee types are
|
||||
//!Constructor from other smart_ptr. If pointers of pointee types are
|
||||
//!convertible, offset_ptrs will be convertibles. Never throws.
|
||||
template<class T2>
|
||||
smart_ptr(const smart_ptr<T2> &ptr)
|
||||
smart_ptr(const smart_ptr<T2> &ptr)
|
||||
: m_ptr(ptr.m_ptr)
|
||||
{}
|
||||
|
||||
@ -159,16 +159,16 @@ class smart_ptr
|
||||
{ return m_ptr; }
|
||||
|
||||
//!Pointer-like -> operator. It can return 0 pointer. Never throws.
|
||||
pointer operator->() const
|
||||
pointer operator->() const
|
||||
{ return this->get(); }
|
||||
|
||||
//!Dereferencing operator, if it is a null smart_ptr behavior
|
||||
//!Dereferencing operator, if it is a null smart_ptr behavior
|
||||
//! is undefined. Never throws.
|
||||
reference operator* () const
|
||||
reference operator* () const
|
||||
{ return *(this->get()); }
|
||||
|
||||
//!Indexing operator. Never throws.
|
||||
reference operator[](std::ptrdiff_t idx) const
|
||||
reference operator[](std::ptrdiff_t idx) const
|
||||
{ return this->get()[idx]; }
|
||||
|
||||
//!Assignment from pointer (saves extra conversion). Never throws.
|
||||
@ -179,18 +179,18 @@ class smart_ptr
|
||||
smart_ptr& operator= (const smart_ptr & pt)
|
||||
{ m_ptr = pt.m_ptr; return *this; }
|
||||
|
||||
//!Assignment from related smart_ptr. If pointers of pointee types
|
||||
//!Assignment from related smart_ptr. If pointers of pointee types
|
||||
//! are assignable, offset_ptrs will be assignable. Never throws.
|
||||
template <class T2>
|
||||
smart_ptr& operator= (const smart_ptr<T2> & pt)
|
||||
{ m_ptr = pt.m_ptr; return *this; }
|
||||
|
||||
|
||||
//!smart_ptr + std::ptrdiff_t. Never throws.
|
||||
smart_ptr operator+ (std::ptrdiff_t offset) const
|
||||
smart_ptr operator+ (std::ptrdiff_t offset) const
|
||||
{ return smart_ptr(this->get()+offset); }
|
||||
|
||||
//!smart_ptr - std::ptrdiff_t. Never throws.
|
||||
smart_ptr operator- (std::ptrdiff_t offset) const
|
||||
smart_ptr operator- (std::ptrdiff_t offset) const
|
||||
{ return smart_ptr(this->get()-offset); }
|
||||
|
||||
//!smart_ptr += std::ptrdiff_t. Never throws.
|
||||
@ -202,7 +202,7 @@ class smart_ptr
|
||||
{ m_ptr -= offset; return *this; }
|
||||
|
||||
//!++smart_ptr. Never throws.
|
||||
smart_ptr& operator++ (void)
|
||||
smart_ptr& operator++ (void)
|
||||
{ ++m_ptr; return *this; }
|
||||
|
||||
//!smart_ptr++. Never throws.
|
||||
@ -210,7 +210,7 @@ class smart_ptr
|
||||
{ smart_ptr temp(*this); ++*this; return temp; }
|
||||
|
||||
//!--smart_ptr. Never throws.
|
||||
smart_ptr& operator-- (void)
|
||||
smart_ptr& operator-- (void)
|
||||
{ --m_ptr; return *this; }
|
||||
|
||||
//!smart_ptr--. Never throws.
|
||||
@ -218,16 +218,16 @@ class smart_ptr
|
||||
{ smart_ptr temp(*this); --*this; return temp; }
|
||||
|
||||
//!safe bool conversion operator. Never throws.
|
||||
operator unspecified_bool_type() const
|
||||
operator unspecified_bool_type() const
|
||||
{ return this->get()? &self_t::unspecified_bool_type_func : 0; }
|
||||
|
||||
//!Not operator. Not needed in theory, but improves portability.
|
||||
//!Not operator. Not needed in theory, but improves portability.
|
||||
//!Never throws.
|
||||
bool operator! () const
|
||||
{ return this->get() == 0; }
|
||||
/*
|
||||
friend void swap (smart_ptr &pt, smart_ptr &pt2)
|
||||
{
|
||||
{
|
||||
value_type *ptr = pt.get();
|
||||
pt = pt2;
|
||||
pt2 = ptr;
|
||||
@ -237,67 +237,67 @@ class smart_ptr
|
||||
|
||||
//!smart_ptr<T1> == smart_ptr<T2>. Never throws.
|
||||
template<class T1, class T2>
|
||||
inline bool operator== (const smart_ptr<T1> &pt1,
|
||||
inline bool operator== (const smart_ptr<T1> &pt1,
|
||||
const smart_ptr<T2> &pt2)
|
||||
{ return pt1.get() == pt2.get(); }
|
||||
|
||||
//!smart_ptr<T1> != smart_ptr<T2>. Never throws.
|
||||
template<class T1, class T2>
|
||||
inline bool operator!= (const smart_ptr<T1> &pt1,
|
||||
inline bool operator!= (const smart_ptr<T1> &pt1,
|
||||
const smart_ptr<T2> &pt2)
|
||||
{ return pt1.get() != pt2.get(); }
|
||||
|
||||
//!smart_ptr<T1> < smart_ptr<T2>. Never throws.
|
||||
template<class T1, class T2>
|
||||
inline bool operator< (const smart_ptr<T1> &pt1,
|
||||
inline bool operator< (const smart_ptr<T1> &pt1,
|
||||
const smart_ptr<T2> &pt2)
|
||||
{ return pt1.get() < pt2.get(); }
|
||||
|
||||
//!smart_ptr<T1> <= smart_ptr<T2>. Never throws.
|
||||
template<class T1, class T2>
|
||||
inline bool operator<= (const smart_ptr<T1> &pt1,
|
||||
inline bool operator<= (const smart_ptr<T1> &pt1,
|
||||
const smart_ptr<T2> &pt2)
|
||||
{ return pt1.get() <= pt2.get(); }
|
||||
|
||||
//!smart_ptr<T1> > smart_ptr<T2>. Never throws.
|
||||
template<class T1, class T2>
|
||||
inline bool operator> (const smart_ptr<T1> &pt1,
|
||||
inline bool operator> (const smart_ptr<T1> &pt1,
|
||||
const smart_ptr<T2> &pt2)
|
||||
{ return pt1.get() > pt2.get(); }
|
||||
|
||||
//!smart_ptr<T1> >= smart_ptr<T2>. Never throws.
|
||||
template<class T1, class T2>
|
||||
inline bool operator>= (const smart_ptr<T1> &pt1,
|
||||
inline bool operator>= (const smart_ptr<T1> &pt1,
|
||||
const smart_ptr<T2> &pt2)
|
||||
{ return pt1.get() >= pt2.get(); }
|
||||
|
||||
//!operator<<
|
||||
template<class E, class T, class Y>
|
||||
inline std::basic_ostream<E, T> & operator<<
|
||||
//!operator<<
|
||||
template<class E, class T, class Y>
|
||||
inline std::basic_ostream<E, T> & operator<<
|
||||
(std::basic_ostream<E, T> & os, smart_ptr<Y> const & p)
|
||||
{ return os << p.get(); }
|
||||
|
||||
//!operator>>
|
||||
template<class E, class T, class Y>
|
||||
inline std::basic_istream<E, T> & operator>>
|
||||
//!operator>>
|
||||
template<class E, class T, class Y>
|
||||
inline std::basic_istream<E, T> & operator>>
|
||||
(std::basic_istream<E, T> & os, smart_ptr<Y> & p)
|
||||
{ Y * tmp; return os >> tmp; p = tmp; }
|
||||
|
||||
//!std::ptrdiff_t + smart_ptr
|
||||
//!std::ptrdiff_t + smart_ptr
|
||||
template<class T>
|
||||
inline smart_ptr<T> operator+(std::ptrdiff_t diff, const smart_ptr<T>& right)
|
||||
{ return right + diff; }
|
||||
|
||||
//!smart_ptr - smart_ptr
|
||||
//!smart_ptr - smart_ptr
|
||||
template<class T, class T2>
|
||||
inline std::ptrdiff_t operator- (const smart_ptr<T> &pt, const smart_ptr<T2> &pt2)
|
||||
{ return pt.get()- pt2.get(); }
|
||||
|
||||
//!swap specialization
|
||||
//!swap specialization
|
||||
template<class T>
|
||||
inline void swap (smart_ptr<T> &pt,
|
||||
inline void swap (smart_ptr<T> &pt,
|
||||
smart_ptr<T> &pt2)
|
||||
{
|
||||
{
|
||||
typename smart_ptr<T>::value_type *ptr = pt.get();
|
||||
pt = pt2;
|
||||
pt2 = ptr;
|
||||
@ -310,35 +310,35 @@ inline T* get_pointer(const smart_ptr<T> & p)
|
||||
{ return p.get(); }
|
||||
|
||||
//!Simulation of static_cast between pointers. Never throws.
|
||||
template<class T, class U>
|
||||
inline smart_ptr<T>
|
||||
template<class T, class U>
|
||||
inline smart_ptr<T>
|
||||
static_pointer_cast(smart_ptr<U> const & r)
|
||||
{
|
||||
return smart_ptr<T>(r, detail::static_cast_tag());
|
||||
{
|
||||
return smart_ptr<T>(r, detail::static_cast_tag());
|
||||
}
|
||||
|
||||
//!Simulation of const_cast between pointers. Never throws.
|
||||
template<class T, class U>
|
||||
template<class T, class U>
|
||||
inline smart_ptr<T>const_pointer_cast(smart_ptr<U> const & r)
|
||||
{
|
||||
return smart_ptr<T>(r, detail::const_cast_tag());
|
||||
{
|
||||
return smart_ptr<T>(r, detail::const_cast_tag());
|
||||
}
|
||||
|
||||
//!Simulation of dynamic_cast between pointers. Never throws.
|
||||
template<class T, class U>
|
||||
inline smart_ptr<T>
|
||||
template<class T, class U>
|
||||
inline smart_ptr<T>
|
||||
dynamic_pointer_cast(smart_ptr<U> const & r)
|
||||
{
|
||||
{
|
||||
return smart_ptr<T>
|
||||
(r, detail::dynamic_cast_tag());
|
||||
(r, detail::dynamic_cast_tag());
|
||||
}
|
||||
|
||||
//!Simulation of reinterpret_cast between pointers. Never throws.
|
||||
template<class T, class U>
|
||||
template<class T, class U>
|
||||
inline smart_ptr<T>
|
||||
reinterpret_pointer_cast(smart_ptr<U> const & r)
|
||||
{
|
||||
return smart_ptr<T>(r, detail::reinterpret_cast_tag());
|
||||
{
|
||||
return smart_ptr<T>(r, detail::reinterpret_cast_tag());
|
||||
}
|
||||
|
||||
} //namespace intrusive {
|
||||
|
Reference in New Issue
Block a user