tree.hhlibrary for C++ provides an STL-like container class for n-ary trees, templated over the data stored at the nodes. Various types of iterators are provided (post-order, pre-order, and others). Where possible the access methods are compatible with the STL or alternative algorithms are available. The library is available under the terms of the GNU General Public License version 2 or 3 (see below).
Documentation is available in the form of a pdf file. See the documentation page for more details and sample programs.
tree.hhlibrary is meant for generic n-ary trees. For binary trees, AVL trees, quad trees and other data structures, you may want to look elsewhere.
The library is available for free, but if it helps you a lot, why not consider a small donation? Your contribution is greatly appreciated!
I have considered this class for inclusion in Boost. However, there are many ways to implement a tree container, and there is no good way to simultaneously satisfy everyone who would use it. See the discussion on the Boost mailing list in 2002 and 2009.
In principle, the
tree.hhcode is available under the terms of the GNU General Public License 2 or 3. However, if you would like to use
tree.hhunder different conditions, contact me and we will work something out.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
If you use
tree.hh, please satisfy my curiosity and write me a small email with a bit of explanation of your software and the role of my tree class in it.