STYLE: HashTable documentation
- explicitly mention the value-initialized status for the operator(). This means that the following code will properly use an initialized zero. HashTable<label> regionCount; if (...) regionCount("region1")++; ... and also this; if (regionCount("something") > 0) { ... } Note that the OpenFOAM HashTable uses operator[] to provide read and write access to *existing* entries and will provoke a FatalError if the entry does not exist. The operator() provides write access to *existing* entries or will create the new entry as required. The STL hashes use operator[] for this purpose.
Showing
- applications/test/HashSet/Test-hashSet.C 8 additions, 1 deletionapplications/test/HashSet/Test-hashSet.C
- applications/test/pTraits/Test-pTraits.C 9 additions, 0 deletionsapplications/test/pTraits/Test-pTraits.C
- src/OpenFOAM/containers/HashTables/HashSet/HashSet.H 2 additions, 2 deletionssrc/OpenFOAM/containers/HashTables/HashSet/HashSet.H
- src/OpenFOAM/containers/HashTables/HashTable/HashTable.C 2 additions, 2 deletionssrc/OpenFOAM/containers/HashTables/HashTable/HashTable.C
- src/OpenFOAM/containers/HashTables/HashTable/HashTable.H 13 additions, 7 deletionssrc/OpenFOAM/containers/HashTables/HashTable/HashTable.H
Please register or sign in to comment