8 unsigned int refCount = 1;
17 ++refCounter->refCount;
21 SharedPtr& operator=(
const SharedPtr& obj) {
22 if (ptr && refCounter && --refCounter->refCount == 0) {
29 refCounter = obj->refCounter;
31 if (ptr && refCounter) {
32 ++refCounter->refCount;
44 const T* operator->()
const {
48 const T& operator*()
const {
53 if (refCounter !=
nullptr &&
55 --refCounter->refCount == 0
65 SharedPtrRefCounter* refCounter =
nullptr;
66 std::function<void(
void*)> deleteFn;