for (pugi::xml_node child: tool)
+diff --git a/docs/manual.adoc b/docs/manual.adoc index ab06af9..7b75a23 100644 --- a/docs/manual.adoc +++ b/docs/manual.adoc @@ -1010,6 +1010,13 @@ This is an example of using these functions (link:samples/traverse_rangefor.cpp[ include::samples/traverse_rangefor.cpp[tags=code] ---- +While using `children()` makes the intent of the code clear, note that each node can be treated as a container of child nodes, since it provides `begin()`/`end()` member functions described in the next section. Because of this, you can iterate through node's children simply by using the node itself: + +[source] +---- +for (pugi::xml_node child: tool) +---- + [[access.iterators]] === Traversing node/attribute lists via iterators diff --git a/docs/manual.html b/docs/manual.html index 3be4a2b..43bb197 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -2244,6 +2244,14 @@ If your C++ compiler supports range-based for-loop (this is a C++ } +
While using children()
makes the intent of the code clear, note that each node can be treated as a container of child nodes, since it provides begin()
/end()
member functions described in the next section. Because of this, you can iterate through node’s children simply by using the node itself:
for (pugi::xml_node child: tool)
+