CdmNode.opIndex

CdmNode opIndex(string key) ref pure @safe

Looks up or creates a member by key.

Warning — Auto-Vivification: This operator has side effects:
  • If this node is NULL, it is silently converted to OBJECT.
  • If the key does not exist, a new member with a NULL value is created.

For read-only access without side effects, use tryGet instead.

If the key exists, returns a reference to the member's value. If the key does not exist, a new member is created with a default (NULL) value node and a reference to it is returned.

Parameters

keyThe member key to look up. Empty keys are allowed but discouraged; use tryGet to safely check for empty keys.

Returns

Reference to the value node for the given key.

See Also

tryGet for safe read-only access without auto-vivification.
inout(CdmNode) opIndex(size_t index) ref inout pure @safe

Indexes into this ARRAY or TAG's children by position.

Parameters

indexZero-based child index.

Returns

Reference to the child node at the given index.