ENH: HashTable/HashSet contains(key) method

- functionality provided as 'found(key)' in OpenFOAM naming, since
  there was no stl equivalent at the time. Now support contains(),
  which is the equivalent for C++20 maps/sets.

STYLE: general contains() method for containers

STYLE: treat Enum and Switch similarly as hash-like objects
This commit is contained in:
Mark Olesen
2023-02-06 11:21:15 +01:00
parent ed39ee6afe
commit 750381bd99
36 changed files with 212 additions and 156 deletions

View File

@ -553,7 +553,7 @@ Foam::label Foam::HashTable<T, Key, Hash>::erase
++iter
)
{
if (other.found(iter.key()) && erase(iter))
if (other.contains(iter.key()) && erase(iter))
{
++changed;
}
@ -586,7 +586,7 @@ Foam::label Foam::HashTable<T, Key, Hash>::retain
for (iterator iter = begin(); iter != end(); ++iter)
{
if (!other.found(iter.key()) && erase(iter))
if (!other.contains(iter.key()) && erase(iter))
{
++changed;
}