openfoam/applications/test/HashTable1
Mark Olesen 7afebef509 ENH: HashTable sorted() method
- the sorted() method fills a UPtrList with sorted entries. In some
  places this can provide a more convenient means of traversing a
  HashTable in consistent order, without the extra step of creating
  a sortedToc(). The sorted() method with a UPtrList will also have
  a lower overhead than creating any sortedToc() or toc() since it is
  list of pointers and not full copies of the keys.

  Instead of this:

      HashTable<someType> table = ...;

      for (const word& key : table.sortedToc())
      {
          Info<< key << " => " << table[key] << nl;
      }

  can write this:

      for (const auto& iter : table.sorted())
      {
          Info<< iter.key() << " => " << iter.val() << nl;
      }

STYLE:

- declare hash entry key 'const' since it is immutable
2022-05-10 10:47:01 +02:00
..
Make STYLE: adds comments in empty Make/options files 2018-11-13 15:21:13 +01:00
Test-HashTable1.C ENH: HashTable sorted() method 2022-05-10 10:47:01 +02:00