39 #pragma GCC poison shared_ptr
57 template<
typename CounterT>
74 virtual void*
get_deleter(
const std::type_info&) = 0;
105 template<
typename PtrT,
typename DeleterT,
typename CounterT>
118 return (ti ==
typeid(DeleterT)) ? &m_del : NULL;
132 template<
typename CounterT>
141 template<
typename PtrT,
typename DeleterT>
166 m_pi->add_ref_copy();
199 return a.m_pi == b.m_pi;
204 return a.m_pi < b.m_pi;
208 return m_pi ? m_pi->get_deleter(ti) : NULL;
215 template<
typename CounterT>
228 m_pi->weak_add_ref();
235 m_pi->weak_add_ref();
240 m_pi->weak_release();
250 m_pi->weak_release();
263 m_pi->weak_release();
283 return a.m_pi == b.m_pi;
288 return a.m_pi < b.m_pi;
292 return m_pi ? m_pi->get_deleter(ti) : NULL;
299 template<
typename CounterT>
305 m_pi->add_ref_lock();
344 template<
typename T,
typename CounterT = CounterT_default>
360 m_count(p, internals::Deleter<T>())
363 template<
typename U,
typename DeleterT>
374 m_count(other.m_count)
381 m_count(other.m_count)
394 m_count(other.m_count)
400 m_count(other.m_count)
406 m_count(other.m_count)
417 m_count = other.m_count;
442 template<
typename U,
typename UDeleterT>
457 operator BooleanType()
const
459 return m_ptr ? &SharedPointer::m_ptr : NULL;
462 bool unique()
const {
return m_count.unique(); }
469 m_count.swap(other.m_count);
475 return m_count.get_deleter(ti);
482 return m_count < rhs.m_count;
488 template<
typename U,
typename UCounterT>
friend class WeakPointer;
493 return a.
get() == b.
get();
499 return a.
get() != b.
get();
503 friend inline bool operator<(const SharedPointer& a, const SharedPointer<U>& b)
513 template<
typename T,
typename CounterT>
519 template<
typename T,
typename U,
typename CounterT>
525 template<
typename T,
typename U,
typename CounterT>
531 template<
typename T,
typename U,
typename CounterT>
537 template<
typename CharT,
typename TraitsT,
typename T,
typename CounterT>
538 std::basic_ostream<CharT, TraitsT>&
541 return os << p.
get();
544 template<
typename DeleterT,
typename T,
typename CounterT>
547 return static_cast<DeleterT*
>(p.
_M_get_deleter(
typeid(DeleterT)));
550 template<
typename T,
typename CounterT =
long>
568 m_count(other.m_count)
570 m_ptr = other.lock().get();
576 m_count(other.m_count)
583 m_ptr = other.lock().get();
584 m_count = other.m_count;
592 m_count = other.m_count;
604 bool expired()
const {
return m_count.use_count() == 0; }
611 m_count.swap(other.m_count);
618 return m_count < rhs.m_count;
624 template<
typename U,
typename UCounterT>
friend class WeakPointer;
627 friend inline bool operator<(const WeakPointer& a, const WeakPointer<U>& b)
636 template<
typename T,
typename CounterT>
647 template<
typename T,
typename CounterT>
653 template<
typename T,
typename CounterT>