35 template <
typename T,
typename...
Args>
37 return std::make_shared<T>(std::forward<
Args...>(args...));
66 typedef shared_count std::__shared_ptr<const void, std::_S_atomic>::*
type;
71 typedef counted_base* shared_count::*
type;
76 typedef _Atomic_word counted_base::*
type;
81 typedef _Atomic_word counted_base::*
type;
86 typedef const void* std::_Sp_counted_ptr<const void*, std::_S_atomic>::*
92 typedef const void* std::__shared_ptr<const void, std::_S_atomic>::*
type;
97 typedef shared_count std::__shared_ptr<const void, std::_S_atomic>::*
type;
101 template <
typename Tag,
typename Tag::type M>
111 &std::__shared_ptr<const void, std::_S_atomic>::_M_refcount>;
114 &shared_ptr_internals::shared_count::_M_pi>;
117 &shared_ptr_internals::counted_base::_M_use_count>;
120 &shared_ptr_internals::counted_base::_M_weak_count>;
123 &std::_Sp_counted_ptr<const void*, std::_S_atomic>::_M_ptr>;
126 &std::__shared_ptr<const void, std::_S_atomic>::_M_ptr>;
129 &std::__shared_ptr<const void, std::_S_atomic>::_M_refcount>;
131 template <
typename T>
138 const std::shared_ptr<const void>&
ptr(
139 reinterpret_cast<const std::shared_ptr<const void>&
>(bar));
149 base->_M_get_use_count() + count < INT_MAX,
"atomic_shared_ptr overflow");
150 __gnu_cxx::__atomic_add_dispatch(
154 template <
typename T>
159 if (__gnu_cxx::__exchange_and_add_dispatch(
163 if (__gnu_cxx::__exchange_and_add_dispatch(
170 template <
typename T>
173 auto inplace = base->_M_get_deleter(
typeid(std::_Sp_make_shared_tag));
178 using derived_type = std::_Sp_counted_ptr<const void*, std::_S_atomic>;
179 auto ptr =
reinterpret_cast<derived_type*
>(base);
183 template <
typename T>
186 std::shared_ptr<const void>&
ptr(
187 reinterpret_cast<std::shared_ptr<const void>&
>(p));
193 template <
typename T>
194 inline std::shared_ptr<T>
201 std::shared_ptr<const void> newp;
206 get_shared_ptr<const void>(base);
209 auto res =
reinterpret_cast<std::shared_ptr<T>*
>(&newp);
static void release_shared(counted_base *base, long count)
std::_Sp_counted_base< std::_S_atomic > counted_base
friend type fieldPtr(access_shared_ptr)
constexpr detail::Map< Move > move
counted_base *shared_count::* type
static counted_base * get_counted_base(const std::shared_ptr< T > &bar)
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
—— Concurrent Priority Queue Implementation ——
static std::shared_ptr< T > make_ptr(Args &&...args)
_Atomic_word counted_base::* type
_Atomic_word counted_base::* type
#define FOLLY_SAFE_CHECK(expr, msg)
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
std::__shared_count< std::_S_atomic > shared_count
static void inc_shared_count(counted_base *base, long count)
static T * get_shared_ptr(counted_base *base)
friend Tag::type fieldPtr(Tag)
static std::shared_ptr< T > get_shared_ptr_from_counted_base(counted_base *base, bool inc=true)
std::shared_ptr< T > CountedPtr
static T * release_ptr(std::shared_ptr< T > &p)