C++:智能指针unique_ptr与vector;shared_ptr与vector

文章目录

  • shared_ptr
    • _Sp_counted_base
      • add
  • 错误
  • 分析
  • 如果要看汇编。
  • call __GI___libc_free
  • envoy unique_ptr
  • make_unique (ChatGPT)

shared_ptr

gcc-11.1.0/libstdc+±v3/doc/html/manual/api.html
C++11 support completed (movable iostreams, new I/O manipulators,Unicode conversion utilities, atomic operations for shared_ptr, functions for notifying conditionvariables and making futures ready at thread exit).
Experimental C++17 support added, including most new library features.The meaning of shared_ptr changed tomatch the C++17 semantics.

_Sp_counted_base

是利用这个内部的类,来做refcount的操作。
两个成员变量:

 _Atomic_word  _M_use_count;     // #shared
  _Atom

你可能感兴趣的:(c/c++,c++,开发语言,后端)