Click here to Skip to main content
15,887,596 members
Articles / Desktop Programming / MFC
Article

An STL like Tree Class

Rate me:
Please Sign up or sign in to vote.
4.13/5 (14 votes)
28 May 20021 min read 112.2K   1.7K   34   20
A multi-node Tree class by using map and vector

Sample Image

Introduction

For more than a year and a half I have had to use some kind of multi-node tree to do something. However, all I found from the Internet are binary trees or equivalents. I therefore decided to write my own. Because I had to finish it pretty fast, I spent only two days for it, so it may be buggy.

In the project, it has three classes working like in STL container-iterator style.
template <class Key, class T> class Tree
template <class Key, class T> class Tree_iterator
template <class Key, class T> class TreeNode

A tree contains many tree nodes, while tree nodes contain data. Tree nodes of a tree are called children. In the design each node is assigned a level and the root node is of level 1. Tree_iterator is for navigation within the tree. Two tree-walk styles are defined. One walks down from the root node, while the other one use post-style to walk through all children of the tree. For each walk action, a

tree_iterator
is returned, so the user can use the iterator to reference the tree node and get the data.

I wrapped all the classes under the namespace Tiffany. For example, declaration of the tree with key type of wstring, and node data type of string, and add two levels of element is like:

Tiffany::Tree<wstring, string> x(L"Node 1", "Root");

px = x.AddChild(L"Key1","A");
px1 = x.AddChild(px, L"Key2", "1");

For a walk down action, you can limit it to a part of a tree ("sub-tree") by using the function SetSubTreePivot(px), and you can set the pivot to point back to the root node by calling SetWalkDownRootPivot. Try it out!. You can even delete part of the tree by calling DelSubTree().

Unfortunately I didn't have much time to prepare this document, but it should be obvious how to the classes.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Hong Kong Hong Kong
I'm a guy situated in Hong Kong with some knowledges in Java, VC++, C#, database, client-server, distributed, and mutithreaded computing and so on. I've been working in various companies as engineer, consultant, programmer.

Lately I was mainly working in banking & financial industries. Personally, I'm working on a trading application on my own now.

Comments and Discussions

 
Generalremove node Pin
filippov.anton25-Sep-07 1:35
filippov.anton25-Sep-07 1:35 
QuestionHow to delete a leaf-node? Pin
caijianshan17-Oct-06 21:46
caijianshan17-Oct-06 21:46 
GeneralInteresting Solution Pin
Dave Handley13-Aug-04 12:24
Dave Handley13-Aug-04 12:24 
GeneralRe: Interesting Solution Pin
Anonymous13-Aug-04 18:12
Anonymous13-Aug-04 18:12 
GeneralRe: Interesting Solution Pin
Dave Handley14-Aug-04 0:48
Dave Handley14-Aug-04 0:48 
GeneralRe: Interesting Solution Pin
rajas1-Sep-04 6:59
rajas1-Sep-04 6:59 
GeneralRe: Interesting Solution Pin
Dave Handley1-Sep-04 9:58
Dave Handley1-Sep-04 9:58 
Questionnot work in VC.net 2003? Pin
lad5-Aug-04 23:44
lad5-Aug-04 23:44 
AnswerRe: not work in VC.net 2003? Pin
Jovan Cakic24-Oct-04 11:34
Jovan Cakic24-Oct-04 11:34 
GeneralRe: not work in VC.net 2003? Pin
Scott McCain1-Jun-06 16:50
Scott McCain1-Jun-06 16:50 
Generaliterator AddChild (const Key parent, const Key nm, const T x) Pin
Member 60974615-Jan-04 18:15
Member 60974615-Jan-04 18:15 
#ifndef _TREE_H_
#define _TREE_H_

/* Copyright - All copyright is owned by Mr Jack Hui
Author : Jack, Hui Ho Yin
Email : jackhui@hotmail.com, jackhui@hongkong.com
Update : 27-Aug-2000, 10-Aug-2002*/
#pragma warning(disable : 4786) //debug info - name too long

#include <vector>
#include
#include <string>
#include <iostream>

// Support TEMPLATE CLASS sorted_vector
#include <algorithm>
#include <utility>
#include <functional>

using namespace std;

namespace Tiffany {

//forward declarations
template <class key,="" class="" t=""> class TreeNode;
template <class key,="" class="" t=""> class Tree;
template <class key,="" class="" t=""> class Tree_iterator;

template<class k,="" bool="" bnoduplicates="false,class" pr="std::less<K">, class A = std::allocator<k> >
class sorted_vector ;

//


template <class key,="" class="" t=""> class TreeNode {

public:

T m_data; //things stored in treenode
Key m_key; //key to locate myself
int m_level; //rootnode is of level 1

TreeNode<key,t>* m_parent; //points to node of parent
sorted_vector<treenode<key,t> *> m_children; //holds pointers for children

sorted_vector<treenode<key,t> *>::iterator m_current; //holds iterator to current child processing

Tree<key, t="">* m_LinkedTree; //whom i'm belonging to

TreeNode(Tree<key,t>* tr) : m_parent(NULL) {
m_LinkedTree = tr;
};

TreeNode(Tree<key,t>* tr, const Key key, const T x) {
m_key = key;
m_data = x;
m_LinkedTree = tr;
};

//Delete all the children of this node including all the down levels
void DeleteAllChildren() {

vector<treenode<key,t>*>::iterator pchild;
map<key, treenode<key,t="">*>::iterator itrmap;

for(pchild=m_children.begin();pchild != m_children.end();)
{
(*pchild)->DeleteAllChildren();
itrmap = m_LinkedTree->m_nodemap.find((*pchild)->m_key);
m_LinkedTree->m_nodemap.erase(itrmap);
delete *pchild;
m_children.erase(pchild);
//after removing the node, iterater is advanced
}
};
//It erases a child from a Node without delete the node, and without remove
//linking from the tree, so it can still be accessed from the tree's find().
void EraseChild(Tree_iterator<key, t=""> &itr)
{
vector<treenode<key,t>*>::iterator pchild;
map<key, treenode<key,t="">*>::iterator itrmap;
TreeNode<key,t> *pNode = itr.m_Node->second;
itrmap = m_LinkedTree->m_nodemap.find(pNode->m_key);
//erase reference from the child vector
for(pchild=m_children.begin();pchild != m_children.end(); pchild++)
{
if( (*pchild)->m_key == pNode->m_key)
{
m_children.erase(pchild);
break;
}
}
}
//Return a reference to parent node in the tree
TreeNode<key,t>& GetParent () const {
return *m_parent;
};

//returns a reference to vector to the children
const sorted_vector<treenode<key,t>*>& GetChildren () const
{
return m_children;
};

long ChildCount () const
{
return m_children.size();
};

//add a child node to this node
void AddChild (TreeNode<key,t>* child)
{
child->m_parent = this;
child->m_level = this->m_level + 1;
m_children.insert(child);
};

T GetData(void) const { return m_data; }
};


//************ End of Tree Node declaration ***************************//
//


//************ Start of Tree declaration ***************************//
//

template <class key,="" class="" t="">
class Tree {

friend class TreeNode<key, t="">;
protected:
//provide a name of the TreeNode to direct access to it
map<key, treenode<key,t="">*> m_nodemap; //a map for fast accessing TreeNode

TreeNode<key,t>* m_pTreeroot; //a pointer to root node

TreeNode<key,t>* m_WalkPivot; //Sub-tree root for walking

TreeNode<key,t>* m_WalkCurrent; //point to current node of walking

TreeNode<key,t>* m_WalkParent; //point to parent node of current node

public:

typedef Tree_iterator<key, t=""> iterator;

typedef const iterator const_iterator;

iterator begin() {
iterator _tmp;
_tmp.m_Node = m_nodemap.begin();

return _tmp;
}

iterator end() {
iterator _tmp;
_tmp.m_Node = m_nodemap.end();

return _tmp;
}

const_iterator begin() const {
iterator _tmp;
_tmp.m_Node = m_nodemap.begin();

return _tmp;
}

const_iterator end() const {
const_iterator _tmp;
_tmp.m_Node = m_nodemap.end();

return _tmp;
}

iterator find(const Key& key) {
iterator _tmp;
_tmp.m_Node = m_nodemap.find(key);

return _tmp;
}

const_iterator find(const Key& key) const {
const_iterator _tmp;
_tmp.m_Node = m_nodemap.find(key);

return _tmp;
}

Tree () : m_pTreeroot(NULL) {
//instantiate an empty tree
}

Tree (const Key nm, const T x) {
//instantiate a tree with the root node

TreeNode<key,t>* pNode;

pNode = new TreeNode<key,t>(this, nm, x);
m_nodemap.insert(map<key, treenode<key,t="">*>::value_type(nm, pNode));
m_pTreeroot = pNode;
pNode->m_level = 1;
}

~Tree() {
if (m_pTreeroot) {
m_pTreeroot->DeleteAllChildren();
delete m_pTreeroot;
}
}

//returns tree root node, or NULL for empty tree
TreeNode<key,t>& GetRoot () const {
return *m_pTreeroot;
}

iterator AddChild (iterator& parent, const Key nm, const T x) {
TreeNode<key,t>* pNew;

pNew = new TreeNode<key,t>(this, nm, x);
parent.m_Node->second->AddChild(pNew);

pair<map<key, treenode<key,t="">*>::iterator, bool> pt = m_nodemap.insert(map<key, treenode<key,t="">*>::value_type(nm, pNew));

iterator _tmp;
_tmp.m_Node = pt.first;
return _tmp;
}
//
iterator AddChild (const Key nm, const T x) {
TreeNode<key,t>* pNew;

pNew = new TreeNode<key,t>(this, nm, x);

m_pTreeroot->AddChild(pNew);

pair<map<key, treenode<key,t="">*>::iterator, bool> pt = m_nodemap.insert(map<key, treenode<key,t="">*>::value_type(nm, pNew));

iterator _tmp;
_tmp.m_Node = pt.first;
return _tmp;
}
//--- add by mry 2004
iterator AddChild (const Key parent, const Key nm, const T x) {
iterator px,_tmp;
px = find(parent);
if ( px != end())
_tmp = AddChild (px, nm, x);

return _tmp;
}
TreeNode<key,t>& SetRoot (const Key nm, const T x) {
TreeNode<key,t>* pNode;
//Èç¹ûÒѾ­ÓÐÁ˸ù½Úµã£¬É¾³ýËùÓÐ
if (m_pTreeroot) {
m_pTreeroot->DeleteAllChildren();
delete m_pTreeroot;
}
//È»ºó´´½¨¸ù½Úµã
pNode = new TreeNode<key,t>(this, nm, x);
m_nodemap.insert(map<key, treenode<key,t="">*>::value_type(nm, pNode));
m_pTreeroot = pNode;
pNode->m_level = 1;
//·µ»Ø¸ù½Úµã
return GetRoot();
}
//end of add

void DeleteAllChildren(iterator & itr) {
itr.m_Node->second->DeleteAllChildren();
}

size_t size(void) { return m_nodemap.size(); }

//Set the sub-tree walking root and traverse to the first node
void SetPostOrderSubTreePivot(iterator& it) {

m_WalkPivot = it.m_Node->second;
m_WalkCurrent = m_WalkPivot;
m_WalkCurrent->m_current = m_WalkCurrent->m_children.begin();

while (m_WalkCurrent->m_children.size() != 0) {
m_WalkCurrent->m_current = m_WalkCurrent->m_children.begin();
m_WalkCurrent = *(m_WalkCurrent->m_children.begin());
}
if (m_WalkCurrent != m_WalkPivot) {
m_WalkParent = m_WalkCurrent->m_parent;
}
else {
m_WalkParent = m_WalkCurrent; //for the case no child in pivot
}
}

//Set the sub-tree walking root and traverse to the first node
void SetPostOrderRootPivot() {

m_WalkPivot = m_pTreeroot;
m_WalkCurrent = m_WalkPivot;
m_WalkCurrent->m_current = m_WalkCurrent->m_children.begin();

while (m_WalkCurrent->m_children.size() != 0) {
m_WalkCurrent->m_current = m_WalkCurrent->m_children.begin();
m_WalkCurrent = *(m_WalkCurrent->m_children.begin());
}
if (m_WalkCurrent != m_WalkPivot) {
m_WalkParent = m_WalkCurrent->m_parent;
}
else {
m_WalkParent = m_WalkCurrent; //for the case no child in pivot
}
}

//It sets root to be the pivot in Walk Down, first node is the first child
void SetWalkDownSubTreePivot(iterator& itr)
{
m_WalkPivot = itr.m_Node->second;
m_WalkCurrent = m_WalkPivot;
m_WalkCurrent->m_current = m_WalkCurrent->m_children.begin();
}
//It sets root to be the pivot in Walk Down, first node is the first child
void SetWalkDownRootPivot() {

m_WalkPivot = m_pTreeroot;
m_WalkCurrent = m_WalkPivot;
m_WalkCurrent->m_current = m_WalkCurrent->m_children.begin();
}

//it advances m_WalkCurrent in post-order, and returns true if a move is made
//else it returns false
bool SubTreePostOrderWalk() {

if (m_WalkCurrent == m_WalkPivot)
return false;

//if not the parent's last child, advance one node in paraent's child
//if the advanced child contains sub node, go in depth to the leftmost one
if (++m_WalkParent->m_current != m_WalkParent->m_children.end()) {
m_WalkCurrent = *(m_WalkParent->m_current);
while (m_WalkCurrent->m_children.size() != 0) {
//go down
m_WalkCurrent->m_current = m_WalkCurrent->m_children.begin();
m_WalkParent = m_WalkCurrent;
m_WalkCurrent = *(m_WalkCurrent->m_current);
}
}
else {
//if it's the last child of parent, we go up
m_WalkCurrent = m_WalkParent;
m_WalkParent = m_WalkCurrent->m_parent;
}
m_WalkParent = m_WalkCurrent->m_parent;

return true;
}

//It advance the tree in top-down style with parent first
bool SubTreeWalkDown() {
//if it has children, we go down to children
if (m_WalkCurrent->m_current != m_WalkCurrent->m_children.end()) {
m_WalkCurrent = *(m_WalkCurrent->m_current);
m_WalkParent = m_WalkCurrent->m_parent;
m_WalkParent->m_current++; //advance to next child for next iteration
m_WalkCurrent->m_current = m_WalkCurrent->m_children.begin(); //initialize to first child
}
else {
//if it's the last child of parent, we go up to the level
//which we still need processing by recurively call ourself

if (m_WalkCurrent == m_WalkPivot)
return false; //no more child
m_WalkCurrent = m_WalkCurrent->m_parent;
m_WalkParent = m_WalkCurrent->m_parent;
SubTreeWalkDown();

}
return true;
}

void DelSubTree() {
}

//It moves a tree from source to destination. After moving a tree, tree walking will be invalid.
//However iterator will still be valid. Users has to Set the new root pivot again.
void MoveSubTree(iterator& dest_parent, iterator& src)
{
TreeNode<key,t>* pSrcNode;
TreeNode<key,t>* pDestNode;
TreeNode<key,t>* pSrcNodeParent;
pSrcNode = src.m_Node->second;
pSrcNodeParent = pSrcNode->m_parent;
//remove reference from original parent
pSrcNodeParent->EraseChild(src);
//add the src sub tree to destination parent node
pDestNode = dest_parent.m_Node->second;
pDestNode->AddChild(pSrcNode);
iterator itr;
itr = find(pSrcNode->m_key);
//setting up correct level
SetWalkDownSubTreePivot(itr);
while (SubTreeWalkDown())
{
m_WalkCurrent->m_level = m_WalkCurrent->m_parent->m_level + 1;
}
}
T SubTreeGetData(void) { return m_WalkCurrent->m_data; }
T SubTreeGetLevel(void) { return m_WalkCurrent->m_level; }

}; //class Tree

//************ End of Tree declaration ***************************//
//
//Actually, the interator is just a copy of the iterator to a std::map hold in
//the tree to provide simple navigation ability.
template <class key,="" class="" t="">
class Tree_iterator
{
typedef map<key, treenode<key,t="">*>::iterator _map_it;

public:
_map_it m_Node;

T operator*() const { return (m_Node->second)->GetData(); }

Tree_iterator& operator++() {
m_Node++;
return *this;
}

Tree_iterator operator++(int) {
Tree_iterator __tmp = *this;
m_Node++;
return __tmp;
}

Tree_iterator& operator--() {
m_Node--;
return *this;
}

bool operator==(const Tree_iterator& _y) const {
return m_Node == _y.m_Node;
}

bool operator!=(const Tree_iterator& _y) const {
return m_Node != _y.m_Node;
}

}; //class Tree_iterator



// TEMPLATE CLASS sorted_vector
template<class k,="" bool="" bnoduplicates="false,class" pr="std::less<K">, class A = std::allocator<k> >
class sorted_vector
{
public:
typedef sorted_vector<k,bnoduplicates,pr,a> Myt_;
typedef std::vector<k,a> Cont;
typedef Cont::allocator_type allocator_type;
typedef Cont::size_type size_type;
typedef Cont::difference_type difference_type;
typedef Cont::reference reference;
typedef Cont::const_reference const_reference;
typedef Cont::value_type value_type;
typedef K key_type;
typedef Cont::iterator iterator;
typedef Cont::const_iterator const_iterator;
typedef Pr key_compare;
typedef Pr value_compare;

typedef Cont::const_reverse_iterator
const_reverse_iterator;
typedef Cont::reverse_iterator reverse_iterator;

typedef std::pair<iterator, iterator=""> Pairii_;
typedef std::pair<const_iterator, const_iterator=""> Paircc_;
typedef std::pair<iterator, bool=""> Pairib_;
explicit sorted_vector(const Pr& pred = Pr(),const A& al = A())
:key_compare_(pred),vec_(al){}
#if (_MSC_VER >= 1300)
template<class it="">
sorted_vector(It first, It beyond,
const Pr& pred = Pr(),const A& al = A())
:key_compare_(pred),vec_(first,beyond,al)
{stable_sort();}
#else
sorted_vector(const_iterator first, const_iterator beyond,
const Pr& pred = Pr(),const A& al = A())
:key_compare_(pred),vec_(first,beyond,al)
{stable_sort();}
#endif
sorted_vector(const Myt_& x)
: vec_(x.vec_),key_compare_(x.key_compare_)
{}
~sorted_vector() {}
Myt_& operator=(const Myt_& x) {vec_.operator=(x.vec_);
key_compare_= x.key_compare_;
return *this;}
Myt_& operator=(const Cont& x){vec_.operator=(x);
sort();return *this;}

void reserve(size_type n) {vec_.reserve(n);}
iterator begin() {return vec_.begin(); }
const_iterator begin() const {return vec_.begin(); }
iterator end() {return vec_.end();}
const_iterator end() const {return vec_.end();}
reverse_iterator rbegin() {return vec_.rbegin();}
const_reverse_iterator rbegin() const
{return vec_.rbegin();}

reverse_iterator rend() {return vec_.rend();}
const_reverse_iterator rend() const
{return vec_.rend();}


size_type size() const {return vec_.size();}
size_type max_size() const {return vec_.max_size();}
bool empty() const {return vec_.empty();}
A get_allocator() const {return vec_.get_allocator();}
const_reference at(size_type p) const {return vec_.at(p);}
reference at(size_type p) {return vec_.at(p);}
const_reference operator[](size_type p) const
{return vec_.operator[](p);}

reference operator[](size_type p) {return vec_.operator[](p);}
reference front() {return vec_.front();}
const_reference front() const {return vec_.front();}
reference back() {return vec_.back();}
const_reference back() const {return vec_.back();}
void pop_back() {vec_.pop_back();}

void assign(const_iterator first, const_iterator beyond)
{vec_.assign(first,beyond);}
void assign(size_type n, const K& x = K())
{vec_.assign(n,x);}
/*insert members*/
Pairib_ insert(const value_type& x)
{
if(bNoDuplicates){
iterator p= lower_bound(x);
if(p==end()||key_compare_(x,*p)){
return Pairib_(InsertImpl_(p,x),true);
}else{
return Pairib_(p,false);
}
}else{
iterator p= upper_bound(x);
return Pairib_(InsertImpl_(p,x),true);
}
}
iterator insert(iterator it, const value_type& x)//it is the hint
{
if(it!=end() ){
if(bNoDuplicates){
if(key_compare_(*it,x)){
if((it+1)==end()||KeyCompare_Gt_(*(it+1),x)){//use hint
return InsertImpl_(it+1,x);
}else if(KeyCompare_Geq_(*(it+1),x)){
return end();
}
}
}else{
if( KeyCompare_Leq_(*it,x)
&&((it+1)==end()||KeyCompare_Geq_(*(it+1),x))){
return InsertImpl_(it+1,x);
}
}
}
return insert(x).first;
}
#if (_MSC_VER >= 1300)
template<class it="">
void insert(It first, It beyond)
{
size_type n= std::distance(first,beyond);
reserve(size()+n);
for( ;first!=beyond;++first){
insert(*first);
}
}
#else
void insert(const_iterator first, const_iterator beyond)
{
size_type n= std::distance(first,beyond);
reserve(size()+n);
for( ;first!=beyond;++first){
insert(*first);
}
}
#endif
iterator erase(iterator p) {return vec_.erase(p);}
iterator erase(iterator first, iterator beyond)
{return vec_.erase(first,beyond);}
size_type erase(const K& key)
{
Pairii_ begEnd= equal_range(key);
size_type n= std::distance(begEnd.first,begEnd.second);
erase(begEnd.first,begEnd.second);
return n;
}
void clear() {return vec_.clear();}

bool Eq_(const Myt_& x) const
{return (size() == x.size()
&& std::equal(begin(), end(), x.begin())); }
bool Lt_(const Myt_& x) const
{return (std::lexicographical_compare(begin(), end(),
x.begin(), x.end()));}
void swap(Myt_& x)
{vec_.swap(x.vec_);std::swap(key_compare_,x.key_compare_);}

friend void swap(Myt_& x, Myt_& Y_)
{x.swap(Y_); }

key_compare key_comp() const {return key_compare_; }
value_compare value_comp() const {return (key_comp()); }
iterator find(const K& k)
{ iterator p = lower_bound(k);
return (p==end()||key_compare_(k, *p))? end():p;
}
const_iterator find(const K& k) const
{const_iterator p = lower_bound(k);
return (p==end()||key_compare_(k,*p))?end():p;}
size_type count(const K& k) const
{Paircc_ Ans_ = equal_range(k);
size_type n = std::distance(Ans_.first, Ans_.second);
return (n); }
iterator lower_bound(const K& k)
{return std::lower_bound(begin(), end(), k, key_compare_); }
const_iterator lower_bound(const K& k) const
{return std::lower_bound(begin(), end(), k, key_compare_); }
iterator upper_bound(const K& k)
{return std::upper_bound(begin(), end(), k, key_compare_); }
const_iterator upper_bound(const K& k) const
{return std::upper_bound(begin(), end(), k, key_compare_); }
Pairii_ equal_range(const K& k)
{return std::equal_range(begin(), end(), k, key_compare_); }
Paircc_ equal_range(const K& k) const
{return std::equal_range(begin(), end(), k, key_compare_); }

/*functions for use with direct std::vector-access*/
Cont& get_container()
{return vec_;}
void sort()//restore sorted order after low level access
{ std::sort(vec_.begin(),vec_.end(),key_compare_);
if( bNoDuplicates ){
vec_.erase(Unique_(),vec_.end());
}
}
void stable_sort()//restore sorted order after low level access
{ std::stable_sort(vec_.begin(),vec_.end(),key_compare_);
if( bNoDuplicates ){
erase(Unique_(),end());
}
}
protected:
iterator Unique_()
{ iterator front_= vec_.begin(),out_= vec_.end(),end_=vec_.end();
bool bCopy_= false;
for(iterator prev_; (prev_=front_)!=end_ && ++front_!=end_; ){
if( key_compare_(*prev_,*front_)){
if(bCopy_){
*out_= *front_;
out_++;
}
}else{
if(!bCopy_){out_=front_;bCopy_=true;}
}
}
return out_;
}
iterator InsertImpl_(iterator p,const value_type& x)
{return vec_.insert(p,x);}
bool KeyCompare_Leq_(const K& ty0,const K& ty1)
{return !key_compare_(ty1,ty0);}
bool KeyCompare_Geq_(const K& ty0,const K& ty1)
{return !key_compare_(ty0,ty1);}
bool KeyCompare_Gt_(const K& ty0,const K& ty1)
{return key_compare_(ty1,ty0);}

key_compare key_compare_;
Cont vec_;
};//class sorted_vector


template<class k,bool="" bnoduplicates,class="" pr,="" class="" a=""> inline
bool operator==(const sorted_vector<k, bnoduplicates,pr,a="">& x,
const sorted_vector<k, bnoduplicates,pr,a="">& Y_)
{return x.Eq_(Y_); }
template<class k,bool="" bnoduplicates,class="" pr,="" class="" a=""> inline
bool operator!=(const sorted_vector<k, bnoduplicates,pr,a="">& x,
const sorted_vector<k, bnoduplicates,pr,a="">& Y_)
{return !(x == Y_); }
template<class k,bool="" bnoduplicates,class="" pr,="" class="" a=""> inline
bool operator<(const sorted_vector<k, bnoduplicates,pr,a="">& x,
const sorted_vector<k, bnoduplicates,pr,a="">& Y_)
{return x.Lt_(Y_);}
template<class k,bool="" bnoduplicates,class="" pr,class="" a=""> inline
bool operator>(const sorted_vector<k, bnoduplicates,pr,a="">& x,
const sorted_vector<k, bnoduplicates,pr,a="">& Y_)
{return Y_ < x; }
template<class k,bool="" bnoduplicates,class="" pr,="" class="" a=""> inline
bool operator<=(const sorted_vector<k, bnoduplicates,pr,a="">& x,
const sorted_vector<k, bnoduplicates,pr,a="">& Y_)
{return !(Y_ < x); }
template<class k,="" bool="" bnoduplicates,class="" pr,class="" a=""> inline
bool operator>=(const sorted_vector<k, bnoduplicates,pr,a="">& x,
const sorted_vector<k, bnoduplicates,pr,a="">& Y_)
{return (!(x < Y_)); }


}; //namespace Tiffany

#endif //_TREE_H_
GeneralRe: Sample Test Pin
Member 60974615-Jan-04 18:21
Member 60974615-Jan-04 18:21 
Questionmanaged C++? Pin
K2O328-Jul-03 11:56
K2O328-Jul-03 11:56 
QuestionDo you have a C# version of this? Pin
fetcher27-Jul-03 7:08
fetcher27-Jul-03 7:08 
AnswerRe: Do you have a C# version of this? Pin
Jack Hui27-Jul-03 7:30
Jack Hui27-Jul-03 7:30 
GeneralMoving nodes Pin
suzz..8-Aug-02 20:39
susssuzz..8-Aug-02 20:39 
GeneralRe: Moving nodes Pin
Anonymous9-Aug-02 20:29
Anonymous9-Aug-02 20:29 
GeneralRe: Moving nodes Pin
29-Jul-03 20:52
suss29-Jul-03 20:52 
Questionwhy take chances with bugs? Pin
mystro_AKA_kokie29-May-02 18:55
mystro_AKA_kokie29-May-02 18:55 
AnswerRe: why take chances with bugs? Pin
31-May-02 17:26
suss31-May-02 17:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.