STYLE: move bitSet '~' member operator to be a global operator instead

This commit is contained in:
Mark Olesen 2019-03-27 08:46:10 +01:00 committed by Andrew Heather
parent 1788bce0a2
commit 56b7145a2f
2 changed files with 12 additions and 13 deletions

View File

@ -513,10 +513,6 @@ public:
//- Move assignment
inline bitSet& operator=(bitSet&& bitset);
//- Complement operator.
// Return a copy of the existing set with all its bits flipped.
inline bitSet operator~() const;
//- Bitwise-AND all the bits in other with the bits in this bitset.
// The operands may have dissimilar sizes without affecting the size
// of the set.
@ -576,6 +572,9 @@ Ostream& operator<<(Ostream& os, const bitSet& bitset);
Ostream& operator<<(Ostream& os, const InfoProxy<bitSet>& info);
//- Bitset complement, returns a copy of the bitset with all its bits flipped
inline bitSet operator~(const bitSet& bitset);
//- Bitwise-AND of two bitsets.
// See bitSet::operator&= for more details.
inline bitSet operator&(const bitSet& a, const bitSet& b);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -663,14 +663,6 @@ inline Foam::bitSet& Foam::bitSet::operator=(bitSet&& bitset)
}
inline Foam::bitSet Foam::bitSet::operator~() const
{
bitSet result(*this);
result.flip();
return result;
}
inline Foam::bitSet& Foam::bitSet::operator&=(const bitSet& other)
{
return andEq(other);
@ -697,6 +689,14 @@ inline Foam::bitSet& Foam::bitSet::operator-=(const bitSet& other)
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
inline Foam::bitSet Foam::operator~(const bitSet& bitset)
{
bitSet result(bitset);
result.flip();
return result;
}
inline Foam::bitSet Foam::operator&(const bitSet& a, const bitSet& b)
{
bitSet result(a);