jam 0.0.1
A compacting generational garbage collector for C++26
Loading...
Searching...
No Matches
jam::root< T > Class Template Referenceexport
Word heap | module jam

A copyable external root, updated during collection.Four-byte slot index; no heap or registration address is stored. The heap must outlive the root and be current for operations and destruction. More...

Inheritance diagram for jam::root< T >:
[legend]
Collaboration diagram for jam::root< T >:
[legend]

Public Member Functions

 root () noexcept=default
 Construct a detached null root.
 root (ptr< T > const &value) noexcept
 Register a pointer with the current heap.
template<class U>
requires (!std::same_as<T, U>) && std::convertible_to<ptr<U>, ptr<T>>
 root (ptr< U > const &value) noexcept
 Register a derived pointer through its base allocation-tracing hook.
ptr< T > get () const noexcept
 Obtain a pointer valid until the next collection.
 operator ptr< T > () const noexcept
 Copy the current pointer; this unrooted copy expires on collection.
T * operator-> () const noexcept
 Borrow the target in its current heap scope.
T & operator* () const noexcept
 Borrow the target in its current heap scope.
 operator bool () const noexcept
 Whether this root currently names a record.

Detailed Description

template<class T>
class jam::root< T >

A copyable external root, updated during collection.

Four-byte slot index; no heap or registration address is stored. The heap must outlive the root and be current for operations and destruction.

Definition at line 2327 of file heap.ccm.

Constructor & Destructor Documentation

◆ root()

template<class T>
jam::root< T >::root ( ptr< T > const & value)
inlinenoexcept

Register a pointer with the current heap.

Precondition
The pointer belongs to the current heap, which outlives this root.

Definition at line 2336 of file heap.ccm.


The documentation for this class was generated from the following file: