mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: simplify HashSet equality test
- reduce the amount of checking. Equivalent logic to what HashTable has.
This commit is contained in:
@ -121,16 +121,12 @@ inline bool Foam::HashSet<Key, Hash>::operator[](const Key& key) const
|
||||
template<class Key, class Hash>
|
||||
bool Foam::HashSet<Key, Hash>::operator==(const HashSet<Key, Hash>& rhs) const
|
||||
{
|
||||
// Are all lhs elements in rhs?
|
||||
for (const_iterator iter = this->cbegin(); iter != this->cend(); ++iter)
|
||||
// Sizes (number of keys) must match
|
||||
if (this->size() != rhs.size())
|
||||
{
|
||||
if (!rhs.found(iter.key()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Are all rhs elements in lhs?
|
||||
for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter)
|
||||
{
|
||||
if (!this->found(iter.key()))
|
||||
|
||||
Reference in New Issue
Block a user