ENH: add bitSet::operator() for predicate use (as per HashSet)

This commit is contained in:
Mark Olesen
2018-11-08 11:34:02 +01:00
parent 2fb382bf8a
commit 2c44ac299d
2 changed files with 10 additions and 0 deletions

View File

@ -493,6 +493,10 @@ public:
// Member Operators
//- Test value at specified position, same as test()
// Enables use as a predicate
inline bool operator()(const label pos) const;
//- Identical to get() - get value at index.
// Never auto-vivify entries.
inline unsigned int operator[](const label i) const;

View File

@ -621,6 +621,12 @@ inline Foam::bitSet& Foam::bitSet::extend(const bitSet& other)
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline bool Foam::bitSet::operator()(const label pos) const
{
return test(pos);
}
inline unsigned int Foam::bitSet::operator[](const label i) const
{
return get(i);