Go to the documentation of this file.
33 template<
class T,
class Key,
class Hash>
38 return Hash()(key) & (capacity_ - 1);
44 template<
class T,
class Key,
class Hash>
51 template<
class T,
class Key,
class Hash>
58 template<
class T,
class Key,
class Hash>
65 template<
class T,
class Key,
class Hash>
68 iterator iter(this->
find(key));
73 << key <<
" not found in table. Valid entries: "
82 template<
class T,
class Key,
class Hash>
85 const const_iterator iter(this->cfind(key));
90 << key <<
" not found in table. Valid entries: "
99 template<
class T,
class Key,
class Hash>
104 return Iterator<true>(
this, key).good();
111 template<
class T,
class Key,
class Hash>
120 return iterator(Iterator<false>(
this, key));
127 template<
class T,
class Key,
class Hash>
134 return this->cfind(key);
138 template<
class T,
class Key,
class Hash>
147 return const_iterator(Iterator<true>(
this, key));
150 return const_iterator();
154 template<
class T,
class Key,
class Hash>
155 template<
class... Args>
162 return this->setEntry(
false, key, std::forward<Args>(
args)...);
166 template<
class T,
class Key,
class Hash>
173 return this->setEntry(
false, key, obj);
177 template<
class T,
class Key,
class Hash>
184 return this->setEntry(
false, key, std::forward<T>(obj));
188 template<
class T,
class Key,
class Hash>
195 return this->setEntry(
true, key, obj);
199 template<
class T,
class Key,
class Hash>
206 return this->setEntry(
true, key, std::forward<T>(obj));
210 template<
class T,
class Key,
class Hash>
217 const const_iterator iter(this->cfind(key));
218 return iter.good() ? iter.val() : deflt;
224 template<
class T,
class Key,
class Hash>
227 return this->at(key);
231 template<
class T,
class Key,
class Hash>
234 return this->at(key);
238 template<
class T,
class Key,
class Hash>
241 iterator iter(this->
find(key));
249 return find(key).val();
253 template<
class T,
class Key,
class Hash>
260 iterator iter(this->
find(key));
268 return find(key).val();
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
label size() const noexcept
The number of elements in table.
Forward iterator with non-const access.
Forward iterator with const access.
T & operator[](const Key &key)
Find and return a hashed entry. FatalError if it does not exist.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
bool emplace(const Key &key, Args &&... args)
Emplace insert a new entry, not overwriting existing entries.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const T & lookup(const Key &key, const T &deflt) const
Return hashed entry if it exists, or return the given default.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Find index of the first occurrence that satisfies the predicate.
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A HashTable similar to std::unordered_map.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label capacity() const noexcept
The size of the underlying table.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
T & operator()(const Key &key)
Return existing entry or create a new entry.
bool set(const Key &key, const T &obj)
Copy assign a new entry, overwriting existing entries.
bool empty() const noexcept
True if the hash table is empty.
bool found(const Key &key) const
Return true if hashed entry is found in table.
Foam::argList args(argc, argv)
T & at(const Key &key)
Find and return a hashed entry. FatalError if it does not exist.