std::shared_ptr:共享所有权与控制块 | C++

本章覆盖:`std::shared_ptr`;reference count;control block;`make_shared`;copy ownership;destruction;aliasing constructor 的高级定位;shared ownership 的真实语义;ref count 有同步 / 间接成本;不要把 shared_ptr 当“更安全的默认指针”。

本章知识点

  • std::shared_ptr
  • reference count
  • control block
  • make_shared
  • copy ownership
  • destruction
  • aliasing constructor 的高级定位
  • shared ownership 的真实语义
  • ref count 有同步 / 间接成本
  • 不要把 shared_ptr 当“更安全的默认指针”