aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::AVLTreeReverseIterator< Val, Cmp > Class Template Reference

AVL binary search tree reverse iterator. More...

#include <agrum/base/core/AVLTree.h>

Inheritance diagram for gum::AVLTreeReverseIterator< Val, Cmp >:
Collaboration diagram for gum::AVLTreeReverseIterator< Val, Cmp >:

Public Types

using iterator_category = std::bidirectional_iterator_tag
 Types for STL compliance.
using value_type = Val
 Types for STL compliance.
using reference = value_type&
 Types for STL compliance.
using const_reference = const value_type&
 Types for STL compliance.
using pointer = value_type*
 Types for STL compliance.
using const_pointer = const value_type*
 Types for STL compliance.

Public Member Functions

Constructors / Destructors
 AVLTreeReverseIterator (const AVLTree< Val, Cmp > &tree, const bool rbegin=true) noexcept
 constructor for rbegin iterators
 AVLTreeReverseIterator (const AVLTreeReverseIterator< Val, Cmp > &from) noexcept
 copy constructor
 AVLTreeReverseIterator (AVLTreeReverseIterator< Val, Cmp > &&from) noexcept
 move constructor
 ~AVLTreeReverseIterator () noexcept
 destructor
Operators
AVLTreeReverseIterator< Val, Cmp > & operator= (const AVLTreeReverseIterator< Val, Cmp > &from) noexcept
 copy operator
AVLTreeReverseIterator< Val, Cmp > & operator= (AVLTreeReverseIterator< Val, Cmp > &&from) noexcept
 move operator
bool operator== (const AVLTreeReverseIterator< Val, Cmp > &from) const
 indicates whether two iterator point to the same element
bool operator!= (const AVLTreeReverseIterator< Val, Cmp > &from) const
 indicates whether two iterator point to different element
AVLTreeReverseIterator< Val, Cmp > & operator++ () noexcept
 move to the next element in the tree
AVLTreeReverseIterator< Val, Cmp > & operator+= (const Size k) noexcept
 move to the next k element
AVLTreeReverseIterator< Val, Cmp > & operator-- () noexcept
 move to the preceding element in the tree
AVLTreeReverseIterator< Val, Cmp > & operator-= (const Size k) noexcept
 move to the preceding k element

Protected Types

using AVLNode
 the type of the nodes of the tree

Protected Member Functions

AVLNodenextNode_ (AVLNode *node) const noexcept
 computes the node to go to when applying operator++
AVLNodeprecedingNode_ (AVLNode *node) const noexcept
 computes the node to go to when applying operator--
void unregisterTree_ () noexcept
 make the iterator point to nothing
void pointToEndRend_ () noexcept
 force the iterator to point to end/rend
Operators
bool operator== (const AVLTreeIterator< Val, std::less< Val > > &from) const
 indicates whether two iterator point to the same element
bool operator!= (const AVLTreeIterator< Val, std::less< Val > > &from) const
 indicates whether two iterator point to different element
const_reference operator* () const
 returns the element pointed to by the iterator

Protected Attributes

friend AVLTree< Val, Cmp >
 allow AVL trees to access the content of the iterators
AVLTree< Val, std::less< Val > > * tree_
 the tree the iterator points to
AVLNodenode_
 the AVLNode the iterator points to
AVLNodenext_node_
 the next node to go to when applying operator++
AVLNodepreceding_node_
 the preceding node to go to when applying operator--

Detailed Description

template<typename Val, typename Cmp = std::less< Val >>
class gum::AVLTreeReverseIterator< Val, Cmp >

AVL binary search tree reverse iterator.

Template Parameters
ValThe type of the elements stored into the tree.
CmpThe function used for sorting the elements. queues.

Definition at line 702 of file AVLTree.h.

Member Typedef Documentation

◆ AVLNode

using gum::AVLTreeIterator< Val, std::less< Val > >::AVLNode
protectedinherited

the type of the nodes of the tree

Definition at line 551 of file AVLTree.h.

◆ const_pointer

template<typename Val, typename Cmp = std::less< Val >>
using gum::AVLTreeReverseIterator< Val, Cmp >::const_pointer = const value_type*

Types for STL compliance.

Definition at line 711 of file AVLTree.h.

◆ const_reference

template<typename Val, typename Cmp = std::less< Val >>
using gum::AVLTreeReverseIterator< Val, Cmp >::const_reference = const value_type&

Types for STL compliance.

Definition at line 709 of file AVLTree.h.

◆ iterator_category

template<typename Val, typename Cmp = std::less< Val >>
using gum::AVLTreeReverseIterator< Val, Cmp >::iterator_category = std::bidirectional_iterator_tag

Types for STL compliance.

Definition at line 706 of file AVLTree.h.

◆ pointer

template<typename Val, typename Cmp = std::less< Val >>
using gum::AVLTreeReverseIterator< Val, Cmp >::pointer = value_type*

Types for STL compliance.

Definition at line 710 of file AVLTree.h.

◆ reference

template<typename Val, typename Cmp = std::less< Val >>
using gum::AVLTreeReverseIterator< Val, Cmp >::reference = value_type&

Types for STL compliance.

Definition at line 708 of file AVLTree.h.

◆ value_type

template<typename Val, typename Cmp = std::less< Val >>
using gum::AVLTreeReverseIterator< Val, Cmp >::value_type = Val

Types for STL compliance.

Definition at line 707 of file AVLTree.h.

Constructor & Destructor Documentation

◆ AVLTreeReverseIterator() [1/3]

template<typename Val, typename Cmp = std::less< Val >>
gum::AVLTreeReverseIterator< Val, Cmp >::AVLTreeReverseIterator ( const AVLTree< Val, Cmp > & tree,
const bool rbegin = true )
explicitnoexcept

constructor for rbegin iterators

Parameters
treethe AVL tree which parses the iterator
beginif true, the iterator points to the highest value in the tree, else it points to the lowest value

◆ AVLTreeReverseIterator() [2/3]

template<typename Val, typename Cmp = std::less< Val >>
gum::AVLTreeReverseIterator< Val, Cmp >::AVLTreeReverseIterator ( const AVLTreeReverseIterator< Val, Cmp > & from)
noexcept

copy constructor

◆ AVLTreeReverseIterator() [3/3]

template<typename Val, typename Cmp = std::less< Val >>
gum::AVLTreeReverseIterator< Val, Cmp >::AVLTreeReverseIterator ( AVLTreeReverseIterator< Val, Cmp > && from)
noexcept

move constructor

◆ ~AVLTreeReverseIterator()

template<typename Val, typename Cmp = std::less< Val >>
gum::AVLTreeReverseIterator< Val, Cmp >::~AVLTreeReverseIterator ( )
noexcept

destructor

Member Function Documentation

◆ nextNode_()

AVLNode * gum::AVLTreeIterator< Val, std::less< Val > >::nextNode_ ( AVLNode * node) const
protectednoexceptinherited

computes the node to go to when applying operator++

◆ operator!=() [1/2]

bool gum::AVLTreeIterator< Val, std::less< Val > >::operator!= ( const AVLTreeIterator< Val, std::less< Val > > & from) const
inherited

indicates whether two iterator point to different element

◆ operator!=() [2/2]

template<typename Val, typename Cmp = std::less< Val >>
bool gum::AVLTreeReverseIterator< Val, Cmp >::operator!= ( const AVLTreeReverseIterator< Val, Cmp > & from) const

indicates whether two iterator point to different element

◆ operator*()

const_reference gum::AVLTreeIterator< Val, std::less< Val > >::operator* ( ) const
inherited

returns the element pointed to by the iterator

Returns
the element pointed to by the iterator, if the iterator actually points to an element
Exceptions
NotFoundis raised if the iterator does not point to any element

◆ operator++()

template<typename Val, typename Cmp = std::less< Val >>
AVLTreeReverseIterator< Val, Cmp > & gum::AVLTreeReverseIterator< Val, Cmp >::operator++ ( )
noexcept

move to the next element in the tree

Warning
Applying this operator to an iterator equal to the rend iterator has no effect. In particular, it does not raise any exception.

◆ operator+=()

template<typename Val, typename Cmp = std::less< Val >>
AVLTreeReverseIterator< Val, Cmp > & gum::AVLTreeReverseIterator< Val, Cmp >::operator+= ( const Size k)
noexcept

move to the next k element

Warning
Applying this operator to an iterator equal to the rend iterator has no effect. In particular, it does not raise any exception.

◆ operator--()

template<typename Val, typename Cmp = std::less< Val >>
AVLTreeReverseIterator< Val, Cmp > & gum::AVLTreeReverseIterator< Val, Cmp >::operator-- ( )
noexcept

move to the preceding element in the tree

Warning
Applying this operator to an iterator equal to the rbegin iterator has no effect. In particular, it does not raise any exception.

◆ operator-=()

template<typename Val, typename Cmp = std::less< Val >>
AVLTreeReverseIterator< Val, Cmp > & gum::AVLTreeReverseIterator< Val, Cmp >::operator-= ( const Size k)
noexcept

move to the preceding k element

Warning
Applying this operator to an iterator equal to the rbegin iterator has no effect. In particular, it does not raise any exception.

◆ operator=() [1/2]

template<typename Val, typename Cmp = std::less< Val >>
AVLTreeReverseIterator< Val, Cmp > & gum::AVLTreeReverseIterator< Val, Cmp >::operator= ( AVLTreeReverseIterator< Val, Cmp > && from)
noexcept

move operator

◆ operator=() [2/2]

template<typename Val, typename Cmp = std::less< Val >>
AVLTreeReverseIterator< Val, Cmp > & gum::AVLTreeReverseIterator< Val, Cmp >::operator= ( const AVLTreeReverseIterator< Val, Cmp > & from)
noexcept

copy operator

◆ operator==() [1/2]

bool gum::AVLTreeIterator< Val, std::less< Val > >::operator== ( const AVLTreeIterator< Val, std::less< Val > > & from) const
inherited

indicates whether two iterator point to the same element

◆ operator==() [2/2]

template<typename Val, typename Cmp = std::less< Val >>
bool gum::AVLTreeReverseIterator< Val, Cmp >::operator== ( const AVLTreeReverseIterator< Val, Cmp > & from) const

indicates whether two iterator point to the same element

◆ pointToEndRend_()

void gum::AVLTreeIterator< Val, std::less< Val > >::pointToEndRend_ ( )
protectednoexceptinherited

force the iterator to point to end/rend

◆ precedingNode_()

AVLNode * gum::AVLTreeIterator< Val, std::less< Val > >::precedingNode_ ( AVLNode * node) const
protectednoexceptinherited

computes the node to go to when applying operator--

◆ unregisterTree_()

void gum::AVLTreeIterator< Val, std::less< Val > >::unregisterTree_ ( )
protectednoexceptinherited

make the iterator point to nothing

Member Data Documentation

◆ AVLTree< Val, Cmp >

template<typename Val, typename Cmp = std::less< Val >>
friend gum::AVLTreeReverseIterator< Val, Cmp >::AVLTree< Val, Cmp >
protected

allow AVL trees to access the content of the iterators

Definition at line 799 of file AVLTree.h.

◆ next_node_

AVLNode* gum::AVLTreeIterator< Val, std::less< Val > >::next_node_
protectedinherited

the next node to go to when applying operator++

Definition at line 560 of file AVLTree.h.

560{nullptr};

◆ node_

AVLNode* gum::AVLTreeIterator< Val, std::less< Val > >::node_
protectedinherited

the AVLNode the iterator points to

Definition at line 557 of file AVLTree.h.

557{nullptr};

◆ preceding_node_

AVLNode* gum::AVLTreeIterator< Val, std::less< Val > >::preceding_node_
protectedinherited

the preceding node to go to when applying operator--

Definition at line 563 of file AVLTree.h.

563{nullptr};

◆ tree_

AVLTree< Val, std::less< Val > >* gum::AVLTreeIterator< Val, std::less< Val > >::tree_
protectedinherited

the tree the iterator points to

Definition at line 554 of file AVLTree.h.

554{nullptr};

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