Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
OpenFOAM-plus
Commits
37ef335d
Commit
37ef335d
authored
Apr 11, 2017
by
mark
Browse files
ENH: simplify HashSet equality test
- reduce the amount of checking. Equivalent logic to what HashTable has.
parent
5d64f3da
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/containers/HashTables/HashSet/HashSet.C
View file @
37ef335d
...
@@ -121,16 +121,12 @@ inline bool Foam::HashSet<Key, Hash>::operator[](const Key& key) const
...
@@ -121,16 +121,12 @@ inline bool Foam::HashSet<Key, Hash>::operator[](const Key& key) const
template
<
class
Key
,
class
Hash
>
template
<
class
Key
,
class
Hash
>
bool
Foam
::
HashSet
<
Key
,
Hash
>::
operator
==
(
const
HashSet
<
Key
,
Hash
>&
rhs
)
const
bool
Foam
::
HashSet
<
Key
,
Hash
>::
operator
==
(
const
HashSet
<
Key
,
Hash
>&
rhs
)
const
{
{
//
Are all lhs elements in rhs?
//
Sizes (number of keys) must match
for
(
const_iterator
iter
=
this
->
cbegin
();
iter
!=
this
->
cend
();
++
iter
)
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
)
for
(
const_iterator
iter
=
rhs
.
cbegin
();
iter
!=
rhs
.
cend
();
++
iter
)
{
{
if
(
!
this
->
found
(
iter
.
key
()))
if
(
!
this
->
found
(
iter
.
key
()))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment