ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::BTree< K, V, Policy >::const_iterator Class Reference

the iterator on the pairs by increasing keys, with the path from the root More...

#include <ADS/tree/BTree.h>

Public types

using reference
 a pair of constant references, the key and its value (that of the vector of the values, a proxy if V is bool), whose value is ( K , V )
using value_type = std::pair< K , V >
 the pairs, by value
using difference_type = std::ptrdiff_t
 the type of the distances
using iterator_concept = std::forward_iterator_tag
 the category of the iterator for the concepts of C++20, forward
using iterator_category = std::input_iterator_tag
 input for the older algorithms, since *it is a value

Public member functions

 const_iterator (void)=default
 the end
 const_iterator (const Node *x)
 on the first key below \( x \), or at the end if \( x \) is nil or empty
reference operator* (void) const
 the pair of the key at the end of the path
const_iterator & operator++ (void)
 to the next key, \( O( 1 ) \) amortized and \( O( \log_t n ) \) at most
const_iterator operator++ (int)
 to the next key, returning the iterator before the step
bool operator== (const const_iterator &o) const
 equal on the same place of the same node, or both at the end

Detailed description

template<std::totally_ordered K, class V, class Policy = NoObservers>
class ADS::BTree< K, V, Policy >::const_iterator

the iterator on the pairs by increasing keys, with the path from the root

Member typedef documentation

◆ difference_type

template<std::totally_ordered K, class V, class Policy = NoObservers>
using ADS::BTree< K, V, Policy >::const_iterator::difference_type = std::ptrdiff_t

the type of the distances

◆ iterator_category

template<std::totally_ordered K, class V, class Policy = NoObservers>
using ADS::BTree< K, V, Policy >::const_iterator::iterator_category = std::input_iterator_tag

input for the older algorithms, since *it is a value

◆ iterator_concept

template<std::totally_ordered K, class V, class Policy = NoObservers>
using ADS::BTree< K, V, Policy >::const_iterator::iterator_concept = std::forward_iterator_tag

the category of the iterator for the concepts of C++20, forward

◆ reference

template<std::totally_ordered K, class V, class Policy = NoObservers>
using ADS::BTree< K, V, Policy >::const_iterator::reference
Initial value:
std::conditional_t< detail::plainPair< A, B, VA, VB >, std::pair< A, B >, detail::PairProxy< A, B, VA, VB > > PairRef
the pair that an iterator reads by value, in general two references into the container,...
Definition Iterators.h:648

a pair of constant references, the key and its value (that of the vector of the values, a proxy if V is bool), whose value is ( K , V )

◆ value_type

template<std::totally_ordered K, class V, class Policy = NoObservers>
using ADS::BTree< K, V, Policy >::const_iterator::value_type = std::pair< K , V >

the pairs, by value

Constructor and destructor documentation

◆ const_iterator() [1/2]

template<std::totally_ordered K, class V, class Policy = NoObservers>
ADS::BTree< K, V, Policy >::const_iterator::const_iterator ( void )
default

the end

◆ const_iterator() [2/2]

template<std::totally_ordered K, class V, class Policy = NoObservers>
ADS::BTree< K, V, Policy >::const_iterator::const_iterator ( const Node * x)
inlineexplicit

on the first key below \( x \), or at the end if \( x \) is nil or empty

Member function documentation

◆ operator*()

template<std::totally_ordered K, class V, class Policy = NoObservers>
reference ADS::BTree< K, V, Policy >::const_iterator::operator* ( void ) const
inline

the pair of the key at the end of the path

◆ operator++() [1/2]

template<std::totally_ordered K, class V, class Policy = NoObservers>
const_iterator ADS::BTree< K, V, Policy >::const_iterator::operator++ ( int )
inline

to the next key, returning the iterator before the step

◆ operator++() [2/2]

template<std::totally_ordered K, class V, class Policy = NoObservers>
const_iterator & ADS::BTree< K, V, Policy >::const_iterator::operator++ ( void )
inline

to the next key, \( O( 1 ) \) amortized and \( O( \log_t n ) \) at most

In pseudocode (the step of PathIterator of Iterators.h on the nodes of many keys, beyond the book), \( ( x , i ) \) the last place of the path \( \pi \):

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{procedure}\ \mathrm{next}() \cr 2 & \quad \textbf{if}\ x \text{ is not a leaf}\ \textbf{then}\ i \gets i + 1;\ \text{append the leftmost path from } x.c[ i ] \text{ to } \pi;\ \textbf{return} \cr 3 & \quad i \gets i + 1;\ \textbf{if}\ i < j\ \textbf{then return} \cr 4 & \quad \text{remove the places of } \pi \text{ from the end while } \text{their node has no key left at their index} \end{array}} \]

◆ operator==()

template<std::totally_ordered K, class V, class Policy = NoObservers>
bool ADS::BTree< K, V, Policy >::const_iterator::operator== ( const const_iterator & o) const
inline

equal on the same place of the same node, or both at the end


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