effective_modern_c++
Ctrlk
  • 前言
  • 1 类型推导
  • 2 auto
  • 3 使用高级cpp特性
  • 4 智能指针
    • 条款18 对于独占资源使用std::unique_ptr
    • 条款19 对于共享资源使用std::shared_ptr
    • 条款20 当std::shared_ptr可能悬空时使用std::weak_ptr
    • 条款21 优先考虑使用std::make_unique和std::make_shared,而非直接使用new
    • 条款22 当使用Pimpl惯用法,请在实现文件中定义特殊成员函数
  • 5 右值引用和完美转发
  • 6 lambda表达式
  • 7 并发api
  • 8 些许调整
Powered by GitBook
On this page

4 智能指针

条款18 对于独占资源使用std::unique_ptr条款19 对于共享资源使用std::shared_ptr条款20 当std::shared_ptr可能悬空时使用std::weak_ptr条款21 优先考虑使用std::make_unique和std::make_shared,而非直接使用new条款22 当使用Pimpl惯用法,请在实现文件中定义特殊成员函数
Previous条款17 理解特殊成员函数的生成Next条款18 对于独占资源使用std::unique_ptr

Last updated 2 years ago