mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -40,7 +40,7 @@ using namespace Foam;
|
||||
template<class Iter>
|
||||
void printIf(const Iter& iter)
|
||||
{
|
||||
if (iter.found())
|
||||
if (iter)
|
||||
{
|
||||
Info<< *iter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user