aimstil
5.0.5
|
A class to represent an N-ary tree. More...
#include <til/til_declarations.h>
Classes | |
class | const_iterator |
Const iterator on n-ary trees. More... | |
struct | Destructor |
class | iterator |
Non-const iterator on n-ary trees. More... | |
class | Node |
Internal class used inside binary tree. More... | |
class | TreeRootAlreadyDefined |
Public Member Functions | |
NaryTree () | |
Default constructor builds an emtpy tree. More... | |
~NaryTree () | |
Destructor. More... | |
std::size_t | size () const |
const_iterator | root () const |
Return a const iterator on the root element of the tree. More... | |
iterator | root () |
Return a non_const iterator on the root element of the tree. More... | |
iterator | addChild (Node *parent, std::size_t childNumber, T value=T()) |
Add a child to a node. More... | |
iterator | addChild (iterator &parent, std::size_t childNumber, T value=T()) |
Add a child to a node. More... | |
A class to represent an N-ary tree.
An N-ary tree is a tree with N numbered branches at each node. Of course, not all of these branches need to be there. But the fact that these branches are numbered (till N) has a meaning: a node having only one branch is only part of the story; whether this branch is number 0 or number 7 is also an information stored in the tree. From that point of view, a tree is not a graph – or then, it is a graph with valued edges. The type of the value stored at each node is of type T. This could be anything – including pointers on actual values. A tree is a container, but it is also much more than a container. Therefore the iterators can be used just like STL iterators, but have also other tree-specific functionalities.
Definition at line 29 of file til_declarations.h.
|
inline |
Default constructor builds an emtpy tree.
Definition at line 60 of file binary_tree.h.
til::NaryTree< T, N >::~NaryTree | ( | ) |
Referenced by til::NaryTree< KDNode< TIndex >, 2 >::NaryTree().
iterator til::NaryTree< T, N >::addChild | ( | Node * | parent, |
std::size_t | childNumber, | ||
T | value = T() |
||
) |
Add a child to a node.
Referenced by til::NaryTree< KDNode< TIndex >, 2 >::addChild(), til::NaryTree< KDNode< TIndex >, 2 >::root(), and til::NaryTree< KDNode< TIndex >, 2 >::size().
|
inline |
Add a child to a node.
Definition at line 339 of file binary_tree.h.
|
inline |
Return a const iterator on the root element of the tree.
Definition at line 328 of file binary_tree.h.
Referenced by til::NaryTree< KDNode< TIndex >, 2 >::size().
|
inline |
Return a non_const iterator on the root element of the tree.
Definition at line 333 of file binary_tree.h.
|
inline |
Definition at line 67 of file binary_tree.h.