diff --git a/include/Tree/tree.hpp b/include/Tree/tree.hpp index a97a221..a6fd400 100644 --- a/include/Tree/tree.hpp +++ b/include/Tree/tree.hpp @@ -170,6 +170,14 @@ namespace Tree */ void addChild(const std::shared_ptr &c) {c->setParent(shared_from_this()); children.push_back(c); } + + /** + * @brief prepends a child to the node which is already a shared_ptr + * + * @param c - a shared_ptr to a BaseNode + */ + void prependChild(const std::shared_ptr &c) {c->setParent(shared_from_this()); children.push_front(c); } + /** * @brief adds a container of nodes to the list of children *