30template<
class T,
class Key,
class Hash>
44 const label index = container_->hashKeyIndex(key);
46 for (node_type* ep = container_->table_[index]; ep; ep = ep->next_)
64template<
class T,
class Key,
class Hash>
65bool Foam::HashTable<T, Key, Hash>::iterator_erase(
iterator& iter)
68 const label index = iter.index_;
75 if (!size_ || !
entry || index < 0)
86 for (
node_type* ep = table_[index]; ep; ep = ep->next_)
98 prev->next_ = entry->next_;
106 table_[index] = entry->next_;
110 iter.entry_ =
reinterpret_cast<node_type*
>(
this);
118 iter.index_ = (-index - 1);
127template<
class T,
class Key,
class Hash>
129Foam::HashTable<T, Key, Hash>::iterator_extract(
iterator& iter)
132 const label index = iter.index_;
139 if (!size_ || !entry || index < 0)
150 for (
node_type* ep = table_[index]; ep; ep = ep->next_)
162 prev->next_ = entry->next_;
165 entry->next_ =
nullptr;
170 table_[index] = entry->next_;
171 iter.entry_ = table_[index];
172 entry->next_ =
nullptr;
180 iter.index_ = (-index - 1);
node_type * entry_
The selected entry.
constexpr Iterator() noexcept
Default construct. Also the same as the end iterator.
std::conditional_t< Const, const this_type, this_type > table_type
The HashTable container type.
label index_
Index within the hash-table data.
const Key & key() const
The key associated with the iterator.
table_type * container_
The hash-table container being iterated on.
Forward iterator with non-const access.
std::conditional_t< std::is_same_v< Foam::zero, std::remove_cv_t< T > >, Detail::HashTableSingle< Key >, Detail::HashTablePair< Key, T > > node_type
A table entry (node) that encapsulates the key/val tuple with an additional linked-list entry for has...
A keyword and a list of tokens is an 'entry'.