diff --git a/include/Tree/tree.hpp b/include/Tree/tree.hpp index e373f44..9f8bfb5 100644 --- a/include/Tree/tree.hpp +++ b/include/Tree/tree.hpp @@ -225,12 +225,25 @@ namespace Tree /** * @brief finds all nodes of a given base * - * @param base - the base type of the node as a string + * @param b - the base type of the node as a string * @param c - a container for holding all found nodes, has to be holding objects of type std::shared_ptr */ - template - void findAllBase(const std::string &base, Container &c); + template + void findAllBase(const std::string &b, Container &c) + { + std::list>::iterator it; + if (base() == b) + { + c.push_back(shared_from_this()); + } + + for(it = children.begin(); it != children.end(); ++it) + { + (*it)->findAllBase(b,c); + } + + } /** * @brief checks if the given node is a direct child of this node