BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE > Class Template Reference

#include <bslstl_treeiterator.h>

Public Types

typedef bsl::bidirectional_iterator_tag iterator_category
 
typedef NcType value_type
 
typedef DIFFERENCE_TYPE difference_type
 
typedef VALUE * pointer
 
typedef VALUE & reference
 Standard iterator defined types [24.4.2].
 

Public Member Functions

 TreeIterator ()
 Create an uninitialized iterator.
 
 TreeIterator (const bslalg::RbTreeNode *node)
 
template<class NON_CONST_ITERATOR >
 TreeIterator (const NON_CONST_ITERATOR &original, typename bsl::enable_if< bsl::is_convertible< NON_CONST_ITERATOR, NcIter >::value, int >::type=0)
 
 TreeIterator (const TreeIterator &original)=default
 
 ~TreeIterator ()=default
 
TreeIteratoroperator= (const TreeIterator &rhs)=default
 
TreeIteratoroperator++ ()
 
TreeIteratoroperator-- ()
 
reference operator* () const
 
pointer operator-> () const
 
const bslalg::RbTreeNodenode () const
 

Friends

template<class OTHER_VALUE , class OTHER_NODE , class OTHER_DIFFERENCE_TYPE >
class TreeIterator
 
template<class VALUE1 , class VALUE2 , class NODEPTR , class DIFF >
bool operator== (const TreeIterator< VALUE1, NODEPTR, DIFF > &, const TreeIterator< VALUE2, NODEPTR, DIFF > &)
 
template<class VALUE1 , class VALUE2 , class NODEPTR , class DIFF >
bool operator!= (const TreeIterator< VALUE1, NODEPTR, DIFF > &, const TreeIterator< VALUE2, NODEPTR, DIFF > &)
 

Detailed Description

template<class VALUE, class NODE, class DIFFERENCE_TYPE>
class bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >

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).

Member Typedef Documentation

◆ difference_type

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
typedef DIFFERENCE_TYPE bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::difference_type

◆ iterator_category

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
typedef bsl::bidirectional_iterator_tag bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::iterator_category

◆ pointer

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
typedef VALUE* bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::pointer

◆ reference

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
typedef VALUE& bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::reference

◆ value_type

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
typedef NcType bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::value_type

Constructor & Destructor Documentation

◆ TreeIterator() [1/4]

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::TreeIterator ( )
inline

◆ TreeIterator() [2/4]

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::TreeIterator ( const bslalg::RbTreeNode node)
inlineexplicit

Create an iterator at the specified position. The behavior is undefined unless node is of the parameterized NODE, which is derived from 'bslalg::RbTreeNode. Note that this constructor is an implementation detail and is not part of the C++ standard.

◆ TreeIterator() [3/4]

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
template<class NON_CONST_ITERATOR >
bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::TreeIterator ( const NON_CONST_ITERATOR &  original,
typename bsl::enable_if< bsl::is_convertible< NON_CONST_ITERATOR, NcIter >::value, int >::type  = 0 
)
inline

Create an iterator at the same position as the specified original iterator. Note that this constructor enables converting from modifiable to const iterator types.

◆ TreeIterator() [4/4]

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::TreeIterator ( const TreeIterator< VALUE, NODE, DIFFERENCE_TYPE > &  original)
default

◆ ~TreeIterator()

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::~TreeIterator ( )
default

Member Function Documentation

◆ node()

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
const bslalg::RbTreeNode * bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::node ( ) const
inline

Return the address of the non-modifiable tree node at which this iterator is positioned, or 0 if this iterator is not at a valid position in the tree. Note that this method is an implementation detail and is not part of the C++ standard.

◆ operator*()

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::reference bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::operator* ( ) const
inline

Return a reference providing modifiable access to the value (of the parameterized VALUE) of the element at which this iterator is positioned. The behavior is undefined unless this iterator is at a valid position in the tree.

◆ operator++()

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
TreeIterator< VALUE, NODE, DIFFERENCE_TYPE > & bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::operator++ ( )
inline

Move this iterator to the next element in the tree and return a reference providing modifiable access to this iterator. The behavior is undefined unless the iterator refers to an element in the tree.

◆ operator--()

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
TreeIterator< VALUE, NODE, DIFFERENCE_TYPE > & bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::operator-- ( )
inline

Move this iterator to the previous element in the tree and return a reference providing modifiable access to this iterator. The behavior is undefined unless the iterator refers to the past-the-end address or the non-leftmost element in the tree.

◆ operator->()

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::pointer bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::operator-> ( ) const
inline

Return the address of the value (of the parameterized VALUE) of the element at which this iterator is positioned. The behavior is undefined unless this iterator is at a valid position in the tree.

◆ operator=()

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
TreeIterator & bslstl::TreeIterator< VALUE, NODE, DIFFERENCE_TYPE >::operator= ( const TreeIterator< VALUE, NODE, DIFFERENCE_TYPE > &  rhs)
default

Friends And Related Symbol Documentation

◆ operator!=

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
template<class VALUE1 , class VALUE2 , class NODEPTR , class DIFF >
bool operator!= ( const TreeIterator< VALUE1, NODEPTR, DIFF > &  lhs,
const TreeIterator< VALUE2, NODEPTR, DIFF > &  rhs 
)
friend

Return true if the specified lhs and the specified rhs iterators do not have the same value and false otherwise. Two iterators do not have the same value if they differ in either the tree to which they refer or the position in that tree.

◆ operator==

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
template<class VALUE1 , class VALUE2 , class NODEPTR , class DIFF >
bool operator== ( const TreeIterator< VALUE1, NODEPTR, DIFF > &  lhs,
const TreeIterator< VALUE2, NODEPTR, DIFF > &  rhs 
)
friend

Return true if the specified lhs and the specified rhs iterators have the same value and false otherwise. 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.e., the end of the tree, or the default constructed value).

◆ TreeIterator

template<class VALUE , class NODE , class DIFFERENCE_TYPE >
template<class OTHER_VALUE , class OTHER_NODE , class OTHER_DIFFERENCE_TYPE >
friend class TreeIterator
friend

The documentation for this class was generated from the following file: