bazaar: Tree: Moveable and Iteration

git-svn-id: svn://ultimatepp.org/upp/trunk@2833 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
kohait 2010-11-04 10:46:54 +00:00
parent 4846ffceec
commit 64493583f2

View file

@ -6,7 +6,7 @@ using namespace Upp;
template <class T>
class Tree
: protected Array<T>
: protected Array<T>, Moveable<Tree<T> >
{
protected:
typedef Array<T> B;
@ -63,6 +63,10 @@ public:
T *PopDetach() { T * t = B::PopDetach(); Unlink(*t); return t; }
using B::Begin;
using B::End;
using B::GetIter;
void Swap(Tree& b) { B::Swap(b); for(int i = 0; i < B::GetCount(); i++) Link(B::operator[](i)); for(int i = 0; i < b.GetCount(); i++) b.Link(b[i]); }
Tree& operator<<(const T& x) { Add(x); return *this; }