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

The iterator type over structure of the tree following preorder traversal. More...

#include <forward_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_prefix_iterator (const forward_tree *n)
 Constructor of the iterator based on the iterator to child list. More...
 
const_prefix_iteratoroperator++ ()
 Advance the iterator. More...
 
const_prefix_iterator operator++ (int)
 Advance the iterator. More...
 
const_prefix_iteratoroperator-- ()
 Retract the iterator. More...
 
const_prefix_iterator operator-- (int)
 Retract the iterator. More...
 
bool operator== (const const_prefix_iterator &other) const
 Compare the iterators for equality. More...
 
bool operator!= (const const_prefix_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...
 

Friends

template<class F >
class forward_tree
 

Detailed Description

template<class T>
class ext::forward_tree< T >::const_prefix_iterator

The iterator type over structure of the tree following preorder traversal.

The prefix iterator is constructed as a wrapper over structure iterator, it selects only non-virtual nodes.

Member Typedef Documentation

◆ difference_type

template<class T >
using ext::forward_tree< T >::const_prefix_iterator::difference_type = std::ptrdiff_t

◆ iterator_category

template<class T >
using ext::forward_tree< T >::const_prefix_iterator::iterator_category = std::bidirectional_iterator_tag

◆ pointer

template<class T >
using ext::forward_tree< T >::const_prefix_iterator::pointer = const T*

◆ reference

template<class T >
using ext::forward_tree< T >::const_prefix_iterator::reference = const T&

◆ value_type

template<class T >
using ext::forward_tree< T >::const_prefix_iterator::value_type = T

Constructor & Destructor Documentation

◆ const_prefix_iterator()

template<class T >
ext::forward_tree< T >::const_prefix_iterator::const_prefix_iterator ( const forward_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::forward_tree< T >::const_prefix_iterator::getLevel ( ) const
inline

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

Returns
the depth of node pointed to

◆ operator!=()

template<class T >
bool ext::forward_tree< T >::const_prefix_iterator::operator!= ( const const_prefix_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::forward_tree< T >::const_prefix_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_prefix_iterator & ext::forward_tree< T >::const_prefix_iterator::operator++ ( )
inline

Advance the iterator.

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

◆ operator++() [2/2]

template<class T >
const_prefix_iterator ext::forward_tree< T >::const_prefix_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_prefix_iterator & ext::forward_tree< T >::const_prefix_iterator::operator-- ( )
inline

Retract the iterator.

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

◆ operator--() [2/2]

template<class T >
const_prefix_iterator ext::forward_tree< T >::const_prefix_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::forward_tree< T >::const_prefix_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::forward_tree< T >::const_prefix_iterator::operator== ( const const_prefix_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

◆ forward_tree

template<class T >
template<class F >
friend class forward_tree
friend

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