A single-threaded reference-counting pointer, analogous to Rust's Rc<T>.
More...
|
|
| Rc () |
| | Creates an empty Rc that does not point to any allocation.
|
| |
|
| Rc (const Rc &other) noexcept(noexp) |
| | Copy constructs an Rc, incrementing the strong reference count.
|
| |
| | Rc (T *p) |
| | Constructs an Rc from a raw pointer with the default deleter.
|
| |
| template<typename Deleter > |
| | Rc (T *p, Deleter &&d) |
| | Constructs an Rc from a raw pointer with a custom deleter.
|
| |
| template<typename Deleter , typename Allocator > |
| | Rc (T *p, Deleter &&d, Allocator alloc) |
| | Constructs an Rc from a raw pointer with a custom deleter and allocator.
|
| |
| auto | downgrade () const -> Weak< T > |
| | Creates a Weak pointer to the same allocation.
|
| |
| auto | clone () const noexcept(noexp) -> Rc |
| | Creates a new Rc pointer to the same allocation, incrementing the strong count.
|
| |
| void | swap (Rc &other) noexcept |
| | Swaps the inner pointers of two Rcs.
|
| |
template<typename T>
class alloc::rc::Rc< T >
A single-threaded reference-counting pointer, analogous to Rust's Rc<T>.
- Template Parameters
-
| T | The type of the value managed by reference counting. |
◆ Rc() [1/3]
Constructs an Rc from a raw pointer with the default deleter.
- Parameters
-
| p | The raw pointer to take ownership of. |
◆ Rc() [2/3]
template<typename T >
template<typename Deleter >
Constructs an Rc from a raw pointer with a custom deleter.
- Template Parameters
-
| Deleter | The type of the deleter callable. |
- Parameters
-
| p | The raw pointer to take ownership of. |
| d | The deleter to invoke when the value is dropped. |
◆ Rc() [3/3]
template<typename T >
template<typename Deleter , typename Allocator >
Constructs an Rc from a raw pointer with a custom deleter and allocator.
- Template Parameters
-
| Deleter | The type of the deleter callable. |
| Allocator | The type of the allocator. |
- Parameters
-
| p | The raw pointer to take ownership of. |
| d | The deleter to invoke when the value is dropped. |
| alloc | The allocator used for the control block. |
◆ clone()
Creates a new Rc pointer to the same allocation, incrementing the strong count.
- Returns
- A cloned
Rc.
◆ downgrade()
Creates a Weak pointer to the same allocation.
- Returns
- A
Weak<T> that does not contribute to the strong count.
◆ swap()
Swaps the inner pointers of two Rcs.
- Parameters
-
| other | The other Rc to swap with. |
The documentation for this class was generated from the following file:
- /home/runner/work/rstd/rstd/src/alloc/rc.cppm