|
| | Ref (T *ptr=nullptr) noexcept |
| | Constructs a Ref from a raw pointer.
|
| | Ref (T *ptr, std::atomic< int > *refCount) |
| | Constructs a Ref by sharing an existing ref count.
|
| | Ref (const Ref &other) noexcept |
| | Copy constructor: increments reference count.
|
| template<typename U, typename = std::enable_if_t<std::is_base_of_v<T, U>>> |
| | Ref (const Ref< U > &other) noexcept |
| | Templated copy constructor for base/derived conversions.
|
| | Ref (Ref &&other) noexcept |
| | Move constructor: takes ownership without altering count.
|
| template<typename U, typename = std::enable_if_t<std::is_convertible_v<U*, T*>>> |
| | Ref (Ref< U > &&other) noexcept |
| | Templated move constructor for convertible types.
|
| template<typename T2> |
| Ref< T2 > | As () |
| | Casts this Ref to another Ref type if compatible.
|
| Ref & | operator= (const Ref &other) noexcept |
| | Copy assignment: releases current and increments new count.
|
| Ref & | operator= (Ref &&other) noexcept |
| | Move assignment: releases current and takes ownership.
|
| | ~Ref () |
| | Destructor: releases reference and deletes if last.
|
| T * | Get () const noexcept |
| | Returns the raw pointer.
|
| T & | operator* () const |
| | Dereference operator.
|
| T * | operator-> () const |
| | Arrow operator.
|
| | operator bool () const noexcept |
| | Boolean conversion: true if non-null.
|
| int | GetRefCount () const |
| | Gets the current reference count.
|
| void | Release () |
| | Releases the managed pointer, deleting if last reference.
|
| void | Delete () |
| | Deletes the managed pointer without reference counting.
|
| void | Reset (T *ptr=nullptr) noexcept |
| | Resets the Ref to manage a new pointer.
|
template<typename T>
class Raven::Ref< T >
Atomic reference-counted pointer.
Manages a pointer through an atomic reference count. Automatically deletes the managed object when the last Ref goes out of scope. Supports copying, moving, and cross-casting via As<T>().
- Template Parameters
-
| T | The type of the managed object. |