[#BloombergLP-bslstl-TreeIterator] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::TreeIterator :relfileprefix: ../../ :mrdocs: STL‐conforming bidirectional iterator over ordered tree nodes. == Synopsis Declared in `<bslstl_treeiterator.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class VALUE, class NODE, class DIFFERENCE_TYPE> class TreeIterator; ---- == Description This class provides an STL‐conforming bidirectional iterator over the ordered `bslalg::RbTreeNode` objects in a binary tree (see section [24.2.6 bidirectional.iterators]of the C++11 standard). A `TreeIterator` provides access to values of the parameterized `VALUE`, over a binary tree composed of nodes of the parameterized `NODE` (which must derive from `bslalg::RbTreeNode`). The parameterized `DIFFERENCE_TYPE` determines the standard required `difference_type` of the iterator, without requiring access to the allocator‐traits for the node. The behavior of the `operator*` method is undefined unless the iterator is at a valid position in the tree (i.e., not the `end`) and the referenced element has not been removed since the iterator was constructed. `NODE` must derives from `bslalg::RbTreeNode`, and contains a `value` method that returns a reference providing modifiable access to a type that is convertible to the parameterized `VALUE` (e.g., a `bslstl::TreeNode` object). == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/TreeIterator/difference_type.adoc[`difference_type`] | The difference type for this iterator. | xref:BloombergLP/bslstl/TreeIterator/iterator_category.adoc[`iterator_category`] | The STL iterator category tag for this iterator. | xref:BloombergLP/bslstl/TreeIterator/pointer.adoc[`pointer`] | Pointer type for the value referred to by this iterator. | xref:BloombergLP/bslstl/TreeIterator/reference.adoc[`reference`] | Standard iterator defined types [24.4.2]. | xref:BloombergLP/bslstl/TreeIterator/value_type.adoc[`value_type`] | The value type referred to by this iterator. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/TreeIterator/2constructor-0a.adoc[`TreeIterator`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bslstl/TreeIterator/node.adoc[`node`] | Return the address of the tree node at this iterator's position. | xref:BloombergLP/bslstl/TreeIterator/operator_star.adoc[`operator*`] | Return a reference to the value at this iterator's position. | xref:BloombergLP/bslstl/TreeIterator/operator_inc.adoc[`operator++`] | Advance this iterator to the next element in the tree. | xref:BloombergLP/bslstl/TreeIterator/operator_dec.adoc[`operator‐‐`] | Move this iterator to the previous element in the tree. | xref:BloombergLP/bslstl/TreeIterator/operator_ptr.adoc[`operator‐>`] | Return a pointer to the value at this iterator's position. |=== == Friends [cols="1,4"] |=== | Name| Description | `BloombergLP::bslstl::TreeIterator` | STL‐conforming bidirectional iterator over ordered tree nodes. | `xref:BloombergLP/bslstl/operator_eq-02.adoc[BloombergLP::bslstl::operator==]` | Return whether the specified iterators refer to the same tree node. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/operator_inc-02.adoc[`operator++`] | Advance `iter` to the next element and return its previous value. | xref:BloombergLP/bslstl/operator_dec-03.adoc[`operator‐‐`] | Move `iter` to the previous element and return its previous value. | xref:BloombergLP/bslstl/operator_eq-0c0.adoc[`operator==`] | Return `true` if `lhs` and `rhs` refer to the same position. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#