AVL iterator. More...
#include <avl_base.hpp>
Public Types | |
typedef K | value_type |
typedef K & | reference |
typedef K *const | pointer |
typedef ptrdiff_t | difference_type |
typedef std::bidirectional_iterator_tag | iterator_category |
Public Member Functions | |
avl_iterator () | |
Constructor. | |
avl_iterator (avl_node_ptr node, bool final) | |
Constructor. | |
avl_iterator & | operator++ () |
Preincrement. | |
avl_iterator | operator++ (int) |
Postincrement. | |
avl_iterator & | operator-- () |
Predecrement. | |
avl_iterator | operator-- (int) |
Postdecrement. | |
reference | operator* () const |
Dereference. | |
pointer | operator-> () const |
Reference. | |
bool | operator== (const avl_iterator &it) const |
Equality. | |
bool | operator!= (const avl_iterator &it) const |
Difference. | |
Private Attributes | |
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 131 of file avl_base.hpp.
typedef ptrdiff_t claw::avl_base< K, Comp >::avl_iterator::difference_type |
Definition at line 137 of file avl_base.hpp.
typedef std::bidirectional_iterator_tag claw::avl_base< K, Comp >::avl_iterator::iterator_category |
Definition at line 139 of file avl_base.hpp.
typedef K* const claw::avl_base< K, Comp >::avl_iterator::pointer |
Definition at line 136 of file avl_base.hpp.
typedef K& claw::avl_base< K, Comp >::avl_iterator::reference |
Definition at line 135 of file avl_base.hpp.
typedef K claw::avl_base< K, Comp >::avl_iterator::value_type |
Definition at line 134 of file avl_base.hpp.
claw::avl_base< K, Comp >::avl_iterator::avl_iterator | ( | ) | [inline] |
Constructor.
Definition at line 607 of file avl_base.tpp.
00608 : m_current(NULL), m_is_final(true) 00609 { 00610 00611 } // avl_iterator::avl_iterator() [constructeur]
claw::avl_base< K, Comp >::avl_iterator::avl_iterator | ( | avl_node_ptr | node, | |
bool | final | |||
) | [inline] |
Constructor.
Definition at line 619 of file avl_base.tpp.
00620 : m_current(node), m_is_final(final) 00621 { 00622 00623 } // avl_iterator::avl_iterator() [constructeur with node]
bool claw::avl_base< K, Comp >::avl_iterator::operator!= | ( | const avl_iterator & | it | ) | const [inline] |
claw::avl_base< K, Comp >::avl_iterator::reference claw::avl_base< K, Comp >::avl_iterator::operator* | ( | ) | const [inline] |
Dereference.
Definition at line 700 of file avl_base.tpp.
References claw::avl_base< K, Comp >::avl_node::key, and claw::avl_base< K, Comp >::avl_iterator::m_current.
00701 { 00702 return m_current->key; 00703 } // avl_iterator::operator*() [dereference]
claw::avl_base< K, Comp >::avl_iterator claw::avl_base< K, Comp >::avl_iterator::operator++ | ( | int | ) | [inline] |
Postincrement.
Definition at line 653 of file avl_base.tpp.
00654 { 00655 avl_iterator it = *this; 00656 ++(*this); 00657 return it; 00658 } // avl_iterator::operator++ [postincrement]
claw::avl_base< K, Comp >::avl_iterator & claw::avl_base< K, Comp >::avl_iterator::operator++ | ( | ) | [inline] |
Preincrement.
Definition at line 632 of file avl_base.tpp.
References claw::avl_base< K, Comp >::avl_iterator::m_current, claw::avl_base< K, Comp >::avl_iterator::m_is_final, and claw::avl_base< K, Comp >::avl_node::next().
00633 { 00634 assert(!m_is_final); 00635 assert(m_current); 00636 00637 avl_node* p = m_current->next(); 00638 00639 if ( m_current == p ) 00640 m_is_final = true; 00641 else 00642 m_current = p; 00643 00644 return *this; 00645 } // avl_iterator::operator++() [preincrement]
claw::avl_base< K, Comp >::avl_iterator claw::avl_base< K, Comp >::avl_iterator::operator-- | ( | int | ) | [inline] |
Postdecrement.
Definition at line 687 of file avl_base.tpp.
00688 { 00689 avl_iterator it = *this; 00690 --(*this); 00691 return it; 00692 } // avl_iterator::operator-- [postdecrement]
claw::avl_base< K, Comp >::avl_iterator & claw::avl_base< K, Comp >::avl_iterator::operator-- | ( | ) | [inline] |
Predecrement.
Definition at line 667 of file avl_base.tpp.
References claw::avl_base< K, Comp >::avl_iterator::m_current, claw::avl_base< K, Comp >::avl_iterator::m_is_final, and claw::avl_base< K, Comp >::avl_node::prev().
00668 { 00669 assert(m_current); 00670 00671 if (m_is_final) 00672 m_is_final = !m_is_final; 00673 else 00674 m_current = m_current->prev(); 00675 00676 assert(m_current != NULL); 00677 00678 return *this; 00679 } // avl_iterator::operator--() [predecrement]
claw::avl_base< K, Comp >::avl_iterator::pointer claw::avl_base< K, Comp >::avl_iterator::operator-> | ( | ) | const [inline] |
Reference.
Definition at line 711 of file avl_base.tpp.
References claw::avl_base< K, Comp >::avl_node::key, and claw::avl_base< K, Comp >::avl_iterator::m_current.
00712 { 00713 return &m_current->key; 00714 } // avl_iterator::operator->()
bool claw::avl_base< K, Comp >::avl_iterator::operator== | ( | const avl_iterator & | it | ) | const [inline] |
Equality.
it | Iterator to compare to. |
Definition at line 723 of file avl_base.tpp.
References claw::avl_base< K, Comp >::avl_iterator::m_current, and claw::avl_base< K, Comp >::avl_iterator::m_is_final.
00724 { 00725 return (m_current == it.m_current) && (m_is_final == it.m_is_final); 00726 } // avl_iterator::operator==()
avl_node_ptr claw::avl_base< K, Comp >::avl_iterator::m_current [private] |
Current node in the tree.
Definition at line 156 of file avl_base.hpp.
Referenced by claw::avl_base< K, Comp >::avl_iterator::operator*(), claw::avl_base< K, Comp >::avl_iterator::operator++(), claw::avl_base< K, Comp >::avl_iterator::operator--(), claw::avl_base< K, Comp >::avl_iterator::operator->(), and claw::avl_base< K, Comp >::avl_iterator::operator==().
bool claw::avl_base< K, Comp >::avl_iterator::m_is_final [private] |
True if we've gone past the last node.
Definition at line 159 of file avl_base.hpp.
Referenced by claw::avl_base< K, Comp >::avl_iterator::operator++(), claw::avl_base< K, Comp >::avl_iterator::operator--(), and claw::avl_base< K, Comp >::avl_iterator::operator==().