AVL iterator. More...
#include <avl_base.hpp>
Public Types | |
typedef K | value_type |
typedef const K & | reference |
typedef const K *const | pointer |
typedef ptrdiff_t | difference_type |
typedef std::bidirectional_iterator_tag | iterator_category |
Public Member Functions | |
avl_const_iterator () | |
Constructor. | |
avl_const_iterator (const_avl_node_ptr node, bool final) | |
Constructor. | |
avl_const_iterator & | operator++ () |
Preincrement. | |
avl_const_iterator | operator++ (int) |
Postincrement. | |
avl_const_iterator & | operator-- () |
Predecrement. | |
avl_const_iterator | operator-- (int) |
Postdecrement. | |
reference | operator* () const |
Dereference. | |
pointer | operator-> () const |
Reference. | |
bool | operator== (const avl_const_iterator &it) const |
Equality. | |
bool | operator!= (const avl_const_iterator &it) const |
Difference. | |
Private Attributes | |
const_avl_node_ptr | m_current |
Current node in the tree. | |
bool | m_is_final |
True if we've gone past the last node. |
AVL iterator.
Definition at line 166 of file avl_base.hpp.
typedef ptrdiff_t claw::avl_base< K, Comp >::avl_const_iterator::difference_type |
Definition at line 172 of file avl_base.hpp.
typedef std::bidirectional_iterator_tag claw::avl_base< K, Comp >::avl_const_iterator::iterator_category |
Definition at line 174 of file avl_base.hpp.
typedef const K* const claw::avl_base< K, Comp >::avl_const_iterator::pointer |
Definition at line 171 of file avl_base.hpp.
typedef const K& claw::avl_base< K, Comp >::avl_const_iterator::reference |
Definition at line 170 of file avl_base.hpp.
typedef K claw::avl_base< K, Comp >::avl_const_iterator::value_type |
Definition at line 169 of file avl_base.hpp.
claw::avl_base< K, Comp >::avl_const_iterator::avl_const_iterator | ( | ) | [inline] |
Constructor.
Definition at line 753 of file avl_base.tpp.
00754 : m_current(NULL), m_is_final(true) 00755 { 00756 00757 } // avl_const_iterator::avl_const_iterator() [constructeur]
claw::avl_base< K, Comp >::avl_const_iterator::avl_const_iterator | ( | const_avl_node_ptr | node, | |
bool | final | |||
) | [inline] |
Constructor.
Definition at line 765 of file avl_base.tpp.
00766 : m_current(node), m_is_final(final) 00767 { 00768 00769 } // avl_const_iterator::avl_const_iterator() [constructeur with node]
bool claw::avl_base< K, Comp >::avl_const_iterator::operator!= | ( | const avl_const_iterator & | it | ) | const [inline] |
claw::avl_base< K, Comp >::avl_const_iterator::reference claw::avl_base< K, Comp >::avl_const_iterator::operator* | ( | ) | const [inline] |
Dereference.
Definition at line 846 of file avl_base.tpp.
References claw::avl_base< K, Comp >::avl_const_iterator::m_current.
00847 { 00848 return m_current->key; 00849 } // avl_const_iterator::operator*() [dereference]
claw::avl_base< K, Comp >::avl_const_iterator claw::avl_base< K, Comp >::avl_const_iterator::operator++ | ( | int | ) | [inline] |
Postincrement.
Definition at line 799 of file avl_base.tpp.
00800 { 00801 avl_const_iterator it = *this; 00802 ++(*this); 00803 return it; 00804 } // avl_const_iterator::operator++ [postincrement]
claw::avl_base< K, Comp >::avl_const_iterator & claw::avl_base< K, Comp >::avl_const_iterator::operator++ | ( | ) | [inline] |
Preincrement.
Definition at line 778 of file avl_base.tpp.
References claw::avl_base< K, Comp >::avl_const_iterator::m_current, and claw::avl_base< K, Comp >::avl_const_iterator::m_is_final.
00779 { 00780 assert(!m_is_final); 00781 assert(m_current); 00782 00783 const_avl_node_ptr p = m_current->next(); 00784 00785 if ( m_current == p ) 00786 m_is_final = true; 00787 else 00788 m_current = p; 00789 00790 return *this; 00791 } // avl_const_iterator::operator++() [preincrement]
claw::avl_base< K, Comp >::avl_const_iterator claw::avl_base< K, Comp >::avl_const_iterator::operator-- | ( | int | ) | [inline] |
Postdecrement.
Definition at line 833 of file avl_base.tpp.
00834 { 00835 avl_const_iterator it = *this; 00836 --(*this); 00837 return it; 00838 } // avl_const_iterator::operator-- [postdecrement]
claw::avl_base< K, Comp >::avl_const_iterator & claw::avl_base< K, Comp >::avl_const_iterator::operator-- | ( | ) | [inline] |
Predecrement.
Definition at line 813 of file avl_base.tpp.
References claw::avl_base< K, Comp >::avl_const_iterator::m_current, and claw::avl_base< K, Comp >::avl_const_iterator::m_is_final.
00814 { 00815 assert(m_current); 00816 00817 if (m_is_final) 00818 m_is_final = !m_is_final; 00819 else 00820 m_current = m_current->prev(); 00821 00822 assert(m_current != NULL); 00823 00824 return *this; 00825 } // avl_const_iterator::operator--() [predecrement]
claw::avl_base< K, Comp >::avl_const_iterator::pointer claw::avl_base< K, Comp >::avl_const_iterator::operator-> | ( | ) | const [inline] |
Reference.
Definition at line 857 of file avl_base.tpp.
References claw::avl_base< K, Comp >::avl_const_iterator::m_current.
00858 { 00859 return &m_current->key; 00860 } // avl_const_iterator::operator->()
bool claw::avl_base< K, Comp >::avl_const_iterator::operator== | ( | const avl_const_iterator & | it | ) | const [inline] |
Equality.
it | Iterator to compare to. |
Definition at line 869 of file avl_base.tpp.
00870 { 00871 return (m_current == it.m_current) && (m_is_final == it.m_is_final); 00872 } // avl_const_iterator::operator==()
const_avl_node_ptr claw::avl_base< K, Comp >::avl_const_iterator::m_current [private] |
Current node in the tree.
Definition at line 191 of file avl_base.hpp.
Referenced by claw::avl_base< K, Comp >::avl_const_iterator::operator*(), claw::avl_base< K, Comp >::avl_const_iterator::operator++(), claw::avl_base< K, Comp >::avl_const_iterator::operator--(), and claw::avl_base< K, Comp >::avl_const_iterator::operator->().
bool claw::avl_base< K, Comp >::avl_const_iterator::m_is_final [private] |
True if we've gone past the last node.
Definition at line 194 of file avl_base.hpp.
Referenced by claw::avl_base< K, Comp >::avl_const_iterator::operator++(), and claw::avl_base< K, Comp >::avl_const_iterator::operator--().