绪
本篇是尝试对C++11的三种智能指针(unique_ptr, shared_ptr, weak_ptr)进行的复现结果, 智能指针的复现在面试中经常考到, 需要好好熟悉....也是核心, 是对原生指针的独占包装(没有计数器, 几乎零开销), 也有std::make_unique(C++14引入)可以生成. std::unique_ptr禁止拷贝, 但允许移动到另一个std::...collection vs. shared pointers https://stackoverflow.com/questions/4663385/garbage-collection-vs-shared-pointers...相关视频: CppCon 2016: Herb Sutter "Leak-Freedom in C++......, 因此智能指针可能导致当前线程的卡顿
unique_ptr的简单实现
unique_ptr只能移动不能复制, 因此是唯一的所有权.