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>
167 template<
class... Args>
174 return this->setEntry(
true,
key, std::forward<Args>(
args)...);
178 template<
class T,
class Key,
class Hash>
185 return this->setEntry(
false,
key, obj);
189 template<
class T,
class Key,
class Hash>
196 return this->setEntry(
false,
key, std::forward<T>(obj));
200 template<
class T,
class Key,
class Hash>
207 return this->setEntry(
true,
key, obj);
211 template<
class T,
class Key,
class Hash>
218 return this->setEntry(
true,
key, std::forward<T>(obj));
222 template<
class T,
class Key,
class Hash>
229 const const_iterator iter(this->cfind(
key));
230 return iter.good() ? iter.val() : deflt;
236 template<
class T,
class Key,
class Hash>
239 return this->at(
key);
243 template<
class T,
class Key,
class Hash>
246 return this->at(
key);
250 template<
class T,
class Key,
class Hash>
253 iterator iter(this->
find(key));
265 template<
class T,
class Key,
class Hash>
272 iterator iter(this->
find(key));
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
label size() const noexcept
The number of elements in table.
Forward iterator with non-const access.
bool emplace_set(const Key &key, Args &&... args)
Emplace set an entry, overwriting any existing entries.
Forward iterator with const access.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
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.
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)
friend Ostream & operator(Ostream &, const HashTable< T, Key, Hash > &tbl)
T & at(const Key &key)
Find and return a hashed entry. FatalError if it does not exist.