项目作者: mateuszstompor

项目描述 :
a data structure representing a tree, implemented as a generic STL container
高级语言: C++
项目地址: git://github.com/mateuszstompor/tree.git
创建时间: 2018-05-06T14:58:16Z
项目社区:https://github.com/mateuszstompor/tree

开源协议:MIT License

下载


Purpose

In order to create animations hierarchy of bones and parts of a model needs to be preserved.
It can be achived using directed acyclic graphs, but trees have many advantages, one of which is their simplicity.
Class enables user to create hierarchical tree, modify its structure and provide iterator which can notify whenever it changes level during iteration. Why is it important? This feature provides a convenient way to concatenate tranformations.

Where can I find the main class?

In file named “tree.hpp”

How many files I need to include?

Only one

How to compile it?

There is no need of compilation. It is a header only, one class lib.

Installation

If you would like to install the library once and for all I suggest using CMake and running the snippet placed below.

  1. $ git clone https://github.com/mateuszstompor/tree.git
  2. $ cd tree
  3. $ mkdir build && cd build
  4. $ cmake ..
  5. $ make install

Can I trust it?

Yes, whole project is tested and works correctly.

Requirements

In order to use class you need to use of listed compilers to build your project.
If you wish to use the class in Windows please compile with WIN32 flag.


  • GCC, version 8.1

  • clang, version 6.0

Example

  1. #include <iostream>
  2. int main() {
  3. // declare and init
  4. ms::tree<int> t{};
  5. // insert_sibling - in this case adds root node to the tree
  6. t.insert_s(t.end(), 1);
  7. // insert_child - adds child to root node
  8. t.insert_c(t.begin(), 0, 4);
  9. // iterate through the nodes
  10. for(auto i : t) {
  11. std::cout << *i << '\n';
  12. }
  13. }

Build status

Build Status