CdmNode.tryGet

inout(CdmNode) * tryGet(string key) inout pure nothrow @safe

Safe read-only lookup by key without auto-creation.

Unlike opIndex(string), this method does NOT convert NULL to OBJECT and does NOT create a new member if the key is missing. This makes it safe for read-only access patterns where you don't want to accidentally mutate the node.

This is the preferred method for checking if a key exists before accessing it, and for read-only traversals.

Parameters

keyThe member key to look up. Returns null for empty keys if this node is not an OBJECT (m-70 safe behavior).

Returns

A pointer to the value node if the key exists, or null if:
  • This node is not an OBJECT
  • The key does not exist

See Also

opIndex for auto-vivifying access (creates missing keys).