liginity
liginity

Reputation: 321

In C++ standard library implementation, why some definition is put into dynamic library like '__shared_weak_count::__release_weak`?

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?

Upvotes: 0

Views: 60

Answers (0)

Related Questions