mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improve HashTable iterator access and management
- provide key_iterator/const_key_iterator for all hashes,
reuse directly for HashSet as iterator/const_iterator, respectively.
- additional keys() method for HashTable that returns a wrapped to
a pair of begin/end const_iterators with additional size/empty
information that allows these to be used directly by anything else
expecting things with begin/end/size. Unfortunately does not yet
work with std::distance().
Example,
for (auto& k : labelHashTable.keys())
{
...
}
This commit is contained in:
@ -69,6 +69,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "tableA keys: "; tableA.writeKeys(Info) << endl;
|
||||
|
||||
auto keyIterPair = tableA.keys();
|
||||
for (const auto& i : keyIterPair)
|
||||
{
|
||||
Info<<" keys: " << i << endl;
|
||||
}
|
||||
|
||||
Map<label> mapA
|
||||
{
|
||||
{ 1, 1 },
|
||||
@ -193,7 +199,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "setD : " << flatOutput(setD) << endl;
|
||||
|
||||
// this doesn't work (yet?)
|
||||
// This should not work (yet?)
|
||||
// setD[12] = true;
|
||||
|
||||
List<label> someLst(10);
|
||||
|
||||
Reference in New Issue
Block a user