ENH: allow direct testing of HashTable iterator as a bool

- can be used as a more natural test on the iterator.
  For example, with

     HashTable<..> table;
     auto iter = table.find(...);

  Following are now all equivalent:

    1.  if (iter != table.end()) ...
    2.  if (iter.found()) ...
    3.  if (iter) ...
This commit is contained in:
Mark Olesen
2018-12-20 18:03:16 +01:00
parent 08335beb6f
commit 3560884abe
3 changed files with 15 additions and 1 deletions

View File

@ -40,7 +40,7 @@ using namespace Foam;
template<class Iter>
void printIf(const Iter& iter)
{
if (iter.found())
if (iter)
{
Info<< *iter;
}