tree.hh

A general purpose templated tree class for C++
Download

tree.hh Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Kasper Peeters
  • Publisher web site:
  • http://www.aei.mpg.de/~peekas/tree/

tree.hh Tags


tree.hh Description

A general purpose templated tree class for C++ tree.hh is a general purpose templated tree class for C++ in the spirit of the STL, and compatible with the STL algorithms.Simple example:The following program constructs a tree of std::string nodes, puts some content in it and applies the find algorithm to find the node with content "two". It then prints the content of all the children of this node. You can download the source tree_example.cc if you're too lazy to type it in. #include < algorithm > #include < string > #include < iostream > #include "tree.hh" using namespace std; int main(int, char **) { tree< string > tr; tree< string >::iterator top, one, two, loc, banana; top=tr.begin(); one=tr.insert(top, "one"); two=tr.append_child(one, "two"); tr.append_child(two, "apple"); banana=tr.append_child(two, "banana"); tr.append_child(banana,"cherry"); tr.append_child(two, "peach"); tr.append_child(one,"three"); loc=find(tr.begin(), tr.end(), "two"); if(loc!=tr.end()) { tree< string >::sibling_iterator sib=tr.begin(loc); while(sib!=tr.end(loc)) { cout


tree.hh Related Software