findFirst

fnCdmNode * findFirst(ref CdmNode root, bool delegate(ref CdmNode) @safe pred) @safe

Finds the first node in a CDM tree matching a predicate.

Performs a depth-first traversal and returns the first node for which the predicate returns true.

Parameters

rootThe root node to search from.
predA predicate delegate that accepts a ref CdmNode and returns true for matching nodes.

Returns

A pointer to the first matching node, or null if no

match is found.