Skip to content
A C++ template tree container class for storing data in an arbitrary tree structure. This tree container class is STL-compliant, supports configurable storage models for child nodes, is unit tested and memory tested. It is open source and released under the Apache 2.0 license.
C++ CMake
Branch: master
Clone or download
Latest commit e996f1b Oct 27, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmake Adding cmake installation instructions (#20) Oct 27, 2019
tests clean up some cmake warnings, also add .gitignore Jun 23, 2016
CMakeLists.txt Adding cmake installation instructions (#20) Oct 27, 2019
LICENSE added cmake framework, testing and example skeletons, etc. Sep 28, 2010 Oct 27, 2019


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;


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.
  • Compiles under standard ANSI C++
  • Unit tested
  • Memory tested with valgrind
  • Open sourced under the Apache 2.0 License


Documentation for the st_tree template container class and its components can be found here:

The st_tree wiki is here:


The st_tree project home is here:

Instructions for download and install are here:

Quick start:

# generate makefiles from cmake
$ cd /path/to/st_tree
$ cmake .

# make examples and tests:
$ make

# run unit tests
$ ./tests/unit_tests

# installs header files and cmake integrations to /usr/local
$ make install


Examples reside in the .../st_tree/examples subdirectory. You can also view an annotated list here:


The st_tree repository is published under the Apache License, Version 2.0:

You can’t perform that action at this time.