IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 83a12df1 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan: Committed by Maximilian Reininghaus
Browse files

reordered walk()

parent 62e7c331
No related branches found
No related tags found
1 merge request!116Some improvements here and there
...@@ -75,15 +75,12 @@ namespace corsika::environment { ...@@ -75,15 +75,12 @@ namespace corsika::environment {
*/ */
template <typename TCallable, bool preorder = true> template <typename TCallable, bool preorder = true>
void walk(TCallable func) { void walk(TCallable func) {
if constexpr (preorder) { if constexpr (preorder) { func(*this); }
func(*this);
std::for_each(fChildNodes.begin(), fChildNodes.end(), std::for_each(fChildNodes.begin(), fChildNodes.end(),
[&](auto& v) { v->walk(func); }); [&](auto& v) { v->walk(func); });
} else {
std::for_each(fChildNodes.begin(), fChildNodes.end(), if constexpr (!preorder) { func(*this); };
[&](auto& v) { v->walk(func); });
func(*this);
}
} }
void AddChild(VTNUPtr pChild) { void AddChild(VTNUPtr pChild) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment