39 #ifndef CGU_INTRUSIVE_PTR_H
40 #define CGU_INTRUSIVE_PTR_H
51 #ifdef CGU_INTRUSIVE_LOCK_COUNTER_USE_MUTEX
103 if (obj_p) obj_p->unref();
107 if (obj_p) obj_p->ref();
126 obj_p = intr_ptr.obj_p;
135 obj_p = intr_ptr.obj_p;
149 obj_p = intr_ptr.obj_p;
161 obj_p = intr_ptr.obj_p;
211 T*
get()
const {
return obj_p;}
292 if (count == 0)
delete this;
332 #ifdef CGU_INTRUSIVE_LOCK_COUNTER_USE_MUTEX
361 #ifdef CGU_INTRUSIVE_LOCK_COUNTER_USE_MUTEX
365 g_atomic_int_inc(&count);
376 #ifdef CGU_INTRUSIVE_LOCK_COUNTER_USE_MUTEX
385 if (g_atomic_int_dec_and_test(&count)) {
412 #if defined(CGU_USE_SMART_PTR_COMPARISON) || defined(DOXYGEN_PARSING)
426 return (s1.
get() == s2.
get());
457 return std::less<T*>()(s1.get(), s2.get());
460 #endif // CGU_USE_SMART_PTR_COMPARISON
467 #if defined(CGU_USE_SMART_PTR_COMPARISON) && !defined(DOXYGEN_PARSING)
472 struct hash<Cgu::IntrusivePtr<T>> {
473 typedef std::size_t result_type;
475 result_type operator()(
const argument_type& s)
const {
483 #endif // CGU_USE_SMART_PTR_COMPARISON