Skip to content
  • Mark OLESEN's avatar
    ENH: improve overall consistency of the HashTable and its iterators · c0a50dc6
    Mark OLESEN authored
    - previously had a mismash of const/non-const attributes on iterators
      that were confused with the attributes of the object being accessed.
    
    - use the iterator keys() and object() methods consistently for all
      internal access of the HashTable iterators. This makes the intention
      clearer, the code easier to maintain, and protects against any
      possible changes in the definition of the operators.
    
    - 'operator*': The standard form expected by STL libraries.
      However, for the std::map, this dereferences to a <key,value> pair,
      whereas OpenFOAM dereferences simply to <value>.
    
    - 'operator()': OpenFOAM treats this like the 'operator*'
    
    - adjusted the values of end() and cend() to reinterpret from nullObject
      instead of returning a static iteratorEnd() object.
      This means that C++ templates can now correctly deduce and match
      the return types from begin() and end() consistently.
      So that range-based now works.
    
      Eg,
          HashTable<label> table1 = ...;
          for (auto i : table1)
          {
              Info<< i << endl;
          }
    
      Since the 'operator*' returns hash table values, this prints all the
      values in the table.
    c0a50dc6