Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • BackTrack 5 R2
  • Wine 1.4 / 1.5.5
  • Mozilla Firefox 12...
  • Ubuntu 11.04
  • Angry Birds 1.1.2.1
  • Ubuntu 10.04.4 LTS
  • Linux Kernel 3.4
  • Ubuntu Manual 10.10
  • Adobe Flash Player...
  • Pidgin 2.10.4
  • Home > Linux > Programming > Libraries

    tree.hh 2.65

    Download button

    No screenshots available
    Downloads: 519  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Good (3.2/5)
    15 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Kasper Peeters | More programs
    GPL / FREE
    November 9th, 2009, 19:03 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    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


    Product's homepage

      


    TAGS:

    templated tree class | STL algorithm | C++ library | C++ | template | tree



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM