#include <icy/memory.h>Intrusive smart pointer for RefCounted objects.
Like std::shared_ptr but with zero allocation overhead:
No separate control block (refcount is embedded in the object)
Non-atomic refcount (safe for single-threaded libuv loops)
Same API as shared_ptr for easy migration
| Return | Name | Description |
|---|---|---|
IntrusivePtr inline | ||
IntrusivePtr inline | ||
IntrusivePtr inline explicit | ||
IntrusivePtr inline | ||
IntrusivePtr inline | ||
IntrusivePtr inline | ||
IntrusivePtr inline | ||
void | reset inline | Releases ownership of the current pointer, decrementing its refcount. The pointer is set to null. |
void | reset inline | Releases the current pointer and takes ownership of p, incrementing its refcount. |
T * | get const inline | Returns the raw pointer without transferring ownership. |
T & | operator* const inline | Dereferences the managed pointer. |
T * | operator-> const inline | Member access on the managed pointer. |
operator bool const inline explicit | Returns true if the pointer is non-null. | |
void | swap inline | Swaps the managed pointer with another IntrusivePtr. |
void | detach inline | Release ownership without decrementing refcount. Used internally for move construction across types. |
bool | operator== const inline | |
bool | operator!= const inline | |
bool | operator== const inline | |
bool | operator!= const inline | |
bool | operator< const inline |
inline
inline IntrusivePtr() noexceptinline
inline IntrusivePtr(std::nullptr_t) noexceptinline explicit
inline explicit IntrusivePtr(T * p) noexceptinline
inline IntrusivePtr(const IntrusivePtr & r) noexceptinline
template<typename U> inline IntrusivePtr(const IntrusivePtr< U > & r) noexceptinline
inline IntrusivePtr(IntrusivePtr && r) noexceptinline
template<typename U> inline IntrusivePtr(IntrusivePtr< U > && r) noexceptinline
inline void reset() noexceptReleases ownership of the current pointer, decrementing its refcount. The pointer is set to null.
inline
inline void reset(T * p) noexceptReleases the current pointer and takes ownership of p, incrementing its refcount.
p New raw pointer to manage (may be nullptr).const inline
inline T * get() const noexceptReturns the raw pointer without transferring ownership.
Raw pointer to the managed object, or nullptr.
const inline
inline T & operator*() const noexceptDereferences the managed pointer.
Reference to the managed object.
const inline
inline T * operator->() const noexceptMember access on the managed pointer.
Raw pointer to the managed object.
const inline explicit
inline explicit operator bool() const noexceptReturns true if the pointer is non-null.
inline
inline void swap(IntrusivePtr & r) noexceptSwaps the managed pointer with another IntrusivePtr.
r The other IntrusivePtr to swap with.inline
inline void detach() noexceptRelease ownership without decrementing refcount. Used internally for move construction across types.
const inline
inline bool operator==(const IntrusivePtr & r) const noexceptconst inline
inline bool operator!=(const IntrusivePtr & r) const noexceptconst inline
inline bool operator==(std::nullptr_t) const noexceptconst inline
inline bool operator!=(std::nullptr_t) const noexceptconst inline
inline bool operator<(const IntrusivePtr & r) const noexcept| Return | Name | Description |
|---|---|---|
T * | _ptr |
T * _ptr