admin管理员组

文章数量:1292183

When reading the implementation for std::shared_ptr in llvm libc++, I find that some member functions of the __shared_weak_count class are put in libcxx/src/memory.cpp, instead of being put into the header file libcxx/include/__memory/shared_ptr.h. For example,

// in libcxx/src/memory.cpp
__shared_weak_count::~__shared_weak_count();

void __shared_weak_count::__release_weak() noexcept;
// in libcxx/include/__memory/shared_ptr.h
__shared_weak_count::__shared_weak_count();

long __shared_weak_count::use_count();

My question is: why some definitions in the libc++ standard library implementation like __shared_weak_count::__release_weak go into the dynamic library, while other class member functions of the same class do not?

本文标签: