ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator Class Reference

the iterator on the pairs by increasing keys: a leaf, a place in it and the parent of the leaf More...

#include <ADS/tree/BTreeMap.h>

Public types

using value_type = std::pair< K , V >
 the pairs ( key , value ) by value, which own their copies
using reference = PairRef< const K & , const V & >
 a pair of references, by value
using difference_type = std::ptrdiff_t
 the type of the distances
using iterator_concept = std::bidirectional_iterator_tag
 the category of the iterator for the concepts of C++20, bidirectional
using iterator_category = std::input_iterator_tag
 input for the older algorithms, since *it is a value

Public member functions

 const_iterator (void)=default
 an iterator on no tree
reference operator* (void) const
 the pair of the place
const_iterator & operator++ (void)
 to the next pair, to the next leaf through the parent at the end of a leaf
const_iterator & operator-- (void)
 to the previous pair, from the end to the last pair, through the parent at the start of a leaf
const_iterator operator++ (int)
 to the next pair, returning the iterator before the step
const_iterator operator-- (int)
 to the previous pair, returning the iterator before the step
bool operator== (const const_iterator &o) const
 equal on the same place of the same leaf

Friends

class BTreeMap

Detailed description

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
class ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator

the iterator on the pairs by increasing keys: a leaf, a place in it and the parent of the leaf

Member typedef documentation

◆ difference_type

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
using ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator::difference_type = std::ptrdiff_t

the type of the distances

◆ iterator_category

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
using ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator::iterator_category = std::input_iterator_tag

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

◆ iterator_concept

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
using ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator::iterator_concept = std::bidirectional_iterator_tag

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

◆ reference

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
using ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator::reference = PairRef< const K & , const V & >

a pair of references, by value

◆ value_type

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
using ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator::value_type = std::pair< K , V >

the pairs ( key , value ) by value, which own their copies

Constructor and destructor documentation

◆ const_iterator()

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator::const_iterator ( void )
default

an iterator on no tree

Member function documentation

◆ operator*()

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
reference ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator::operator* ( void ) const
inline

the pair of the place

◆ operator++() [1/2]

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
const_iterator ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator::operator++ ( int )
inline

to the next pair, returning the iterator before the step

◆ operator++() [2/2]

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
const_iterator & ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator::operator++ ( void )
inline

to the next pair, to the next leaf through the parent at the end of a leaf

In pseudocode (beyond the book), \( ( l , i ) \) the leaf and the place, \( ( p , c ) \) the parent and the child that is \( l \):

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{procedure}\ \mathrm{next}() \cr 2 & \quad i \gets i + 1;\ \textbf{if}\ i < l.n\ \textbf{then return} \cr 3 & \quad i \gets 0 \cr 4 & \quad \textbf{if}\ p = \textbf{nil}\ \textbf{then}\ l \gets l.\mathit{next};\ \textbf{return} \cr 5 & \quad \textbf{if}\ c = p.n\ \textbf{then}\ p \gets p.\mathit{next};\ c \gets 0\ \textbf{else}\ c \gets c + 1 \cr 6 & \quad \textbf{if}\ p = \textbf{nil}\ \textbf{then}\ l \gets \textbf{nil}\ \textbf{else}\ l \gets p.c[ c ];\ \text{prefetch } \text{the leaf 4 children ahead} \end{array}} \]

◆ operator--() [1/2]

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
const_iterator ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator::operator-- ( int )
inline

to the previous pair, returning the iterator before the step

◆ operator--() [2/2]

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
const_iterator & ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator::operator-- ( void )
inline

to the previous pair, from the end to the last pair, through the parent at the start of a leaf

◆ operator==()

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
bool ADS::BTreeMap< K, V, Less, B, R, A >::const_iterator::operator== ( const const_iterator & o) const
inline

equal on the same place of the same leaf

◆ BTreeMap

template<class K, class V, class Less = std::less< K >, std::size_t B = 512, bool R = false, class A = HugePageAllocator< std::pair< const K , V > >>
friend class BTreeMap
friend

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