Junior — Senior
Basic implementation of a custom shared_ptr
livecode
Task condition
It is necessary to implement a simplified version of a smart pointer of the shared_ptr type. The class should store a pointer to an object and a reference counter, as well as ensure the correct operation of the constructor, destructor, copy constructor, and access operators to the managed object.
template<typename T>
class SimpleSharedPtr {
T* resource; // pointer to the managed object
int* refCount; // reference counter
public:
// constructor, destructor, copy constructor, assignment operator, and access to the object
};