1 #ifndef BOOSTER_INTRUSIVE_PTR_H_INCLUDED
2 #define BOOSTER_INTRUSIVE_PTR_H_INCLUDED
50 typedef T element_type;
58 if(p_ != 0 && add_ref) intrusive_ptr_add_ref(p_);
63 if(p_ != 0) intrusive_ptr_add_ref(p_);
68 if(p_ != 0) intrusive_ptr_release(p_);
73 if(p_ != 0) intrusive_ptr_add_ref(p_);
98 T * operator->()
const
104 typedef T *
this_type::*unspecified_bool_type;
106 operator unspecified_bool_type ()
const
108 return p_ == 0? 0: &this_type::p_;
112 bool operator! ()
const
131 return a.get() == b.get();
134 template<
class T,
class U>
inline bool operator!=(intrusive_ptr<T>
const & a, intrusive_ptr<U>
const & b)
136 return a.get() != b.get();
139 template<
class T>
inline bool operator==(intrusive_ptr<T>
const & a, T * b)
144 template<
class T>
inline bool operator!=(intrusive_ptr<T>
const & a, T * b)
149 template<
class T>
inline bool operator==(T * a, intrusive_ptr<T>
const & b)
154 template<
class T>
inline bool operator!=(T * a, intrusive_ptr<T>
const & b)
159 template<
class T>
inline bool operator<(intrusive_ptr<T>
const & a, intrusive_ptr<T>
const & b)
161 return std::less<T *>()(a.get(), b.get());
164 template<
class T>
void swap(intrusive_ptr<T> & lhs, intrusive_ptr<T> & rhs)
171 template<
class T> T * get_pointer(intrusive_ptr<T>
const & p)
176 template<
class T,
class U> intrusive_ptr<T> static_pointer_cast(intrusive_ptr<U>
const & p)
178 return static_cast<T *
>(p.get());
181 template<
class T,
class U> intrusive_ptr<T> const_pointer_cast(intrusive_ptr<U>
const & p)
183 return const_cast<T *
>(p.get());
186 template<
class T,
class U> intrusive_ptr<T> dynamic_pointer_cast(intrusive_ptr<U>
const & p)
188 return dynamic_cast<T *
>(p.get());
194 template<
class E,
class T,
class Y>
195 std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, intrusive_ptr<Y>
const & p)
204 #endif // #ifndef BOOSTER_INTRUSIVE_PTR_H_INCLUDED
intrusive_ptr is the class taken as-is from boost.
Definition: intrusive_ptr.h:42