You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
st_tree: A fast and flexible c++ template class for tree data structures
Introduction
The st_tree library implements a C++ template tree container class for storing data in arbitrary tree structures. st_tree is short for “standard template tree,” and supports STL-compatible interfaces including iterators, allocators and standard STL container methods.
The st_tree library allows the programmer to easily declare and manipulate data in a tree:
// declare a tree of integers, where children are stored using a vector storage model
tree<int> t1;
// declare a tree of strings, where node children are maintained in sorted order
tree<string, ordered<> > t2;
// declare a tree of floating point, where children are indexed by a string label
tree<float, keyed<string> > t3;
Features
The st_tree template container class provides the following features
Fully featured standard STL container interface, including standard container methods, iterators, typedefs and allocators
Common tree-related methods, including ply(), depth(), subtree_size(), is_root() and parent()
Computational efficiency — all operations execute in logarithmic time, except those involving deep copy
Configurable storage models for child nodes — children of a node may be managed using a vector<> (“raw”), multiset<> (“ordered”) or map<> (“keyed”) container model.
# generate makefiles from cmake
$ cd /path/to/st_tree
$ cmake .# generate makefiles to build examples from cmake
$ cd /path/to/st_tree
$ cmake . -DBUILD_EXAMPLES=ON
# make examples and tests:
$ make
# run unit tests
$ ./tests/unit_tests
# installs header files and cmake integrations to /usr/local
$ make install
To build st_tree with a particular c++ standard (e.g. c++ 11, 14, 17, etc):