Select elements if it satisfies bool function func \param func bool function \param result the vector for storing elements satisfying bool function func
| 96 | /// \param func bool function |
| 97 | /// \param result the vector for storing elements satisfying bool function func |
| 98 | void Element::recursiveElements(const std::function<bool(ElementPtr)> &func, |
| 99 | std::vector<ElementPtr> &result) const { |
| 100 | if (func != nullptr) { |
| 101 | for (const auto &child: this->_children) { |
| 102 | if (func(child)) |
| 103 | result.push_back(child); |
| 104 | child->recursiveElements(func, result); |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | void Element::recursiveDoElements(const std::function<void(std::shared_ptr<Element>)> &doFunc) { |
| 110 | if (doFunc != nullptr) { |
no test coverage detected