37 template<
class Key,
class Hash>
38 template<
class InputIter>
46 if (!this->capacity())
56 return insert(first, last);
62 template<
class Key,
class Hash>
72 template<
class Key,
class Hash>
75 parent_type(2*list.size())
81 template<
class Key,
class Hash>
91 template<
class Key,
class Hash>
94 parent_type(2*list.size())
100 template<
class Key,
class Hash>
101 template<
class AnyType,
class AnyHash>
107 parent_type(tbl.capacity())
109 for (
auto iter = tbl.
cbegin(); iter != tbl.
cend(); ++iter)
118 template<
class Key,
class Hash>
119 template<
class InputIter>
127 while (first != last)
139 template<
class Key,
class Hash>
142 std::initializer_list<Key> list
149 template<
class Key,
class Hash>
160 template<
class Key,
class Hash>
170 template<
class Key,
class Hash>
181 template<
class Key,
class Hash>
182 template<
class InputIter>
193 template<
class Key,
class Hash>
196 std::initializer_list<Key> list
199 return unset(list.begin(), list.end());
203 template<
class Key,
class Hash>
214 template<
class Key,
class Hash>
224 template<
class Key,
class Hash>
235 template<
class Key,
class Hash>
238 parent_type::merge(source);
242 template<
class Key,
class Hash>
245 parent_type::merge(source);
251 template<
class Key,
class Hash>
254 return this->contains(
key);
258 template<
class Key,
class Hash>
261 return this->contains(
key);
265 template<
class Key,
class Hash>
273 template<
class Key,
class Hash>
280 template<
class Key,
class Hash>
283 assignMany(rhs.size(), rhs.begin(), rhs.end());
287 template<
class Key,
class Hash>
291 if (this->size() != rhs.
size())
296 for (const_iterator iter = rhs.
cbegin(); iter != rhs.
cend(); ++iter)
298 if (!this->contains(iter.key()))
308 template<
class Key,
class Hash>
315 template<
class Key,
class Hash>
320 for (const_iterator iter = rhs.
cbegin(); iter != rhs.
cend(); ++iter)
329 template<
class Key,
class Hash>
333 this->parent_type::retain(rhs);
338 template<
class Key,
class Hash>
343 for (const_iterator iter = rhs.
cbegin(); iter != rhs.
cend(); ++iter)
345 if (this->contains(iter.key()))
347 this->
erase(iter.key());
359 template<
class Key,
class Hash>
363 return this->operator|=(rhs);
367 template<
class Key,
class Hash>
379 template<
class Key,
class Hash>
380 Foam::Ostream& Foam::operator<<(Ostream& os, const HashSet<Key, Hash>& rhs)
382 return rhs.
writeKeys(
os, Detail::ListPolicy::short_length<Key>::value);
388 template<
class Key,
class Hash>
391 const HashSet<Key, Hash>& a,
392 const HashSet<Key, Hash>&
b 395 HashSet<Key, Hash> result(a);
401 template<
class Key,
class Hash>
404 const HashSet<Key, Hash>& a,
405 const HashSet<Key, Hash>&
b 408 HashSet<Key, Hash> result(a.
capacity());
410 for (
const Key&
k : a)
422 template<
class Key,
class Hash>
425 const HashSet<Key, Hash>& a,
426 const HashSet<Key, Hash>&
b 429 HashSet<Key, Hash> result(a);
435 template<
class Key,
class Hash>
438 const HashSet<Key, Hash>& a,
439 const HashSet<Key, Hash>&
b 442 HashSet<Key, Hash> result(a.
capacity());
444 for (
const Key&
k : a)
458 template<
class Key,
class Hash>
464 static_cast<parent_type&>(*this).begin()
469 template<
class Key,
class Hash>
473 return const_iterator
475 static_cast<const parent_type&>(*this).begin()
480 template<
class Key,
class Hash>
484 return const_iterator
486 static_cast<const parent_type&>(*this).cbegin()
491 template<
class Key,
class Hash>
499 template<
class Key,
class Hash>
507 template<
class Key,
class Hash>
511 return const_iterator();
A HashTable with keys but without contents that is similar to std::unordered_set. ...
void size(const label n)
Older name for setAddressableSize.
this_type & operator^=(const this_type &rhs)
Only retain unique entries (xor)
patchWriters resize(patchIds.size())
A 1D vector of objects of type <T> with a fixed length <N>.
iterator begin() noexcept
Return an iterator to begin traversing the FixedList.
bool operator()(const Key &key) const noexcept
Return true if the entry exists, same as contains()
srcOptions insert("case", fileName(rootDirSource/caseDirSource))
bool operator==(const this_type &rhs) const
Sets are equal if all keys are equal, independent of order or underlying storage size.
this_type & operator|=(const this_type &rhs)
Add entries to this HashSet.
iterator end() noexcept
Return an iterator to end traversing the FixedList.
void operator=(const this_type &rhs)
Copy assign.
constexpr const_iterator cend() const noexcept
label k
Boltzmann constant.
void merge(HashSet< Key, Hash > &source)
Attempts to extract entries from source parameter and insert them into this, does not overwrite exist...
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
Base for lists with indirect addressing, templated on the list contents type and the addressing type...
HashSet()
Default construct with default (128) table capacity.
void unset(List< bool > &bools, const labelUList &locations)
Unset the listed locations (assign 'false').
static constexpr label size() noexcept
Return the number of elements in the FixedList.
label size() const noexcept
The number of elements in table.
bool unset(const Key &key)
Unset the specified key - same as erase.
label capacity() const noexcept
The size of the underlying table.
Ostream & writeKeys(Ostream &os, const label shortLen=0) const
Write unordered keys (list), with line-breaks when length exceeds shortLen.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
this_type & operator-=(const this_type &rhs)
Remove entries from this HashSet. Uses erase()
A HashTable similar to std::unordered_map.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
OBJstream os(runTime.globalPath()/outputName)
iterator begin()
Return an iterator at begin of list.
iterator end()
Return an iterator at end of list.
this_type & operator &=(const this_type &rhs)
Only retain entries contained in both HashSets.
typename parent_type::key_iterator iterator
An iterator, returning reference to the key.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
bool operator[](const Key &key) const noexcept
Return true if the entry exists, same as contains().
this_type & operator+=(const this_type &rhs)
Add entries to this HashSet. Same as the '|=' operator.
typename parent_type::const_key_iterator const_iterator
A const_iterator, returning reference to the key.
iterator end() noexcept
Return an iterator to end traversing the UList.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
const_iterator cbegin() const
const_iterator cbegin() const
const_iterator set to the beginning of the HashTable
bool operator!=(const this_type &rhs) const
The opposite of the equality operation.
constexpr const_iterator cend() const noexcept
const_iterator to signal the end (for any HashTable)