20 #ifndef SHAREDPOINTER_H 21 #define SHAREDPOINTER_H 23 #include "pedigree/kernel/processor/types.h" 24 #include "pedigree/kernel/utilities/utility.h" 100 explicit operator bool()
const;
115 template <
class... Args>
160 m_Control = pedigree_std::move(other.m_Control);
162 other.m_Control =
nullptr;
176 __atomic_add_fetch(&p.m_Control->refcount, 1, __ATOMIC_SEQ_CST);
181 m_Control = p.m_Control;
196 m_Control->refcount = 1;
197 m_Control->ptr = ptr;
206 return m_Control->ptr;
230 __atomic_add_fetch(&p.m_Control->refcount, 1, __ATOMIC_SEQ_CST);
235 m_Control = p.m_Control;
244 m_Control = pedigree_std::move(p.m_Control);
245 p.m_Control =
nullptr;
268 return __atomic_load_n(&m_Control->refcount, __ATOMIC_SEQ_CST);
272 template <
class... Args>
276 result.
reset(
new T(args...));
277 return pedigree_std::move(result);
286 size_t rc = __atomic_sub_fetch(&m_Control->refcount, 1, __ATOMIC_SEQ_CST);
290 delete m_Control->ptr;
304 return get() == p.
get();
310 return get() != p.
get();
316 return get() < p.
get();
322 return get() <= p.
get();
328 return get() > p.
get();
334 return get() >= p.
get();
bool operator==(const SharedPointer &p) const
SharedPointer< T > & operator=(const SharedPointer< T > &p)
static SharedPointer< T > allocate(Args...)