9 #ifndef _QI_SHARED_PTR_HPP_
10 #define _QI_SHARED_PTR_HPP_
25 , _refcount(new qi::
Atomic<int>(1))
33 if (--(*_refcount) == 0)
48 if (++(*sp._refcount) != 1)
51 _refcount = sp._refcount;
59 <<
"tried to copy a shared pointer targeted for deletion"
69 if (--(*_refcount) == 0)
74 if (++(*sp._refcount) != 1)
77 _refcount = sp._refcount;
82 <<
"tried to copy a shared pointer targeted for deletion"
106 #endif // _QI_SHARED_PTR_HPP_
~SharedPtr()
Destruct the shared pointer and the pointer if current SharedPtr is the last one to hold the pointer...
T * operator->() const
Pointer accessor.
SharedPtr(const SharedPtr< T > &sp)
Copy shared pointer.
SharedPtr(T *ptr)
Initialization of the SharedPtr with the pointer it will manage.
T & operator*() const
Value accessor.
#define qiLogDebug(...)
Log in debug mode. This level is not shown by default.
Lightweight implementation of shared pointers.
Atomic operations on integers.
SharedPtr & operator=(SharedPtr< T > &sp)
Link current SharedPtr to a new pointer. If old pointer was only held by the current SharedPtr...