#pragma once #include class ParentNode : public Node { public: template void for_each_child(F) const; template void for_each_child(F); protected: explicit ParentNode(NodeType type) : Node(type) { } }; template inline void ParentNode::for_each_child(Callback callback) const { for (auto* node = first_child(); node; node = node->next_sibling()) callback(*node); } template inline void ParentNode::for_each_child(Callback callback) { for (auto* node = first_child(); node; node = node->next_sibling()) callback(*node); }