Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
32a332f5
Commit
32a332f5
authored
Aug 07, 2018
by
Mark OLESEN
Browse files
ENH: add HashTableOps::values() service function
- extract a list of the HashTable values, optionally sorted.
parent
9160dad6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/containers/HashTables/HashOps/HashOps.H
View file @
32a332f5
...
...
@@ -140,6 +140,29 @@ struct plusEqOp
}
};
//- List of values from HashTable, optionally sorted.
template
<
class
T
,
class
Key
,
class
Hash
>
List
<
T
>
values
(
const
HashTable
<
T
,
Key
,
Hash
>&
tbl
,
const
bool
doSort
=
false
)
{
List
<
T
>
output
(
tbl
.
size
());
label
i
=
0
;
forAllConstIters
(
tbl
,
iter
)
{
output
[
i
]
=
iter
.
object
();
++
i
;
}
if
(
doSort
)
{
Foam
::
sort
(
output
);
}
return
output
;
}
}
// End namespace HashTableOps
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment