|
jam 0.0.1
A compacting generational garbage collector for C++26
|
An external weak slot, updated or cleared by collection without retaining its target.Keep it outside the managed heap. The heap must outlive even an expired attached root. Copies share a registration; moves leave the source detached and expired. Four-byte slot index; operations and destruction require the owning heap current. Operations require a quiescent collector. Old targets remain live during minor collection. More...
Public Member Functions | |
| weak_root () noexcept=default | |
| Construct a detached, expired weak root. | |
| weak_root (ptr< T > const &value) noexcept | |
| Register a pointer with the current heap, which must outlive this root. | |
| weak_root (root< T > const &value) noexcept | |
| Observe a strong root in the current heap without retaining its target. | |
|
template<class U> requires (!std::same_as<T, U>) && std::convertible_to<ptr<U>, ptr<T>> | |
| weak_root (ptr< U > const &value) noexcept | |
| Register a derived pointer through its base allocation-tracing hook. | |
| bool | expired () const noexcept |
| Whether this slot is null; does not initiate collection. | |
| root< T > | lock () const noexcept |
| Retain the current target, or return an empty root if expired. Requires the owning heap current; the strong root remains valid across collection. | |
| void | reset () noexcept |
| Unregister the slot and leave it detached and expired. | |
| void | swap (weak_root &other) noexcept |
| Exchange slots in the same heap without allocating or retaining either target. | |
Friends | |
| void | swap (weak_root &a, weak_root &b) noexcept |
| Exchange two external weak roots. | |
An external weak slot, updated or cleared by collection without retaining its target.
Keep it outside the managed heap. The heap must outlive even an expired attached root. Copies share a registration; moves leave the source detached and expired. Four-byte slot index; operations and destruction require the owning heap current. Operations require a quiescent collector. Old targets remain live during minor collection.