From cf58516dafde24e3cb3c9308e600e594c393a710 Mon Sep 17 00:00:00 2001 From: Dominik Meyer Date: Wed, 10 Apr 2019 09:52:46 +0200 Subject: [PATCH] ADD: method to prepend a child --- include/Tree/tree.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/Tree/tree.hpp b/include/Tree/tree.hpp index 16171b2..e373f44 100644 --- a/include/Tree/tree.hpp +++ b/include/Tree/tree.hpp @@ -194,6 +194,15 @@ namespace Tree void addChildren(Iter begin, Iter end) { std::copy( begin, end, std::back_inserter( children ) );} + /** + * @brief prepends a container of nodes to the list of children + * + * @param begin - iterator to the beginning of the container of objects of type std::shared_ptr + * @param end - iterator to the end of the container of objects of type std::shared_ptr + */ + template + void prependChildren(Iter begin, Iter end) { std::copy( begin, end, std::front_inserter( children ) );} + /** * @brief finds the next node in the tree of a given type *