|
|
<!-- --- title: OpenFOAM C++ Coding Patterns (HashTable) -->
|
|
|
|
|
|
[Back to _coding patterns_](/coding/patterns/patterns)
|
|
|
|
|
|
***We are happy to incorporate content from volunteers!!***
|
|
|
|
|
|
|
... | ... | @@ -8,6 +9,8 @@ |
|
|
|
|
|
### HashSet
|
|
|
|
|
|
\since 1706
|
|
|
|
|
|
Use range-for to dereference the HashSet iterators directly:
|
|
|
```
|
|
|
labelHashSet ids ...;
|
... | ... | @@ -36,6 +39,8 @@ forAllConstIter(labelHashSet, ids, iter) |
|
|
|
|
|
### HashTable, Map
|
|
|
|
|
|
\since 1706
|
|
|
|
|
|
Use `lookup()` to provide default values (const-access) and the `operator()`
|
|
|
to create new zero-initialized entries if required:
|
|
|
```
|
... | ... | |