ADD: added method to prepend a child

This commit is contained in:
Dominik Meyer 2019-04-04 23:27:58 +02:00
parent 30ccb2e695
commit 22739d8ac4
No known key found for this signature in database
GPG Key ID: B4C312B600606B64

View File

@ -170,6 +170,14 @@ namespace Tree
*/ */
void addChild(const std::shared_ptr<Tree::BaseNode> &c) {c->setParent(shared_from_this()); children.push_back(c); } void addChild(const std::shared_ptr<Tree::BaseNode> &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<Tree::BaseNode> &c) {c->setParent(shared_from_this()); children.push_front(c); }
/** /**
* @brief adds a container of nodes to the list of children * @brief adds a container of nodes to the list of children
* *