33 template<
class T,
class Key,
class Hash>
44 template<
class T,
class Key,
class Hash>
47 iterator iter(this->
find(key));
52 <<
key <<
" not found in table. Valid entries: " 61 template<
class T,
class Key,
class Hash>
64 const const_iterator iter(this->cfind(
key));
69 <<
key <<
" not found in table. Valid entries: " 78 template<
class T,
class Key,
class Hash>
83 return Iterator<true>(
this,
key).good();
90 template<
class T,
class Key,
class Hash>
99 return iterator(Iterator<false>(
this,
key));
106 template<
class T,
class Key,
class Hash>
117 template<
class T,
class Key,
class Hash>
126 return const_iterator(Iterator<true>(
this,
key));
129 return const_iterator();
133 template<
class T,
class Key,
class Hash>
134 template<
class... Args>
141 return this->setEntry(
false,
key, std::forward<Args>(
args)...);
145 template<
class T,
class Key,
class Hash>
146 template<
class... Args>
153 return this->setEntry(
true,
key, std::forward<Args>(
args)...);
157 template<
class T,
class Key,
class Hash>
164 return this->setEntry(
false,
key, obj);
168 template<
class T,
class Key,
class Hash>
175 return this->setEntry(
false,
key, std::forward<T>(obj));
179 template<
class T,
class Key,
class Hash>
186 return this->setEntry(
true,
key, obj);
190 template<
class T,
class Key,
class Hash>
197 return this->setEntry(
true,
key, std::forward<T>(obj));
227 template<
class T,
class Key,
class Hash>
234 const const_iterator iter(this->cfind(
key));
235 return iter.good() ? iter.val() : deflt;
241 template<
class T,
class Key,
class Hash>
244 return this->at(
key);
248 template<
class T,
class Key,
class Hash>
251 return this->at(
key);
255 template<
class T,
class Key,
class Hash>
258 iterator iter(this->
find(key));
270 template<
class T,
class Key,
class Hash>
277 iterator iter(this->
find(key));
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as ListOps::find_if.
bool emplace(const Key &key, Args &&... args)
Emplace insert a new entry, not overwriting existing entries.
Forward iterator with const access.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
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.
bool emplace_set(const Key &key, Args &&... args)
Emplace set an entry, overwriting any existing entries.
Forward iterator with non-const access.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
bool contains(const Key &key) const
True if hashed key is contained (found) in table.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
T & operator()(const Key &key)
Return existing entry or create a new entry.
A HashTable similar to std::unordered_map.
const T & lookup(const Key &key, const T &deflt) const
Return hashed entry if it exists, or return the given default.
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Foam::argList args(argc, argv)
List< label > toc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
bool set(const Key &key, const T &obj)
Copy assign a new entry, overwriting existing entries.
T & operator[](const Key &key)
Find and return a hashed entry. FatalError if it does not exist.