#include <__config>
#ifdef _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
#define _LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS
#endif
#include <memory>
#ifndef _LIBCPP_HAS_NO_THREADS
# include <mutex>
# include <thread>
# if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB)
# pragma comment(lib, "pthread")
# endif
#endif
#include "include/atomic_support.h"
_LIBCPP_BEGIN_NAMESPACE_STD
bad_weak_ptr::~bad_weak_ptr() noexcept { … }
const char* bad_weak_ptr::what() const noexcept { … }
__shared_count::~__shared_count() { … }
__shared_weak_count::~__shared_weak_count() { … }
#if defined(_LIBCPP_SHARED_PTR_DEFINE_LEGACY_INLINE_FUNCTIONS)
void __shared_count::__add_shared() noexcept { __libcpp_atomic_refcount_increment(__shared_owners_); }
bool __shared_count::__release_shared() noexcept {
if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1) {
__on_zero_shared();
return true;
}
return false;
}
void __shared_weak_count::__add_shared() noexcept { __shared_count::__add_shared(); }
void __shared_weak_count::__add_weak() noexcept { __libcpp_atomic_refcount_increment(__shared_weak_owners_); }
void __shared_weak_count::__release_shared() noexcept {
if (__shared_count::__release_shared())
__release_weak();
}
#endif
void __shared_weak_count::__release_weak() noexcept { … }
__shared_weak_count* __shared_weak_count::lock() noexcept { … }
const void* __shared_weak_count::__get_deleter(const type_info&) const noexcept { … }
#if !defined(_LIBCPP_HAS_NO_THREADS)
static constexpr std::size_t __sp_mut_count = …;
static constinit __libcpp_mutex_t mut_back[__sp_mut_count] = …;
constexpr __sp_mut::__sp_mut(void* p) noexcept : … { … }
void __sp_mut::lock() noexcept { … }
void __sp_mut::unlock() noexcept { … }
__sp_mut& __get_sp_mut(const void* p) { … }
#endif
void* align(size_t alignment, size_t size, void*& ptr, size_t& space) { … }
_LIBCPP_END_NAMESPACE_STD