aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
HashTableConstIterator< Key, Val > Class Template Reference

Unsafe Const Iterators for hashtables. More...

#include <agrum/base/core/hashTable.h>

Inheritance diagram for HashTableConstIterator< Key, Val >:

Public Types

using iterator_category = std::forward_iterator_tag
 Types for STL compliance.
using key_type = Key
 Types for STL compliance.
using mapped_type = Val
 Types for STL compliance.
using value_type = std::pair< const Key, Val >
 Types for STL compliance.
using reference = value_type&
 Types for STL compliance.
using const_reference = const value_type&
 Types for STL compliance.
using pointer = value_type*
 Types for STL compliance.
using const_pointer = const value_type*
 Types for STL compliance.
using difference_type = std::ptrdiff_t
 Types for STL compliance.

Public Member Functions

Constructors / Destructors
 HashTableConstIterator () noexcept
 Basic constructor: creates an iterator pointing to nothing.
 HashTableConstIterator (const HashTable< Key, Val > &tab) noexcept
 Constructor for an iterator pointing to the first element of a hashtable.
 HashTableConstIterator (const HashTable< Key, Val > &tab, Size ind_elt)
 Constructor for an iterator pointing to the nth element of a hashtable.
 HashTableConstIterator (const HashTableConstIterator< Key, Val > &from) noexcept
 Copy constructor.
 HashTableConstIterator (HashTableConstIterator< Key, Val > &&from) noexcept
 Move constructor.
 ~HashTableConstIterator () noexcept
 Class destructor.
Accessors / Modifiers
const key_typekey () const
 Returns the key corresponding to the element pointed to by the iterator.
const mapped_typeval () const
 Returns the mapped value pointed to by the iterator.
void clear () noexcept
 Makes the iterator point toward nothing (in particular, it is not related anymore to its current hash table).
Operators
HashTableConstIterator< Key, Val > & operator= (const HashTableConstIterator< Key, Val > &from) noexcept
 Copy operator.
HashTableConstIterator< Key, Val > & operator= (HashTableConstIterator< Key, Val > &&from) noexcept
 Move operator.
HashTableConstIterator< Key, Val > & operator++ () noexcept
 Makes the iterator point to the next element in the hash table.
HashTableConstIterator< Key, Val > & operator+= (Size i) noexcept
 Makes the iterator point to i elements further in the hashtable.
HashTableConstIterator< Key, Val > operator+ (Size i) const noexcept
 Returns a new iterator pointing to i elements further in the hashtable.
bool operator!= (const HashTableConstIterator< Key, Val > &from) const noexcept
 Checks whether two iterators are pointing toward different elements.
bool operator== (const HashTableConstIterator< Key, Val > &from) const noexcept
 Checks whether two iterators are pointing toward equal elements.
const value_typeoperator* () const
 Returns the value pointed to by the iterator.

Protected Member Functions

HashTable< Key, Val >::Bucket * _getBucket_ () const noexcept
 Returns the current iterator's bucket.
Size _getIndex_ () const noexcept
 Returns the index in the hashtable's node vector pointed to by the iterator.

Protected Attributes

const HashTable< Key, Val > * _table_ {nullptr}
 The hash table the iterator is pointing to.
Size _index_ {Size(0)}
 The index of the chained list pointed by the iterator in the array of nodes of the hash table.
HashTable< Key, Val >::Bucket * _bucket_ {nullptr}
 The bucket in the chained list pointed to by the iterator.

Friends

class HashTable< Key, Val >
 Class HashTable must be a friend because it stores iterator end and this one can be properly initialized only when the hashtable has been fully allocated.
class HashTableConstIteratorSafe< Key, Val >
 For the safe copy constructor and operator.

Detailed Description

template<typename Key, typename Val>
class HashTableConstIterator< Key, Val >

Unsafe Const Iterators for hashtables.

HashTableConstIterator provides a fast but unsafe way to parse HashTables. They should only be used when parsing hashtables in which no element is removed from the hashtable. Removing an element where the iterator points to will mess the iterator as it will most certainly point to an unallocated memory. So, this kind of iterator should only be used when parsing "(key) constant" hash tables, e.g., when we wish to display the content of a hash table or when we wish to update the mapped values of some elements of the hash table without ever modifying their keys.

Developers may consider using HashTable<x,y>::const_iterator instead of HashTableConstIterator<x,y>.

Usage example:
// creation of a hash table with 10 elements
HashTable<int,string> table;
for (int i = 0; i< 10; ++i)
table.insert (i,"xxx" + string (i,'x'));
// parse the hash table
for (HashTable<int,string>::const_iterator iter = table.cbegin ();
iter != table.cend (); ++iter) {
// display the values
cerr << "at " << iter.key() << " value = " << iter.val () << endl;
const HashTable<int,string>::value_type& elt = *iter;
const std::pair<const int, string>& xelt = *iter;
}
// check whether two iterators point toward the same element
HashTable<int,string>::const_iterator iter1 = table1.cbegin();
HashTable<int,string>::const_iterator iter2 = table1.cend();
if (iter1 != iter) {
cerr << "iter1 and iter2 point toward different elements";
}
// make iter1 point toward nothing
iter1.clear ();
Template Parameters
KeyThe gum::HashTable key.
ValThe gum::HashTable Value.

Definition at line 2146 of file hashTable.h.

Member Typedef Documentation

◆ const_pointer

template<typename Key, typename Val>
using HashTableConstIterator< Key, Val >::const_pointer = const value_type*

Types for STL compliance.

Definition at line 2157 of file hashTable.h.

◆ const_reference

template<typename Key, typename Val>
using HashTableConstIterator< Key, Val >::const_reference = const value_type&

Types for STL compliance.

Definition at line 2155 of file hashTable.h.

◆ difference_type

template<typename Key, typename Val>
using HashTableConstIterator< Key, Val >::difference_type = std::ptrdiff_t

Types for STL compliance.

Definition at line 2158 of file hashTable.h.

◆ iterator_category

template<typename Key, typename Val>
using HashTableConstIterator< Key, Val >::iterator_category = std::forward_iterator_tag

Types for STL compliance.

Definition at line 2150 of file hashTable.h.

◆ key_type

template<typename Key, typename Val>
using HashTableConstIterator< Key, Val >::key_type = Key

Types for STL compliance.

Definition at line 2151 of file hashTable.h.

◆ mapped_type

template<typename Key, typename Val>
using HashTableConstIterator< Key, Val >::mapped_type = Val

Types for STL compliance.

Definition at line 2152 of file hashTable.h.

◆ pointer

template<typename Key, typename Val>
using HashTableConstIterator< Key, Val >::pointer = value_type*

Types for STL compliance.

Definition at line 2156 of file hashTable.h.

◆ reference

template<typename Key, typename Val>
using HashTableConstIterator< Key, Val >::reference = value_type&

Types for STL compliance.

Definition at line 2154 of file hashTable.h.

◆ value_type

template<typename Key, typename Val>
using HashTableConstIterator< Key, Val >::value_type = std::pair< const Key, Val >

Types for STL compliance.

Definition at line 2153 of file hashTable.h.

Constructor & Destructor Documentation

◆ HashTableConstIterator() [1/5]

template<typename Key, typename Val>
INLINE HashTableConstIterator< Key, Val >::HashTableConstIterator ( )
explicitnoexcept

Basic constructor: creates an iterator pointing to nothing.

Definition at line 1571 of file hashTable_tpl.h.

1571 {
1573 }
Unsafe Const Iterators for hashtables.
Definition hashTable.h:2146
HashTableConstIterator() noexcept
Basic constructor: creates an iterator pointing to nothing.

References HashTableConstIterator().

Referenced by HashTableConstIterator(), HashTableConstIterator(), HashTableConstIterator(), HashTableIterator< Key, Val >::HashTableIterator(), HashTableIterator< Key, Val >::HashTableIterator(), HashTableIterator< Key, Val >::HashTableIterator(), HashTableIterator< Key, Val >::HashTableIterator(), HashTableIterator< Key, Val >::HashTableIterator(), operator!=(), operator+(), operator++(), operator=(), operator=(), and operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HashTableConstIterator() [2/5]

template<typename Key, typename Val>
INLINE HashTableConstIterator< Key, Val >::HashTableConstIterator ( const HashTable< Key, Val > & tab)
noexcept

Constructor for an iterator pointing to the first element of a hashtable.

Parameters
tabThe gum::HashTable to iterate over.

Definition at line 1576 of file hashTable_tpl.h.

1577 :
1578 _table_{reinterpret_cast< const HashTable< Key, Val >* >(&tab)} {
1579 // for debugging purposes
1581
1582 if (_table_->_nb_elements_) {
1583 if (_table_->_begin_index_ != std::numeric_limits< Size >::max()) {
1584 _index_ = _table_->_begin_index_;
1585 _bucket_ = _table_->_nodes_[_index_]._end_list_;
1586 } else {
1587 // find the element we shall point to from the start of the hashtable
1588 for (Size i = _table_->_size_ - Size(1);; --i) { // no test on i since
1589 // _nb_elements_ != 0
1590 if (_table_->_nodes_[i]._nb_elements_) {
1591 _index_ = i;
1592 _bucket_ = _table_->_nodes_[_index_]._end_list_;
1593 _table_->_begin_index_ = _index_;
1594 break;
1595 }
1596 }
1597 }
1598 }
1599 }
const HashTable< Key, Val > * _table_
The hash table the iterator is pointing to.
Definition hashTable.h:2350
HashTable< Key, Val >::Bucket * _bucket_
The bucket in the chained list pointed to by the iterator.
Definition hashTable.h:2359
Size _index_
The index of the chained list pointed by the iterator in the array of nodes of the hash table.
Definition hashTable.h:2356
friend class HashTable< Key, Val >
Class HashTable must be a friend because it stores iterator end and this one can be properly initiali...
Definition hashTable.h:2344

References _table_, and HashTable< Key, Val >.

Here is the call graph for this function:

◆ HashTableConstIterator() [3/5]

template<typename Key, typename Val>
HashTableConstIterator< Key, Val >::HashTableConstIterator ( const HashTable< Key, Val > & tab,
Size ind_elt )

Constructor for an iterator pointing to the nth element of a hashtable.

The method runs in time linear to ind_elt.

Parameters
tabThe hash table to which the so-called element belongs.
ind_eltThe position of the element in the hash table (0 means the first element).
Exceptions
UndefinedIteratorValueRaised if the element cannot be found.

Definition at line 1602 of file hashTable_tpl.h.

1603 :
1604 _table_{reinterpret_cast< const HashTable< Key, Val >* >(&tab)} {
1605 Size i;
1606
1607 // check if we are looking for a begin() and we know for sure its index
1608 if ((ind_elt == Size(0)) && (_table_->_begin_index_ != std::numeric_limits< Size >::max())) {
1609 _index_ = _table_->_begin_index_;
1610 _bucket_ = _table_->_nodes_[_index_]._end_list_;
1611 } else {
1612 // check if it is faster to find the ind_eltth element from the start or
1613 // from the end of the hashtable
1614 if (ind_elt < (_table_->_nb_elements_ >> 1)) {
1615 // find the element we shall point to from the start of the hashtable
1616 for (i = _table_->_size_ - 1;; --i) { // no test on i since
1617 // ind_elt < table_-> _nb_elements_
1618 if (_table_->_nodes_[i]._nb_elements_) {
1619 if (ind_elt >= _table_->_nodes_[i]._nb_elements_)
1620 ind_elt -= _table_->_nodes_[i]._nb_elements_;
1621 else {
1622 for (_bucket_ = _table_->_nodes_[i]._end_list_; ind_elt;
1623 --ind_elt, _bucket_ = _bucket_->prev) {}
1624
1625 _index_ = i;
1626 break;
1627 }
1628 }
1629 }
1630 } else {
1631 // ind_elt = the index of the element we should point to
1632 // check if the index passed as parameter is valid
1633 if (ind_elt >= _table_->_nb_elements_) {
1634 GUM_ERROR(UndefinedIteratorValue, "Not enough elements in the hashtable")
1635 }
1636
1637 // find the element we shall point to from the end of the hashtable
1638 for (i = 0, ind_elt = _table_->_nb_elements_ - ind_elt - 1;; ++i) {
1639 if (_table_->_nodes_[i]._nb_elements_) {
1640 if (ind_elt >= _table_->_nodes_[i]._nb_elements_)
1641 ind_elt -= _table_->_nodes_[i]._nb_elements_;
1642 else {
1643 for (_bucket_ = _table_->_nodes_[i]._deb_list_; ind_elt;
1644 --ind_elt, _bucket_ = _bucket_->next) {}
1645
1646 _index_ = i;
1647 break;
1648 }
1649 }
1650 }
1651 }
1652 }
1653
1654 // for debugging purposes
1656 }
#define GUM_ERROR(type, msg)
Definition exceptions.h:72

References _table_, and HashTable< Key, Val >.

Here is the call graph for this function:

◆ HashTableConstIterator() [4/5]

template<typename Key, typename Val>
INLINE HashTableConstIterator< Key, Val >::HashTableConstIterator ( const HashTableConstIterator< Key, Val > & from)
noexcept

Copy constructor.

Parameters
fromThe gum::HashTableConstIterator to copy.

Definition at line 1659 of file hashTable_tpl.h.

References HashTableConstIterator(), and _table_.

Here is the call graph for this function:

◆ HashTableConstIterator() [5/5]

template<typename Key, typename Val>
INLINE HashTableConstIterator< Key, Val >::HashTableConstIterator ( HashTableConstIterator< Key, Val > && from)
noexcept

Move constructor.

Parameters
fromThe gum::HashTableConstIterator to move.

Definition at line 1666 of file hashTable_tpl.h.

References HashTableConstIterator(), and _table_.

Here is the call graph for this function:

◆ ~HashTableConstIterator()

template<typename Key, typename Val>
INLINE HashTableConstIterator< Key, Val >::~HashTableConstIterator ( )
noexcept

Class destructor.

Definition at line 1673 of file hashTable_tpl.h.

1673 {
1674 // for debugging purposes
1676 }

Member Function Documentation

◆ _getBucket_()

template<typename Key, typename Val>
INLINE HashTable< Key, Val >::Bucket * HashTableConstIterator< Key, Val >::_getBucket_ ( ) const
protectednoexcept

Returns the current iterator's bucket.

Returns
Returns the current iterator's bucket.

Definition at line 1829 of file hashTable_tpl.h.

1829 {
1830 return _bucket_;
1831 }

References _bucket_.

◆ _getIndex_()

template<typename Key, typename Val>
INLINE Size HashTableConstIterator< Key, Val >::_getIndex_ ( ) const
protectednoexcept

Returns the index in the hashtable's node vector pointed to by the iterator.

Returns
Returns the index in the hashtable's node vector pointed to by the iterator.

Definition at line 1834 of file hashTable_tpl.h.

1834 {
1835 return _index_;
1836 }

References _index_.

◆ clear()

template<typename Key, typename Val>
INLINE void HashTableConstIterator< Key, Val >::clear ( )
noexcept

Makes the iterator point toward nothing (in particular, it is not related anymore to its current hash table).

Definition at line 1719 of file hashTable_tpl.h.

1719 {
1720 _table_ = nullptr;
1721 _bucket_ = nullptr;
1722 _index_ = 0;
1723 }

References _table_.

◆ key()

template<typename Key, typename Val>
INLINE const HashTableConstIterator< Key, Val >::key_type & HashTableConstIterator< Key, Val >::key ( ) const

Returns the key corresponding to the element pointed to by the iterator.

Warning
Using this method on an iterator that points to an element that has been deleted will most certainly result in a segfault. If unsure, use a safe iterator instead of an unsafe one.
Returns
Returns the key corresponding to the element pointed to by the iterator.

Definition at line 1706 of file hashTable_tpl.h.

1706 {
1707 if (_bucket_) return _bucket_->pair.first;
1708 else { GUM_ERROR(UndefinedIteratorValue, "Accessing a nullptr object") }
1709 }

◆ operator!=()

template<typename Key, typename Val>
INLINE bool HashTableConstIterator< Key, Val >::operator!= ( const HashTableConstIterator< Key, Val > & from) const
noexcept

Checks whether two iterators are pointing toward different elements.

Parameters
fromThe gum::HashTableConstIterator to test for inequality.
Returns
Returns true if this and from are not equal.

Definition at line 1809 of file hashTable_tpl.h.

1810 {
1811 return (_bucket_ != from._bucket_);
1812 }

References HashTableConstIterator(), and _bucket_.

Referenced by HashTableIterator< Key, Val >::operator!=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator*()

template<typename Key, typename Val>
INLINE const HashTableConstIterator< Key, Val >::value_type & HashTableConstIterator< Key, Val >::operator* ( ) const

Returns the value pointed to by the iterator.

Warning
using this method on an iterator that points to an element that has been deleted will most certainly result in a segfault. If unsure, use a safe iterator instead of an unsafe one.
Returns
Returns the value pointed to by the iterator.

Definition at line 1822 of file hashTable_tpl.h.

1822 {
1823 if (_bucket_) return _bucket_->elt();
1824 else { GUM_ERROR(UndefinedIteratorValue, "Accessing a nullptr object") }
1825 }

References _bucket_, and GUM_ERROR.

Referenced by HashTableIterator< Key, Val >::operator*(), and HashTableIterator< Key, Val >::operator*().

Here is the caller graph for this function:

◆ operator+()

template<typename Key, typename Val>
INLINE HashTableConstIterator< Key, Val > HashTableConstIterator< Key, Val >::operator+ ( Size i) const
noexcept

Returns a new iterator pointing to i elements further in the hashtable.

Parameters
iThe number of increments.
Returns
Returns a new iterator pointing to i elements further in the hashtable.

Definition at line 1804 of file hashTable_tpl.h.

1804 {
1805 return HashTableConstIterator< Key, Val >{*this} += nb;
1806 }

References HashTableConstIterator().

Here is the call graph for this function:

◆ operator++()

template<typename Key, typename Val>
HashTableConstIterator< Key, Val > & HashTableConstIterator< Key, Val >::operator++ ( )
noexcept

Makes the iterator point to the next element in the hash table.

for (iter = cbegin (); iter != cend(); ++iter ) { }

The above loop is guaranteed to parse the whole hash table as long as no element is added to or deleted from the hash table while being in the loop.

Warning
performing a ++ on an iterator that points to an element that has been deleted will most certainly result in a segfault.
Returns
Returns this gum::HashTableConstIterator.

Definition at line 1726 of file hashTable_tpl.h.

1726 {
1727 // if _bucket_ == nullptr then we are at the end of the hashtable
1728 if (_bucket_ == nullptr) return *this;
1729
1730 // if we are not pointing on the first element of the chained list, just
1731 // point to the next bucket in this list
1732 if (_bucket_->prev) {
1733 _bucket_ = _bucket_->prev;
1734 // here, no need to update _index_ which has not changed.
1735 } else {
1736 // ok, here we are on the end of a chained list,
1737 // so 2 cases can obtain:
1738 // 1/ index = 0 : then we have reached the end of the hashtable
1739 // 2/ index != 0 => we must search for a new slot containing elements
1740
1741 // case 1:
1742 if (_index_ == Size(0)) {
1743 _bucket_ = nullptr;
1744 // we are thus at the end() of the hashTable
1745 }
1746
1747 // case 2:
1748 else {
1749 // arrived here, we need to parse the hash table until we find a new
1750 // bucket because we are pointing on a chained list with no more element
1751 // to the right of the current element
1752 for (Size i = _index_ - Size(1); i; --i) {
1753 if (_table_->_nodes_[i]._nb_elements_) {
1754 _index_ = i;
1755 _bucket_ = _table_->_nodes_[i]._end_list_;
1756 return *this;
1757 }
1758 }
1759
1760 if (_table_->_nodes_[0]._nb_elements_) _bucket_ = _table_->_nodes_[0]._end_list_;
1761 else _bucket_ = nullptr;
1762
1763 _index_ = Size(0);
1764 }
1765 }
1766
1767 return *this;
1768 }

References HashTableConstIterator(), _bucket_, _index_, and _table_.

Referenced by HashTableIterator< Key, Val >::operator++().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator+=()

template<typename Key, typename Val>
HashTableConstIterator< Key, Val > & HashTableConstIterator< Key, Val >::operator+= ( Size i)
noexcept

Makes the iterator point to i elements further in the hashtable.

Parameters
iThe number of increments.
Returns
Returns this gum::HashTableConstIterator.

Definition at line 1772 of file hashTable_tpl.h.

1772 {
1773 if ((nb == 0) || (_table_ == nullptr) || (_bucket_ == nullptr)) return *this;
1774
1775 // ok, here we can use _bucket_ as a starting point: parse all the elements
1776 // of the current chained list
1777 for (; nb && _bucket_ != nullptr; --nb, _bucket_ = _bucket_->prev) {}
1778
1779 if (_bucket_ != nullptr) return *this;
1780
1781 // here, we shall skip all the chained list that have not sufficiently
1782 // many elements
1783 --_index_;
1784
1785 for (; _index_ < _table_->_size_ && nb >= _table_->_nodes_[_index_]._nb_elements_;
1786 nb -= _table_->_nodes_[_index_]._nb_elements_, --_index_) {}
1787
1788 // here: either _index_ >= _table_-> _size_, which means that we did not find
1789 // the element we looked for, i.e., we are at the end of the hashtable, or
1790 // nb < _table_-> _nodes_[ _index_]. _nb_elements_, and we should parse the
1791 // chained list to get the element (which, we know for sure, exists)
1792 if (_index_ >= _table_->_size_) {
1793 _index_ = 0;
1794 return *this;
1795 }
1796
1797 for (_bucket_ = _table_->_nodes_[_index_]._end_list_; nb; --nb, _bucket_ = _bucket_->prev) {}
1798
1799 return *this;
1800 }

References _bucket_, and _table_.

Referenced by HashTableIterator< Key, Val >::operator+=().

Here is the caller graph for this function:

◆ operator=() [1/2]

template<typename Key, typename Val>
INLINE HashTableConstIterator< Key, Val > & HashTableConstIterator< Key, Val >::operator= ( const HashTableConstIterator< Key, Val > & from)
noexcept

Copy operator.

Parameters
fromThe gum::HashTableConstIterator to copy.
Returns
Returns this gum::HashTableConstIterator.

Definition at line 1679 of file hashTable_tpl.h.

1680 {
1681 // here, no need to avoid self assignment: this would slow down normal
1682 // assignments and, in any case, this would not result in an iterator in
1683 // an incoherent state
1687
1688 return *this;
1689 }

References HashTableConstIterator(), _bucket_, _index_, and _table_.

Referenced by HashTableIterator< Key, Val >::operator=(), and HashTableIterator< Key, Val >::operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [2/2]

template<typename Key, typename Val>
INLINE HashTableConstIterator< Key, Val > & HashTableConstIterator< Key, Val >::operator= ( HashTableConstIterator< Key, Val > && from)
noexcept

Move operator.

Parameters
fromThe gum::HashTableConstIterator to move.
Returns
Returns this gum::HashTableConstIterator.

Definition at line 1692 of file hashTable_tpl.h.

1693 {
1694 // here, no need to avoid self assignment: this would slow down normal
1695 // assignments and, in any case, this would not result in an iterator in
1696 // an incoherent state
1700
1701 return *this;
1702 }

References HashTableConstIterator(), and _table_.

Here is the call graph for this function:

◆ operator==()

template<typename Key, typename Val>
INLINE bool HashTableConstIterator< Key, Val >::operator== ( const HashTableConstIterator< Key, Val > & from) const
noexcept

Checks whether two iterators are pointing toward equal elements.

Parameters
fromThe gum::HashTableConstIterator to test for equality.
Returns
Returns true if this and from are equal.

Definition at line 1815 of file hashTable_tpl.h.

1816 {
1817 return (_bucket_ == from._bucket_);
1818 }

References HashTableConstIterator(), and _bucket_.

Referenced by HashTableIterator< Key, Val >::operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ val()

template<typename Key, typename Val>
INLINE const HashTableConstIterator< Key, Val >::mapped_type & HashTableConstIterator< Key, Val >::val ( ) const

Returns the mapped value pointed to by the iterator.

Warning
Using this method on an iterator that points to an element that has been deleted will most certainly result in a segfault. If unsure, use a safe iterator instead of an unsafe one.
Returns
Returns the mapped value pointed to by the iterator.

Definition at line 1713 of file hashTable_tpl.h.

1713 {
1714 if (_bucket_) return _bucket_->val();
1715 else { GUM_ERROR(UndefinedIteratorValue, "Accessing a nullptr object") }
1716 }

References _bucket_, and GUM_ERROR.

◆ HashTable< Key, Val >

template<typename Key, typename Val>
friend class HashTable< Key, Val >
friend

Class HashTable must be a friend because it stores iterator end and this one can be properly initialized only when the hashtable has been fully allocated.

Thus, proper initialization can only take place within the constructor's code of the hashtable.

Definition at line 2333 of file hashTable.h.

Referenced by HashTableConstIterator(), HashTableConstIterator(), HashTableIterator< Key, Val >::HashTableIterator(), and HashTableIterator< Key, Val >::HashTableIterator().

◆ HashTableConstIteratorSafe< Key, Val >

template<typename Key, typename Val>
friend class HashTableConstIteratorSafe< Key, Val >
friend

For the safe copy constructor and operator.

Definition at line 2333 of file hashTable.h.

Member Data Documentation

◆ _bucket_

template<typename Key, typename Val>
HashTable<Key,Val>::Bucket* HashTableConstIterator< Key, Val >::_bucket_ {nullptr}
protected

◆ _index_

template<typename Key, typename Val>
Size HashTableConstIterator< Key, Val >::_index_ {Size(0)}
protected

The index of the chained list pointed by the iterator in the array of nodes of the hash table.

Definition at line 2356 of file hashTable.h.

2356{Size(0)};

Referenced by _getIndex_(), gum::HashTableConstIteratorSafe< Key, Val >::operator!=(), operator++(), gum::HashTableConstIteratorSafe< Key, Val >::operator=(), operator=(), and gum::HashTableConstIteratorSafe< Key, Val >::operator==().

◆ _table_

template<typename Key, typename Val>
const HashTable< Key, Val >* HashTableConstIterator< Key, Val >::_table_ {nullptr}
protected

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