Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
Public Types | Public Member Functions | Friends
ext::tree< T >::const_structure_iterator Class Reference

The iterator type over structure of the tree representing nodes and node_ends. More...

#include <tree.hpp>

Public Types

using difference_type = std::ptrdiff_t
 
using value_type = T
 
using pointer = const T *
 
using reference = const T &
 
using iterator_category = std::bidirectional_iterator_tag
 

Public Member Functions

 const_structure_iterator (const tree *n)
 Constructor of the iterator based on the iterator to child list. More...
 
const_structure_iteratoroperator++ ()
 Advance the iterator. More...
 
const_structure_iterator operator++ (int)
 Advance the iterator. More...
 
const_structure_iteratoroperator-- ()
 Retract the iterator. More...
 
const_structure_iterator operator-- (int)
 Retract the iterator. More...
 
bool operator== (const const_structure_iterator &other) const
 Compare the iterators for equality. More...
 
bool operator!= (const const_structure_iterator &other) const
 Compare the iterators for nonequality. More...
 
const T & operator* () const
 Dereference the iterator by accessing the pointed node value. More...
 
const T * operator-> () const
 Dereference the iterator by accessing the pointed node value. More...
 
size_t getLevel () const
 Retrieves what is the depth of node the iterator is pointing to. More...
 
bool getVirtual () const
 Allows to distinguish entry or leave visit of a pointed to node. More...
 

Friends

template<class F >
class tree
 

Detailed Description

template<class T>
class ext::tree< T >::const_structure_iterator

The iterator type over structure of the tree representing nodes and node_ends.

The iterator performs a top to bottom, left to right or depth first travrsal stopping at each node twice. Once as it enters it the first time and second time when it leaves it (on the way to its parent).

Member Typedef Documentation

◆ difference_type

template<class T >
using ext::tree< T >::const_structure_iterator::difference_type = std::ptrdiff_t

◆ iterator_category

template<class T >
using ext::tree< T >::const_structure_iterator::iterator_category = std::bidirectional_iterator_tag

◆ pointer

template<class T >
using ext::tree< T >::const_structure_iterator::pointer = const T*

◆ reference

template<class T >
using ext::tree< T >::const_structure_iterator::reference = const T&

◆ value_type

template<class T >
using ext::tree< T >::const_structure_iterator::value_type = T

Constructor & Destructor Documentation

◆ const_structure_iterator()

template<class T >
ext::tree< T >::const_structure_iterator::const_structure_iterator ( const tree n)
inline

Constructor of the iterator based on the iterator to child list.

Parameters
nthe iterator to child list

Member Function Documentation

◆ getLevel()

template<class T >
size_t ext::tree< T >::const_structure_iterator::getLevel ( ) const
inline

Retrieves what is the depth of node the iterator is pointing to.

Returns
the depth of node pointed to

◆ getVirtual()

template<class T >
bool ext::tree< T >::const_structure_iterator::getVirtual ( ) const
inline

Allows to distinguish entry or leave visit of a pointed to node.

Returns
true if the iterator is pointing to a tree node in the first visit, false in the second (leaving case).

◆ operator!=()

template<class T >
bool ext::tree< T >::const_structure_iterator::operator!= ( const const_structure_iterator other) const
inline

Compare the iterators for nonequality.

Parameters
otherthe other instance
Returns
true if the two iterators are not the same, false othervise

◆ operator*()

template<class T >
const T & ext::tree< T >::const_structure_iterator::operator* ( ) const
inline

Dereference the iterator by accessing the pointed node value.

Returns
the value of node pointed to

◆ operator++() [1/2]

template<class T >
const_structure_iterator & ext::tree< T >::const_structure_iterator::operator++ ( )
inline

Advance the iterator.

Returns
the updated iterator
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator++() [2/2]

template<class T >
const_structure_iterator ext::tree< T >::const_structure_iterator::operator++ ( int  )
inline

Advance the iterator.

Returns
the original iterator
Here is the call graph for this function:

◆ operator--() [1/2]

template<class T >
const_structure_iterator & ext::tree< T >::const_structure_iterator::operator-- ( )
inline

Retract the iterator.

Returns
the updated iterator
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator--() [2/2]

template<class T >
const_structure_iterator ext::tree< T >::const_structure_iterator::operator-- ( int  )
inline

Retract the iterator.

Returns
the original iterator
Here is the call graph for this function:

◆ operator->()

template<class T >
const T * ext::tree< T >::const_structure_iterator::operator-> ( ) const
inline

Dereference the iterator by accessing the pointed node value.

Returns
the value of node pointed to

◆ operator==()

template<class T >
bool ext::tree< T >::const_structure_iterator::operator== ( const const_structure_iterator other) const
inline

Compare the iterators for equality.

Parameters
otherthe other instance
Returns
true if the two iterators are the same, false othervise

Friends And Related Function Documentation

◆ tree

template<class T >
template<class F >
friend class tree
friend

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