ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator Class Reference

the iterator on the full places, by its group, the slot of the first place of the group and the mask of the full places of the group from its own on, the lowest bit its place: a step clears that bit and keeps the places still full in the control bytes, so that the next place depends on the previous one by two operations on the mask and a place emptied meanwhile is skipped; past the group it skips the empty groups whole, up to a sentinel group after the last, whose byte 0 is full and whose first place is the end, so that a step tests no bound More...

#include <ADS/dictionary/FlatHashTable.h>

Public types

using value_type = std::pair< K , V >
 the type of the items, for the standard library
using reference = PairRef< const K & , const V & >
 a reference to an item
using difference_type = std::ptrdiff_t
 the type of the distances between two iterators
using iterator_concept = std::bidirectional_iterator_tag
 the concept of the iterator, for C++20
using iterator_category = std::input_iterator_tag
 the category of the iterator

Public member functions

 const_iterator (void)=default
 an iterator on no table
reference operator* (void) const
 the pair of the place
const_iterator & operator++ (void)
 to the next full place
const_iterator & operator-- (void)
 to the previous full place
const_iterator operator++ (int)
 to the next full place, returning the iterator before the step
const_iterator operator-- (int)
 to the previous full place, returning the iterator before the step
bool operator== (const const_iterator &o) const
 equal on the same place

Friends

class FlatHashTable

Detailed description

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
class ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator

the iterator on the full places, by its group, the slot of the first place of the group and the mask of the full places of the group from its own on, the lowest bit its place: a step clears that bit and keeps the places still full in the control bytes, so that the next place depends on the previous one by two operations on the mask and a place emptied meanwhile is skipped; past the group it skips the empty groups whole, up to a sentinel group after the last, whose byte 0 is full and whose first place is the end, so that a step tests no bound

Member typedef documentation

◆ difference_type

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
using ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator::difference_type = std::ptrdiff_t

the type of the distances between two iterators

◆ iterator_category

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
using ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator::iterator_category = std::input_iterator_tag

the category of the iterator

◆ iterator_concept

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
using ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator::iterator_concept = std::bidirectional_iterator_tag

the concept of the iterator, for C++20

◆ reference

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
using ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator::reference = PairRef< const K & , const V & >

a reference to an item

◆ value_type

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
using ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator::value_type = std::pair< K , V >

the type of the items, for the standard library

Constructor and destructor documentation

◆ const_iterator()

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator::const_iterator ( void )
default

an iterator on no table

Member function documentation

◆ operator*()

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
reference ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator::operator* ( void ) const
inline

the pair of the place

◆ operator++() [1/2]

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
const_iterator ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator::operator++ ( int )
inline

to the next full place, returning the iterator before the step

◆ operator++() [2/2]

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
const_iterator & ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator::operator++ ( void )
inline

to the next full place

In pseudocode (beyond the book), \( M \) the mask of the full places of the group \( g \) from the current one on, its lowest bit the current place:

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{procedure}\ \mathrm{next}() \cr 2 & \quad M \gets M \land ( M - 1 ) \land \text{the full places of } g\quad \triangleright\ \text{the lowest bit cleared} \cr 3 & \quad \textbf{if}\ M = 0\ \textbf{then}\ \text{go to the first full } \text{place of the groups after } g \text{, maybe the sentinel} \end{array}} \]

◆ operator--() [1/2]

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
const_iterator ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator::operator-- ( int )
inline

to the previous full place, returning the iterator before the step

◆ operator--() [2/2]

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
const_iterator & ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator::operator-- ( void )

to the previous full place

◆ operator==()

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
bool ADS::FlatHashTable< K, V, H, Eq, A >::const_iterator::operator== ( const const_iterator & o) const
inline

equal on the same place

◆ FlatHashTable

template<class K, class V, class H = DefaultHash< K >, class Eq = std::equal_to< K >, class A = std::allocator< std::pair< const K , V > >>
friend class FlatHashTable
friend

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