Skip to content
Welcome to the new CppUtils documentation!

Thread-safe handle to a node in a non-hierarchical cyclic mesh graph.

Template parameterDescription
KeyBranch key type.
ValuePayload value type stored inside each node.
PolicyOptional lazy-resolution policy type (e.g. MeshPager::Policy), or void when disabled.
using CppUtils::Container::MeshNodePtr<Key, Value, Policy>::MutableBranch = Branch<false>;

Read-write branch proxy holding a unique lock.

using CppUtils::Container::MeshNodePtr<Key, Value, Policy>::ConstBranch = Branch<true>;

Read-only branch proxy holding a shared lock.

[[nodiscard]] static constexpr auto MeshNodePtr::makeRoot(auto&&... args) -> MeshNodePtr;

Creates a root node that keeps reachable subgraphs alive.

ParameterDescription
argsArguments forwarded to construct Value.

Returns: Handle to the newly created root node.

[[nodiscard]] static constexpr auto MeshNodePtr::make(auto&&... args) -> MeshNodePtr;

Creates a standalone node (unattached until linked from a rooted node).

ParameterDescription
argsArguments forwarded to construct Value.

Returns: Handle to the newly created node.

constexpr MeshNodePtr::MeshNodePtr() = default;

Constructs an empty (null) MeshNodePtr.

explicit constexpr MeshNodePtr::MeshNodePtr(SharedPtr node);

Constructs a MeshNodePtr from an existing underlying SharedPtr.

[[nodiscard]] constexpr auto MeshNodePtr::operator==(const MeshNodePtr& other) const noexcept -> bool;

Checks instance identity (whether both handles point to the same node in memory).

explicit constexpr MeshNodePtr::operator bool() const noexcept;

Returns true if this handle references a valid node.

[[nodiscard]] constexpr auto MeshNodePtr::operator[](this auto&& self, Type::In<Key> key);

Accesses the branch identified by key.

Creates the branch if absent on a mutable handle (MutableBranch), or performs a read-only lookup on a const handle (ConstBranch). | Parameter | Description | | :--- | :--- | | key | Branch identifier. |

Returns: A Branch proxy holding an RAII lock on the branch.

ParameterDescription
std::runtime_errorif the handle is null, or std::out_of_range on a const handle when key is missing.
[[nodiscard]] constexpr auto MeshNodePtr::at(Type::In<Key> key) const -> std::expected<ConstBranch, std::string_view>;

Safely looks up a read-only branch without throwing on missing keys.

ParameterDescription
keyBranch identifier.

Returns: ConstBranch on success, or an error string if the handle is invalid or key is absent.

[[nodiscard]] constexpr auto MeshNodePtr::contains(Type::In<Key> key) const -> bool;

Checks whether a branch with key exists on this node.

[[nodiscard]] constexpr auto MeshNodePtr::getDistanceFromRoot() const -> std::size_t;

Returns the shortest hop distance from any root node (or std::numeric_limits<std::size_t>::max() if unreachable).

[[nodiscard]] constexpr auto MeshNodePtr::getId() const noexcept -> std::size_t;

Returns the numeric identifier assigned to this node (0 if unassigned).

constexpr auto MeshNodePtr::setId(std::size_t newId) const -> void;

Assigns a numeric identifier to this node.

void MeshNodePtr::setPolicy(std::conditional_t<std::is_void_v<Policy>, int, Policy> policy) const;

Attaches or updates the lazy-resolution policy on this node.

[[nodiscard]] constexpr auto MeshNodePtr::operator->(this auto&& self [[clang::lifetimebound, msvc::lifetimebound]]);

Provides pointer-like access to the underlying SharedLocker<NetworkPtr<MeshNode>>.

[[nodiscard]] constexpr auto MeshNodePtr::operator*(this auto&& self [[clang::lifetimebound, msvc::lifetimebound]]) -> decltype(auto);

Dereferences the underlying SharedLocker<NetworkPtr<MeshNode>>.

constexpr auto MeshNodePtr::setValue(auto&& newValue) const -> void;

Updates the node’s payload value in a thread-safe manner.

[[nodiscard]] constexpr auto MeshNodePtr::getValue() const -> Thread::ReadOnlyAccessor<Value>;

Acquires a shared read-only RAII accessor to the node’s payload value.

[[nodiscard]] constexpr auto MeshNodePtr::getBranches() const -> Thread::ReadOnlyAccessor<Branches>;

Acquires a shared read-only RAII accessor to the node’s branch map.

constexpr auto MeshNodePtr::clearBranches() const -> void;

Detaches all outgoing branches from this node.