In the TCL, descendant iterators iterate over all the descendants of a particular node, which would be considered the parent node of those descendants. The descendant iterators are considered to be special types of iterators in the TCL. There are three types of descendant iterators, which are available for all three tree containers in the library.
pre_order_iterator
post_order_iterator
level_order_iterator
Descendant iterators traverse the depth of a node, as opposed to child iterators, which only traverse the immediate children of a node.
Descendant iterators use iterators in composition, so many operations available to iterator are also available to the descendant
iterators.
The only operations in the tree containers which return descendant iterators are those operations which return the beginning and end of the iterators, as shown below.
pre_order_iterator pre_order_begin()pre_order_iterator pre_order_end()
post_order_iterator post_order_begin()post_order_iterator post_order_end()
level_order_iterator level_order_begin()level_order_iterator level_order_end()