mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add HashTable += operation (combines HashTables)
- adjust return values of HashSet operators.
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -880,6 +880,32 @@ bool Foam::HashTable<T, Key, Hash>::operator!=
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::HashTable<T, Key, Hash>& Foam::HashTable<T, Key, Hash>::operator+=
|
||||
(
|
||||
const HashTable<T, Key, Hash>& rhs
|
||||
)
|
||||
{
|
||||
// Avoid no-ops:
|
||||
if (rhs.size() || this != &rhs)
|
||||
{
|
||||
if (this->size())
|
||||
{
|
||||
for (const_iterator iter = rhs.cbegin(); iter != rhs.cend(); ++iter)
|
||||
{
|
||||
insert(iter.key(), iter.object());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
(*this) = rhs;
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Iterators, Friend Operators
|
||||
|
||||
Reference in New Issue
Block a user