IntrusivePtr
IntrusivePtr
#include <icy/memory.h>template<typename T>
class IntrusivePtrDefined in src/base/include/icy/memory.h:90
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
List of all members
| Name | Kind | Owner |
|---|---|---|
IntrusivePtr | function | Declared here |
IntrusivePtr | function | Declared here |
IntrusivePtr | function | Declared here |
IntrusivePtr | function | Declared here |
IntrusivePtr | function | Declared here |
IntrusivePtr | function | Declared here |
IntrusivePtr | function | Declared here |
~IntrusivePtr | function | Declared here |
operator= | function | Declared here |
operator= | function | Declared here |
operator= | function | Declared here |
operator= | function | Declared here |
reset | function | Declared here |
reset | function | Declared here |
get | function | Declared here |
operator* | function | Declared here |
operator-> | function | Declared here |
operator bool | function | Declared here |
swap | function | Declared here |
detach | function | Declared here |
operator== | function | Declared here |
operator!= | function | Declared here |
operator== | function | Declared here |
operator!= | function | Declared here |
operator< | function | Declared here |
_ptr | variable | Declared here |
Public Methods
| Return | Name | Description |
|---|---|---|
IntrusivePtr inline noexcept | ||
IntrusivePtr inline noexcept | ||
IntrusivePtr inline explicit noexcept | ||
IntrusivePtr inline noexcept | ||
IntrusivePtr inline noexcept | ||
IntrusivePtr inline noexcept | ||
IntrusivePtr inline noexcept | ||
void | reset inline noexcept | Releases ownership of the current pointer, decrementing its refcount. The pointer is set to null. |
void | reset inline noexcept | Releases the current pointer and takes ownership of p, incrementing its refcount. |
T * | get const inline noexcept | Returns the raw pointer without transferring ownership. |
T & | operator* const inline noexcept | Dereferences the managed pointer. |
T * | operator-> const inline noexcept | Member access on the managed pointer. |
operator bool const inline explicit noexcept | Returns true if the pointer is non-null. | |
void | swap inline noexcept | Swaps the managed pointer with another IntrusivePtr. |
void | detach inline noexcept | Release ownership without decrementing refcount. Used internally for move construction across types. |
bool | operator== const inline noexcept | |
bool | operator!= const inline noexcept | |
bool | operator== const inline noexcept | |
bool | operator!= const inline noexcept | |
bool | operator< const inline noexcept |
IntrusivePtr
inline noexcept
inline IntrusivePtr() noexceptDefined in src/base/include/icy/memory.h:93
IntrusivePtr
inline noexcept
inline IntrusivePtr(std::nullptr_t) noexceptDefined in src/base/include/icy/memory.h:94
IntrusivePtr
inline explicit noexcept
inline explicit IntrusivePtr(T * p) noexceptDefined in src/base/include/icy/memory.h:96
IntrusivePtr
inline noexcept
inline IntrusivePtr(const IntrusivePtr & r) noexceptDefined in src/base/include/icy/memory.h:101
IntrusivePtr
inline noexcept
template<typename U> inline IntrusivePtr(const IntrusivePtr< U > & r) noexceptDefined in src/base/include/icy/memory.h:107
IntrusivePtr
inline noexcept
inline IntrusivePtr(IntrusivePtr && r) noexceptDefined in src/base/include/icy/memory.h:112
IntrusivePtr
inline noexcept
template<typename U> inline IntrusivePtr(IntrusivePtr< U > && r) noexceptDefined in src/base/include/icy/memory.h:118
reset
inline noexcept
inline void reset() noexceptDefined in src/base/include/icy/memory.h:155
Releases ownership of the current pointer, decrementing its refcount. The pointer is set to null.
reset
inline noexcept
inline void reset(T * p) noexceptDefined in src/base/include/icy/memory.h:162
Releases the current pointer and takes ownership of p, incrementing its refcount.
Parameters
pNew raw pointer to manage (may be nullptr).
get
const inline noexcept
inline T * get() const noexceptDefined in src/base/include/icy/memory.h:169
Returns the raw pointer without transferring ownership.
Returns
Raw pointer to the managed object, or nullptr.
operator*
const inline noexcept
inline T & operator*() const noexceptDefined in src/base/include/icy/memory.h:173
Dereferences the managed pointer.
Returns
Reference to the managed object.
operator->
const inline noexcept
inline T * operator->() const noexceptDefined in src/base/include/icy/memory.h:177
Member access on the managed pointer.
Returns
Raw pointer to the managed object.
operator bool
const inline explicit noexcept
inline explicit operator bool() const noexceptDefined in src/base/include/icy/memory.h:180
Returns true if the pointer is non-null.
swap
inline noexcept
inline void swap(IntrusivePtr & r) noexceptDefined in src/base/include/icy/memory.h:184
Swaps the managed pointer with another IntrusivePtr.
Parameters
rThe other IntrusivePtr to swap with.
detach
inline noexcept
inline void detach() noexceptDefined in src/base/include/icy/memory.h:188
Release ownership without decrementing refcount. Used internally for move construction across types.
operator==
const inline noexcept
inline bool operator==(const IntrusivePtr & r) const noexceptDefined in src/base/include/icy/memory.h:190
operator!=
const inline noexcept
inline bool operator!=(const IntrusivePtr & r) const noexceptDefined in src/base/include/icy/memory.h:191
operator==
const inline noexcept
inline bool operator==(std::nullptr_t) const noexceptDefined in src/base/include/icy/memory.h:192
operator!=
const inline noexcept
inline bool operator!=(std::nullptr_t) const noexceptDefined in src/base/include/icy/memory.h:193
operator<
const inline noexcept
inline bool operator<(const IntrusivePtr & r) const noexceptDefined in src/base/include/icy/memory.h:194
Private Attributes
| Return | Name | Description |
|---|---|---|
T * | _ptr |
_ptr
T * _ptr