VDKBtree< T > Class Template Reference
provides a templatized binary tree data structure
More...
#include <vdkbtrees.h>
List of all members.
Public Member Functions
Detailed Description
template<class T>
class VDKBtree< T >
provides a templatized binary tree data structure
- Description
- VDKBtree<T> class has a value semantic, all objects are copied from original values. VDKBtree<T> class implements red/black balanced trees. All managed type T objects should provide:
- a default constructor: T::T()
- a copy initializer: T::T(T& t)
- an assignement operator: T& T::operator=(T& t)
- an equality and less-than operators:
- bool T::operator==(T& t)
- bool T::operator<(T& t)
- Implementation notes
- I suggest to use typedef's like:
- Programming tips
- Here an example how to construct, fill and trasverse a btree
#define LEN 10
typedef VDKBtree<int> intbt;
int v[LUNG] = { 3, 5, 7, 2, 1, 4, 45, 6, 23, 6 };
int main(int , char **)
{
intbt btree;
for (t=0; t < LEN ;t++)
btree.add(v[t]);
intbt::Iterator iter(btree);
for (; iter;iter++)
{
int i = iter.current();
}
for (t=0; t < LEN; t++)
btree.unlink(v[t]);
}
- EXAMPLES
- in ./example/template/ttest.cc
Constructor & Destructor Documentation
Constructor, makes an empty tree
The documentation for this class was generated from the following file: