智能指针的简单实现
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263template <typename T>class ThreadSafePointer {public: ThreadSafePointer() : data(nullptr), ref_count(new size_t(0)), mutex(new std::mutex()) {} ThreadSafePointer(T* ptr) : data(ptr), ref_count(new size_t(1)), mutex(new std::mutex()) {} ThreadSafePointer(const ThreadSafePointer<T>& other) { std::lock_guard<std::mutex&
...