diff --git a/alib2std/src/extensions/tree.hpp b/alib2std/src/extensions/tree.hpp index 68ae7d77db6a0363681a7c6d7c078f2b624106ab..e165ef6774ae3c877de213f39c3e14d2af447969 100644 --- a/alib2std/src/extensions/tree.hpp +++ b/alib2std/src/extensions/tree.hpp @@ -372,6 +372,14 @@ public: ( * it )->parent = static_cast < Cast * > ( this ); } + typename std::vector < Data >::iterator insert ( typename std::vector < Data >::iterator it, Data d ) { + it = children.insert ( it, std::move ( d ) ); + + ( * std::prev ( it ) ) -> parent = static_cast < Cast * > ( this ); + + return it; + } + template < class InputIterator > typename std::vector < Data >::iterator insert ( typename std::vector < Data >::iterator it, InputIterator first, InputIterator last ) { size_t off = it - children.begin ( ); @@ -453,6 +461,10 @@ public: const_cast < VararyNode < Data, ConstData, Cast > & > ( node ).setChild ( std::move ( child ), it ); } + typename std::vector < Data >::iterator insert ( const VararyNode < Data, ConstData, Cast > & node, typename std::vector < Data >::iterator it, Data child ) { + const_cast < VararyNode < Data, ConstData, Cast > & > ( node ).insert ( it, std::move ( child ) ); + } + template < class InputIterator > typename std::vector < Data >::iterator insert ( const VararyNode < Data, ConstData, Cast > & node, typename std::vector < Data >::iterator it, InputIterator first, InputIterator last ) { const_cast < VararyNode < Data, ConstData, Cast > & > ( node ).insert ( it, first, last );