[#BloombergLP-bslstl-TreeIterator]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::TreeIterator
:relfileprefix: ../../
:mrdocs:

This class provides an STL&hyphen;conforming bidirectional iterator over the ordered `bslalg&colon;&colon;RbTreeNode` objects in a binary tree (see section &lsqb;24&period;2&period;6 bidirectional&period;iterators&rsqb;of the C&plus;&plus;11 standard)&period; 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&colon;&colon;RbTreeNode`)&period; The parameterized `DIFFERENCE&lowbar;TYPE` determines the standard required `difference&lowbar;type` of the iterator, without requiring access to the allocator&hyphen;traits for the node&period; The behavior of the `operator&ast;` method is undefined unless the iterator is at a valid position in the tree (i&period;e&period;, not the `end`) and the referenced element has not been removed since the iterator was constructed&period; `NODE` must derives from `bslalg&colon;&colon;RbTreeNode`, and contains a `value` method that returns a reference providing modifiable access to a type that is convertible to the parameterized `VALUE` (e&period;g&period;, a `bslstl&colon;&colon;TreeNode` object)&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;treeiterator&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class VALUE,
    class NODE,
    class DIFFERENCE&lowbar;TYPE&gt;
class TreeIterator;
----

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/TreeIterator/difference_type.adoc[`difference&lowbar;type`] 
| The difference type for this iterator&period;
| xref:BloombergLP/bslstl/TreeIterator/iterator_category.adoc[`iterator&lowbar;category`] 
| The STL iterator category tag for this iterator&period;
| xref:BloombergLP/bslstl/TreeIterator/pointer.adoc[`pointer`] 
| Pointer type for the value referred to by this iterator&period;
| xref:BloombergLP/bslstl/TreeIterator/reference.adoc[`reference`] 
| Standard iterator defined types &lsqb;24&period;4&period;2&rsqb;&period;
| xref:BloombergLP/bslstl/TreeIterator/value_type.adoc[`value&lowbar;type`] 
| The value type referred to by this iterator&period;
|===


== 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 non&hyphen;modifiable tree node at which this iterator is positioned, or 0 if this iterator is not at a valid position in the tree&period; Note that this method is an implementation detail and is not part of the C&plus;&plus; standard&period;
| xref:BloombergLP/bslstl/TreeIterator/operator_star.adoc[`operator&ast;`] 
| Return a reference providing modifiable access to the value (of the parameterized `VALUE`) of the element at which this iterator is positioned&period; The behavior is undefined unless this iterator is at a valid position in the tree&period;
| xref:BloombergLP/bslstl/TreeIterator/operator_inc.adoc[`operator&plus;&plus;`] 
| Move this iterator to the next element in the tree and return a reference providing modifiable access to this iterator&period; The behavior is undefined unless the iterator refers to an element in the tree&period;
| xref:BloombergLP/bslstl/TreeIterator/operator_dec.adoc[`operator&hyphen;&hyphen;`] 
| Move this iterator to the previous element in the tree and return a reference providing modifiable access to this iterator&period; The behavior is undefined unless the iterator refers to the past&hyphen;the&hyphen;end address or the non&hyphen;leftmost element in the tree&period;
| xref:BloombergLP/bslstl/TreeIterator/operator_ptr.adoc[`operator&hyphen;&gt;`] 
| Return the address of the value (of the parameterized `VALUE`) of the element at which this iterator is positioned&period; The behavior is undefined unless this iterator is at a valid position in the tree&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `BloombergLP::bslstl::TreeIterator`
| This class provides an STL&hyphen;conforming bidirectional iterator over the ordered `bslalg&colon;&colon;RbTreeNode` objects in a binary tree (see section &lsqb;24&period;2&period;6 bidirectional&period;iterators&rsqb;of the C&plus;&plus;11 standard)&period; 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&colon;&colon;RbTreeNode`)&period; The parameterized `DIFFERENCE&lowbar;TYPE` determines the standard required `difference&lowbar;type` of the iterator, without requiring access to the allocator&hyphen;traits for the node&period; The behavior of the `operator&ast;` method is undefined unless the iterator is at a valid position in the tree (i&period;e&period;, not the `end`) and the referenced element has not been removed since the iterator was constructed&period; `NODE` must derives from `bslalg&colon;&colon;RbTreeNode`, and contains a `value` method that returns a reference providing modifiable access to a type that is convertible to the parameterized `VALUE` (e&period;g&period;, a `bslstl&colon;&colon;TreeNode` object)&period;
| `xref:BloombergLP/bslstl/operator_eq-02.adoc[BloombergLP::bslstl::operator&equals;&equals;]`
| Return whether the specified iterators refer to the same tree node&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/operator_inc-02.adoc[`operator&plus;&plus;`]
| Move the specified `iter` to the next element in the tree and return the value of `iter` prior to this call&period; The behavior is undefined unless the iterator refers to an element in the tree&period;
| xref:BloombergLP/bslstl/operator_dec-03.adoc[`operator&hyphen;&hyphen;`]
| Move the specified `iter` to the previous element in the tree and return the value of `iter` prior to this call&period; The behavior is undefined unless the iterator refers to the past&hyphen;the&hyphen;end or the non&hyphen;leftmost element in the tree&period;
| xref:BloombergLP/bslstl/operator_eq-0c0.adoc[`operator&equals;&equals;`]
| Return `true` if the specified `lhs` and the specified `rhs` iterators have the same value and `false` otherwise&period; Two iterators have the same value if they refer to the same position in the same tree, or if both iterators are at an invalid position in the tree (i&period;e&period;, the `end` of the tree, or the default constructed value)&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
