// -*- C++ -*- //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef _LIBCPP___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H #define _LIBCPP___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H #include <__atomic/atomic.h> #include <__atomic/memory_order.h> #include <__config> #include <__type_traits/is_reference.h> #include <__utility/move.h> #include <__utility/swap.h> #include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif _LIBCPP_PUSH_MACROS #include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 // For intrusive_shared_ptr to work with a type T, specialize __intrusive_shared_ptr_traits<T> and implement // the following function: // // static std::atomic<U>& __get_atomic_ref_count(T&); // // where U must be an integral type representing the number of references to the object. template <class _Tp> struct __intrusive_shared_ptr_traits; // A reference counting shared_ptr for types whose reference counter // is stored inside the class _Tp itself. // When the reference count goes to zero, the destructor of _Tp will be called template <class _Tp> struct __intrusive_shared_ptr { … }; #endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS #endif // _LIBCPP___STOP_TOKEN_INTRUSIVE_SHARED_PTR_H