39 #ifndef CGU_INTRUSIVE_PTR_H
40 #define CGU_INTRUSIVE_PTR_H
52 #ifdef CGU_INTRUSIVE_LOCK_COUNTER_USE_MUTEX
104 if (obj_p) obj_p->unref();
108 if (obj_p) obj_p->ref();
127 obj_p = intr_ptr.obj_p;
136 obj_p = intr_ptr.obj_p;
150 obj_p = intr_ptr.obj_p;
162 obj_p = intr_ptr.obj_p;
212 T*
get()
const {
return obj_p;}
293 if (count == 0)
delete this;
328 #ifdef CGU_INTRUSIVE_LOCK_COUNTER_USE_MUTEX
357 #ifdef CGU_INTRUSIVE_LOCK_COUNTER_USE_MUTEX
361 g_atomic_int_inc(&count);
372 #ifdef CGU_INTRUSIVE_LOCK_COUNTER_USE_MUTEX
381 if (g_atomic_int_dec_and_test(&count)) {
408 #if defined(CGU_USE_SMART_PTR_COMPARISON) || defined(DOXYGEN_PARSING)
422 return (s1.
get() == s2.
get());
453 return std::less<T*>()(s1.get(), s2.get());
456 #endif // CGU_USE_SMART_PTR_COMPARISON
463 #if defined(CGU_USE_SMART_PTR_COMPARISON) && !defined(DOXYGEN_PARSING)
468 struct hash<Cgu::IntrusivePtr<T>> {
469 typedef std::size_t result_type;
471 result_type operator()(
const argument_type& s)
const {
479 #endif // CGU_USE_SMART_PTR_COMPARISON