MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ForEachNode

Function ForEachNode

src/script/miniscript.h:199–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197//! Unordered traversal of a miniscript node tree.
198template <typename Key, std::invocable<const Node<Key>&> Fn>
199void ForEachNode(const Node<Key>& root, Fn&& fn)
200{
201 std::vector<std::reference_wrapper<const Node<Key>>> stack{root};
202 while (!stack.empty()) {
203 const Node<Key>& node = stack.back();
204 std::invoke(fn, node);
205 stack.pop_back();
206 for (const auto& sub : node.Subs()) {
207 stack.emplace_back(sub);
208 }
209 }
210}
211
212//! The different node types in miniscript.
213enum class Fragment {

Callers 1

MiniscriptDescriptorMethod · 0.85

Calls 4

emptyMethod · 0.45
backMethod · 0.45
pop_backMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected